diff --git a/eclipse-extensions/org.springframework.ide.eclipse.xterm/.classpath b/eclipse-extensions/org.springframework.ide.eclipse.xterm/.classpath new file mode 100644 index 000000000..09c2d4447 --- /dev/null +++ b/eclipse-extensions/org.springframework.ide.eclipse.xterm/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/eclipse-extensions/org.springframework.ide.eclipse.xterm/.gitignore b/eclipse-extensions/org.springframework.ide.eclipse.xterm/.gitignore index fb7cde564..a11908f29 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.xterm/.gitignore +++ b/eclipse-extensions/org.springframework.ide.eclipse.xterm/.gitignore @@ -3,5 +3,3 @@ /lib/ .DS_Store /**/.DS_Store -.project -.classpath \ No newline at end of file diff --git a/eclipse-extensions/org.springframework.ide.eclipse.xterm/META-INF/MANIFEST.MF b/eclipse-extensions/org.springframework.ide.eclipse.xterm/META-INF/MANIFEST.MF index 546b024ff..d6cb74fc4 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.xterm/META-INF/MANIFEST.MF +++ b/eclipse-extensions/org.springframework.ide.eclipse.xterm/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: org.springframework.ide.eclipse.xterm Bundle-SymbolicName: org.springframework.ide.eclipse.xterm;singleton:=true Bundle-Version: 4.16.0.qualifier Automatic-Module-Name: org.springframework.ide.eclipse.xterm -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Activator: org.springframework.ide.eclipse.xterm.XtermPlugin Require-Bundle: org.eclipse.ui;bundle-version="3.115.0", org.eclipse.core.runtime, diff --git a/eclipse-extensions/org.springframework.ide.eclipse.xterm/plugin.xml b/eclipse-extensions/org.springframework.ide.eclipse.xterm/plugin.xml index 3310119f9..9bdd5f567 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.xterm/plugin.xml +++ b/eclipse-extensions/org.springframework.ide.eclipse.xterm/plugin.xml @@ -4,6 +4,7 @@ + eclipse-plugin org.springframework.ide.eclipse.xterm + + 11 + 11 + + + org.scala-sbt.ipcsocket diff --git a/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/chromium/browser/ElectronBrowserCanvas.java b/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/chromium/browser/ElectronBrowserCanvas.java index 85a315be9..aff9d5304 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/chromium/browser/ElectronBrowserCanvas.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/chromium/browser/ElectronBrowserCanvas.java @@ -3,6 +3,7 @@ package org.springframework.ide.eclipse.chromium.browser; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -57,10 +58,10 @@ public class ElectronBrowserCanvas extends Canvas private Image createImage(int width, int height) { ImageData data = new ImageData(width, height, 32, new PaletteData(0xff0000,0x00ff00, 0x0000ff)); - data.setAlpha(0, 0, 0); - Arrays.fill(data.alphaData, (byte) -1); - Arrays.fill(data.data, (byte) -1); - return new Image(null, data); +// data.setAlpha(0, 0, 0); +// Arrays.fill(data.alphaData, (byte) -1); +// Arrays.fill(data.data, (byte) -1); + return new Image(getDisplay(), data); } public ElectronBrowserCanvas(Composite parent) @@ -564,8 +565,9 @@ public class ElectronBrowserCanvas extends Canvas try { // TODO add Linux and Mac - unzip(getClass().getResourceAsStream("/headless-electron-darwin-x64-0.0.1.zip"), tempDir); - ProcessBuilder processBuilder = new ProcessBuilder(tempDir + File.separator + "headless-electron.app/Contents/MacOS/headless-electron"); +// unzip(getClass().getResourceAsStream("/headless-electron-darwin-x64-0.0.1.zip"), tempDir); + unzip(new FileInputStream(new File(System.getProperty("user.home") + "/headless-electron-win32-x64-0.0.1.zip")), tempDir); + ProcessBuilder processBuilder = new ProcessBuilder(tempDir + File.separator + "headless-electron.exe"); process = processBuilder.start(); } catch (IOException e1) diff --git a/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/xterm/views/TerminalView.java b/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/xterm/views/TerminalView.java index 08b5aa82f..a411297a7 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/xterm/views/TerminalView.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.xterm/src/org/springframework/ide/eclipse/xterm/views/TerminalView.java @@ -21,19 +21,14 @@ import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGBA; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewSite; @@ -64,7 +59,6 @@ public class TerminalView extends ViewPart { private Action refreshAction; private ElectronBrowserCanvas browser; - private Text addressBar; private String terminalId = DEFAULT_TERMINAL_ID; @@ -74,8 +68,6 @@ public class TerminalView extends ViewPart { private boolean isNewView; - private Composite parent; - private final IPropertyChangeListener PROPERTY_LISTENER = new IPropertyChangeListener() { @Override @@ -97,41 +89,10 @@ public class TerminalView extends ViewPart { @Override public void createPartControl(Composite parent) { - this.parent = parent; PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(PROPERTY_LISTENER); - Composite shell = new Composite(parent, SWT.None); - GridLayout layout = new GridLayout(1, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - shell.setLayout(layout); - - - String url = "https://google.com"; - addressBar = new Text(shell, SWT.SINGLE); - addressBar.setText(url); - GridData layoutData1 = new GridData(SWT.FILL, SWT.CENTER, true, false); - addressBar.setLayoutData(layoutData1); - - browser = new ElectronBrowserCanvas(shell, false); - GridData layoutData2 = new GridData(SWT.FILL, SWT.FILL, true, true); - browser.setLayoutData(layoutData2); - - addressBar.addListener(SWT.Traverse, event -> { - if (event.detail == SWT.TRAVERSE_RETURN) - { - String text = addressBar.getText(); - if (!text.startsWith("http") && !text.isEmpty()) - { - text = "http://" + text; - addressBar.setText(text); - } - browser.browse(text); - } - }); - -// browser = new ElectronBrowserCanvas(parent, false); -// browser.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); + browser = new ElectronBrowserCanvas(parent, true); + browser.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); makeActions(); contributeToActionBars(); if (isNewView) { @@ -142,6 +103,7 @@ public class TerminalView extends ViewPart { } else { navigateToTerminal(terminalId, cmd, cwd == null ? ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString() : cwd); } + } private boolean isDefault() { @@ -189,7 +151,6 @@ public class TerminalView extends ViewPart { if (Display.getCurrent() != null) { if (browser != null && !browser.isDisposed() && terminalId.equals(TerminalView.this.terminalId)) { String url = createUrl(serviceUrl, terminalId, cmd, cwd); - addressBar.setText(url); XtermPlugin.getDefault().getLog().info("Navigating to " + url); browser.browse(url); } @@ -199,7 +160,6 @@ public class TerminalView extends ViewPart { display.asyncExec(() -> { if (browser != null && !browser.isDisposed() && terminalId.equals(TerminalView.this.terminalId)) { String url = createUrl(serviceUrl, terminalId, cmd, cwd); - addressBar.setText(url); XtermPlugin.getDefault().getLog().info("Navigating to " + url); browser.browse(url); }