Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java100
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties12
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java43
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java375
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java18
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java65
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java68
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java74
14 files changed, 523 insertions, 358 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
index 9013e8f32..80de64f1c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/activator/UIPlugin.java
@@ -12,8 +12,8 @@ package org.eclipse.tcf.te.ui.terminals.local.activator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
-import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
+import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
+import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -44,7 +44,7 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Convenience method which returns the unique identifier of this plugin.
+ * Convenience method which returns the unique identifier of this plug-in.
*/
public static String getUniqueIdentifier() {
if (getDefault() != null && getDefault().getBundle() != null) {
@@ -54,7 +54,7 @@ public class UIPlugin extends AbstractUIPlugin {
}
/**
- * Return the scoped preferences for this plugin.
+ * Return the scoped preferences for this plug-in.
*/
public static ScopedEclipsePreferences getScopedPreferences() {
if (scopedPreferences == null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
index 7b3e3249b..8384b530e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
@@ -9,7 +9,8 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.local.controls;
-import org.eclipse.core.resources.IResource;
+import java.util.Map;
+
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -17,35 +18,33 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
-import org.eclipse.tcf.te.ui.interfaces.data.IDataExchangeNode;
-import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
+import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchEncoding;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.osgi.framework.Bundle;
/**
* Serial wizard configuration panel implementation.
*/
-public class LocalWizardConfigurationPanel extends AbstractConfigurationPanel implements IDataExchangeNode {
+public class LocalWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
- private IResource resource;
+ private Object resource;
/**
* Constructor.
*
- * @param parentControl The parent control. Must not be <code>null</code>!
+ * @param container The configuration panel container or <code>null</code>.
*/
- public LocalWizardConfigurationPanel(BaseDialogPageControl parentControl) {
- super(parentControl);
+ public LocalWizardConfigurationPanel(IConfigurationPanelContainer container) {
+ super(container);
}
/* (non-Javadoc)
@@ -77,51 +76,47 @@ public class LocalWizardConfigurationPanel extends AbstractConfigurationPanel im
layoutData.heightHint = 80;
label.setLayoutData(layoutData);
- resource = getSelectionResource();
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ resource = getSelectionResource();
+ }
setControl(panel);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#dataChanged(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.swt.events.TypedEvent)
- */
- @Override
- public boolean dataChanged(IPropertiesContainer data, TypedEvent e) {
- return false;
- }
-
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#setupData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map)
*/
@Override
- public void setupData(IPropertiesContainer data) {
+ public void setupData(Map<String, Object> data) {
if (data == null) return;
- String value = data.getStringProperty(ITerminalsConnectorConstants.PROP_ENCODING);
+ String value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
if (value != null) setEncoding(value);
}
-
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.wizards.interfaces.ISharedDataWizardPage#extractData(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map)
*/
@Override
- public void extractData(IPropertiesContainer data) {
+ public void extractData(Map<String, Object> data) {
// set the terminal connector id for local terminal
- data.setProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"); //$NON-NLS-1$
// set the connector type for local terminal
- data.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ data.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
// Store the encoding
- data.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
-
- // if we have a IResource selection use the location for working directory
- if (resource != null){
- String dir = resource.getProject().getLocation().toString();
- data.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
- }
+ data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
+
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ // if we have a IResource selection use the location for working directory
+ if (resource instanceof org.eclipse.core.resources.IResource){
+ String dir = ((org.eclipse.core.resources.IResource)resource).getProject().getLocation().toString();
+ data.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
+ }
+ }
}
/* (non-Javadoc)
@@ -185,17 +180,17 @@ public class LocalWizardConfigurationPanel extends AbstractConfigurationPanel im
*
* @return the IResource, or <code>null</code>.
*/
- private IResource getSelectionResource() {
+ private org.eclipse.core.resources.IResource getSelectionResource() {
ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = selectionService != null ? selectionService.getSelection() : StructuredSelection.EMPTY;
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
Object element = ((IStructuredSelection) selection).getFirstElement();
- if (element instanceof IResource){
- return ((IResource)element);
+ if (element instanceof org.eclipse.core.resources.IResource){
+ return ((org.eclipse.core.resources.IResource)element);
}
if (element instanceof IAdaptable) {
- return (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ return (org.eclipse.core.resources.IResource) ((IAdaptable) element).getAdapter(org.eclipse.core.resources.IResource.class);
}
}
return null;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
index fb64f5a17..d3fde5c3d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
@@ -10,12 +10,13 @@
package org.eclipse.tcf.te.ui.terminals.local.launcher;
import java.io.File;
+import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.UnknownHostException;
import java.util.Iterator;
+import java.util.Map;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
@@ -24,14 +25,12 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.ServiceManager;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalService;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil;
-import org.eclipse.tcf.te.ui.controls.BaseDialogPageControl;
+import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel;
+import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
@@ -40,6 +39,7 @@ import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchEncoding;
+import org.osgi.framework.Bundle;
/**
* Serial launcher delegate implementation.
@@ -57,24 +57,24 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.controls.BaseDialogPageControl)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer)
*/
@Override
- public IConfigurationPanel getPanel(BaseDialogPageControl parentControl) {
- return new LocalWizardConfigurationPanel(parentControl);
+ public IConfigurationPanel getPanel(IConfigurationPanelContainer container) {
+ return new LocalWizardConfigurationPanel(container);
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done)
*/
@Override
- public void execute(IPropertiesContainer properties, ICallback callback) {
+ public void execute(Map<String, Object> properties, Done done) {
Assert.isNotNull(properties);
// Set the terminal tab title
String terminalTitle = getTerminalTitle(properties);
if (terminalTitle != null) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
}
// If not configured, set the default encodings for the local terminal
@@ -87,13 +87,13 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
} else {
encoding = WorkbenchEncoding.getWorkbenchDefaultEncoding();
}
- if (encoding != null && !"".equals(encoding)) properties.setProperty(ITerminalsConnectorConstants.PROP_ENCODING, encoding); //$NON-NLS-1$
+ if (encoding != null && !"".equals(encoding)) properties.put(ITerminalsConnectorConstants.PROP_ENCODING, encoding); //$NON-NLS-1$
}
// For local terminals, force a new terminal tab each time it is launched,
// if not set otherwise from outside
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
+ properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
}
// Initialize the local terminal working directory.
@@ -112,11 +112,14 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
} catch (URISyntaxException ex) { /* ignored on purpose */ }
}
} else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
- if (ResourcesPlugin.getWorkspace() != null
- && ResourcesPlugin.getWorkspace().getRoot() != null
- && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- cwd = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
- }
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
+ cwd = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+ }
} else {
IPath p = new Path(initialCwd);
if (p.toFile().canRead() && p.toFile().isDirectory()) {
@@ -125,14 +128,14 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
}
if (cwd != null && !"".equals(cwd)) { //$NON-NLS-1$
- properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, cwd);
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, cwd);
}
// If the current selection resolved to an folder, default the working directory
// to that folder and update the terminal title
ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
if ((service != null && service.getSelection() != null) || properties.containsKey(ITerminalsConnectorConstants.PROP_SELECTION)) {
- ISelection selection = (ISelection)properties.getProperty(ITerminalsConnectorConstants.PROP_SELECTION);
+ ISelection selection = (ISelection)properties.get(ITerminalsConnectorConstants.PROP_SELECTION);
if (selection == null) selection = service.getSelection();
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
String dir = null;
@@ -140,37 +143,40 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
while (iter.hasNext()) {
Object element = iter.next();
- // If the element is not an IResource, try to adapt to IResource
- if (!(element instanceof IResource)) {
- Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(IResource.class) : null;
- if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, IResource.class);
- if (adapted != null) element = adapted;
- }
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ // If the element is not an IResource, try to adapt to IResource
+ if (!(element instanceof org.eclipse.core.resources.IResource)) {
+ Object adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null;
+ if (adapted == null) adapted = Platform.getAdapterManager().getAdapter(element, org.eclipse.core.resources.IResource.class);
+ if (adapted != null) element = adapted;
+ }
- if (element instanceof IResource && ((IResource)element).exists()) {
- IPath location = ((IResource)element).getLocation();
- if (location == null) continue;
- if (location.toFile().isFile()) location = location.removeLastSegments(1);
- if (location.toFile().isDirectory() && location.toFile().canRead()) {
- dir = location.toFile().getAbsolutePath();
- break;
+ if (element instanceof org.eclipse.core.resources.IResource && ((org.eclipse.core.resources.IResource)element).exists()) {
+ IPath location = ((org.eclipse.core.resources.IResource)element).getLocation();
+ if (location == null) continue;
+ if (location.toFile().isFile()) location = location.removeLastSegments(1);
+ if (location.toFile().isDirectory() && location.toFile().canRead()) {
+ dir = location.toFile().getAbsolutePath();
+ break;
+ }
}
}
}
if (dir != null) {
- properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR, dir);
String basename = new Path(dir).lastSegment();
- properties.setProperty(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put(ITerminalsConnectorConstants.PROP_TITLE, basename + " (" + terminalTitle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
// Get the terminal service
- ITerminalService terminal = ServiceManager.getInstance().getService(ITerminalService.class);
+ ITerminalService terminal = TerminalServiceFactory.getService();
// If not available, we cannot fulfill this request
if (terminal != null) {
- terminal.openConsole(properties, callback);
+ terminal.openConsole(properties, done);
}
}
@@ -181,11 +187,13 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
*
* @return The terminal title string or <code>null</code>.
*/
- private String getTerminalTitle(IPropertiesContainer properties) {
- String[] hostNames= IPAddressUtil.getInstance().getCanonicalHostNames();
- if (hostNames.length != 0){
- return hostNames[0];
- }
+ private String getTerminalTitle(Map<String, Object> properties) {
+ try {
+ String hostname = InetAddress.getLocalHost().getHostName();
+ if (hostname != null && !"".equals(hostname.trim())) { //$NON-NLS-1$
+ return hostname;
+ }
+ } catch (UnknownHostException e) { /* ignored on purpose */ }
return "Local"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
index b3e441b19..879461855 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherHandler.java
@@ -9,13 +9,14 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.local.launcher;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -46,10 +47,10 @@ public class LocalLauncherHandler extends AbstractHandler {
// Launch the local terminal
if (delegate != null) {
- IPropertiesContainer properties = new PropertiesContainer();
- properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- properties.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
- properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
delegate.execute(properties, null);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
index 5596ddb38..b1852b64a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalMementoHandler.java
@@ -9,8 +9,9 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.local.launcher;
+import java.util.Map;
+
import org.eclipse.core.runtime.Assert;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler;
import org.eclipse.ui.IMemento;
@@ -20,20 +21,19 @@ import org.eclipse.ui.IMemento;
public class LocalMementoHandler implements IMementoHandler {
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void saveState(IMemento memento, IPropertiesContainer properties) {
+ public void saveState(IMemento memento, Map<String, Object> properties) {
Assert.isNotNull(memento);
Assert.isNotNull(properties);
-
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map)
*/
@Override
- public void restoreState(IMemento memento, IPropertiesContainer properties) {
+ public void restoreState(IMemento memento, Map<String, Object> properties) {
Assert.isNotNull(memento);
Assert.isNotNull(properties);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
index b86b7c04d..5052f96cf 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
@@ -49,18 +49,10 @@ public class Messages extends NLS {
public static String ExternalExecutablesDialog_title_add;
public static String ExternalExecutablesDialog_title_edit;
public static String ExternalExecutablesDialog_button_add;
+ public static String ExternalExecutablesDialog_button_browse;
public static String ExternalExecutablesDialog_field_path;
- public static String ExternalExecutablesDialog_name_info_missingValue;
- public static String ExternalExecutablesDialog_path_info_missingFilename;
- public static String ExternalExecutablesDialog_path_error_mustExist;
- public static String ExternalExecutablesDialog_path_error_invalidFilename;
- public static String ExternalExecutablesDialog_path_error_noAccess;
- public static String ExternalExecutablesDialog_path_error_isRelativ;
+ public static String ExternalExecutablesDialog_field_name;
public static String ExternalExecutablesDialog_field_args;
public static String ExternalExecutablesDialog_field_icon;
public static String ExternalExecutablesDialog_field_translate;
- public static String ExternalExecutablesDialog_icon_error_mustExist;
- public static String ExternalExecutablesDialog_icon_error_invalidFilename;
- public static String ExternalExecutablesDialog_icon_error_noAccess;
- public static String ExternalExecutablesDialog_icon_error_isRelativ;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
index a48a0977c..626196402 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
@@ -13,20 +13,12 @@ ProcessConnector_error_creatingProcess=Exception when creating process. Possibly
ExternalExecutablesDialog_title_add=Add External Executable
ExternalExecutablesDialog_title_edit=Edit External Executable
ExternalExecutablesDialog_button_add=Add
+ExternalExecutablesDialog_button_browse=Browse...
ExternalExecutablesDialog_field_path=Path:
-ExternalExecutablesDialog_name_info_missingValue=Please enter a valid name for the external executable.
-ExternalExecutablesDialog_path_info_missingFilename=Please enter the absolute path of the external executable.
-ExternalExecutablesDialog_path_error_mustExist=The external executable path you entered doesn't exist.
-ExternalExecutablesDialog_path_error_invalidFilename=The external executable path you entered is not valid.
-ExternalExecutablesDialog_path_error_noAccess=The external executable path cannot be accessed.
-ExternalExecutablesDialog_path_error_isRelativ=The external executable path cannot be relative.
+ExternalExecutablesDialog_field_name=Name:
ExternalExecutablesDialog_field_args=Arguments:
ExternalExecutablesDialog_field_icon=Icon:
ExternalExecutablesDialog_field_translate=Translate Backslashes on Paste
-ExternalExecutablesDialog_icon_error_mustExist=The external executable icon path you entered doesn't exist.
-ExternalExecutablesDialog_icon_error_invalidFilename=The external executable icon path you entered is not valid.
-ExternalExecutablesDialog_icon_error_noAccess=The external executable icon path cannot be accessed.
-ExternalExecutablesDialog_icon_error_isRelativ=The external executable icon path cannot be relative.
# ***** Preference Pages *****
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
index d05e81de1..7aa244eb6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/DynamicContributionItems.java
@@ -10,11 +10,11 @@
package org.eclipse.tcf.te.ui.terminals.local.showin;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
@@ -22,10 +22,7 @@ import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.tcf.te.runtime.callback.Callback;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.properties.PropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
@@ -63,15 +60,15 @@ public class DynamicContributionItems extends CompoundContributionItem implement
List<IContributionItem> items = new ArrayList<IContributionItem>();
if (delegate != null) {
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
if (l != null && !l.isEmpty()) {
- for (Map<String, Object> executableData : l) {
- String name = (String) executableData.get(IExternalExecutablesProperties.PROP_NAME);
- String path = (String) executableData.get(IExternalExecutablesProperties.PROP_PATH);
- String args = (String) executableData.get(IExternalExecutablesProperties.PROP_ARGS);
- String icon = (String) executableData.get(IExternalExecutablesProperties.PROP_ICON);
+ for (Map<String, String> executableData : l) {
+ String name = executableData.get(IExternalExecutablesProperties.PROP_NAME);
+ String path = executableData.get(IExternalExecutablesProperties.PROP_PATH);
+ String args = executableData.get(IExternalExecutablesProperties.PROP_ARGS);
+ String icon = executableData.get(IExternalExecutablesProperties.PROP_ICON);
- String strTranslate = (String) executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
+ String strTranslate = executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
boolean translate = strTranslate != null ? Boolean.parseBoolean(strTranslate) : false;
if (name != null && !"".equals(name) && path != null && !"".equals(path)) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -116,19 +113,15 @@ public class DynamicContributionItems extends CompoundContributionItem implement
ISelection selection = service != null ? service.getSelection() : null;
if (selection != null && selection.isEmpty()) selection = null;
- IPropertiesContainer properties = new PropertiesContainer();
- properties.setProperty(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
- properties.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
- if (selection != null) properties.setProperty(ITerminalsConnectorConstants.PROP_SELECTION, selection);
- properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path);
- if (args != null) properties.setProperty(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args);
- properties.setProperty(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, translate);
-
- delegate.execute(properties, new Callback() {
- @Override
- protected void internalDone(Object caller, IStatus status) {
- }
- });
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(ITerminalsConnectorConstants.PROP_DELEGATE_ID, delegate.getId());
+ properties.put(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.local"); //$NON-NLS-1$
+ if (selection != null) properties.put(ITerminalsConnectorConstants.PROP_SELECTION, selection);
+ properties.put(ITerminalsConnectorConstants.PROP_PROCESS_PATH, path);
+ if (args != null) properties.put(ITerminalsConnectorConstants.PROP_PROCESS_ARGS, args);
+ properties.put(ITerminalsConnectorConstants.PROP_TRANSLATE_BACKSLASHES_ON_PASTE, Boolean.valueOf(translate));
+
+ delegate.execute(properties, null);
}
};
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
index fedc5b072..0179898e3 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
@@ -9,42 +9,52 @@
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.local.showin;
+import java.io.File;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-import org.eclipse.tcf.te.ui.controls.common.NameControl;
-import org.eclipse.tcf.te.ui.controls.file.FileSelectionControl;
-import org.eclipse.tcf.te.ui.controls.validator.FileNameValidator;
-import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
-import org.eclipse.tcf.te.ui.controls.validator.Validator;
-import org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog;
-import org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.te.ui.terminals.local.help.IContextHelpIds;
import org.eclipse.tcf.te.ui.terminals.local.nls.Messages;
import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
+import org.eclipse.ui.PlatformUI;
+import org.osgi.framework.Bundle;
/**
* External executables dialog implementation.
*/
-public class ExternalExecutablesDialog extends CustomTrayDialog implements IValidatingContainer {
+public class ExternalExecutablesDialog extends TrayDialog {
+ private String contextHelpId = null;
private final boolean edit;
- private NameControl name;
- private FileSelectionControl path;
- private BaseEditBrowseTextControl args;
- private FileSelectionControl icon;
+
+ private Text name;
+ /* default */ Text path;
+ private Text args;
+ /* default */ Text icon;
private Button translate;
- private Map<String, Object> executableData;
+ /* default */ String last_filter_path = null;
+ /* default */ String last_filter_icon = null;
+
+ private Map<String, String> executableData;
/**
* Constructor.
@@ -52,16 +62,61 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
* @param shell The parent shell or <code>null</code>.
*/
public ExternalExecutablesDialog(Shell shell, boolean edit) {
- super(shell, IContextHelpIds.EXTERNAL_EXECUTABLES_DIALOG);
+ super(shell);
this.edit = edit;
- }
+
+ this.contextHelpId = IContextHelpIds.EXTERNAL_EXECUTABLES_DIALOG;
+ setHelpAvailable(true);
+ }
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.dialogs.CustomTrayDialog#createDialogAreaContent(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
- protected void createDialogAreaContent(Composite parent) {
- super.createDialogAreaContent(parent);
+ protected final Control createDialogArea(Composite parent) {
+ if (contextHelpId != null) {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId);
+ }
+
+ // Let the super implementation create the dialog area control
+ Control control = super.createDialogArea(parent);
+ // Setup the inner panel as scrollable composite
+ if (control instanceof Composite) {
+ ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL);
+
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ layout.verticalSpacing = 0; layout.horizontalSpacing = 0;
+
+ sc.setLayout(layout);
+ sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ sc.setExpandHorizontal(true);
+ sc.setExpandVertical(true);
+
+ Composite composite = new Composite(sc, SWT.NONE);
+ composite.setLayout(new GridLayout());
+
+ // Setup the dialog area content
+ createDialogAreaContent(composite);
+
+ sc.setContent(composite);
+ sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+
+ // Return the scrolled composite as new dialog area control
+ control = sc;
+ }
+
+ return control;
+ }
+
+ /**
+ * Creates the dialog area content.
+ *
+ * @param parent The parent composite. Must not be <code>null</code>.
+ */
+ protected void createDialogAreaContent(Composite parent) {
+ Assert.isNotNull(parent);
setDialogTitle(edit ? Messages.ExternalExecutablesDialog_title_edit : Messages.ExternalExecutablesDialog_title_add);
@@ -70,86 +125,146 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
layout.marginHeight = 0; layout.marginWidth = 0;
panel.setLayout(layout);
GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, true);
- layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(panel, 50);
+ layoutData.widthHint = convertWidthInCharsToPixels(50);
panel.setLayoutData(layoutData);
- name = new NameControl(null) {
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- super.configureEditFieldValidator(validator);
- validator.setMessageText(RegexValidator.INFO_MISSING_VALUE, Messages.ExternalExecutablesDialog_name_info_missingValue);
- }
- @Override
- public IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
- }
- };
- name.setParentControlIsInnerPanel(true);
- name.setupPanel(panel);
-
- path = new FileSelectionControl(null) {
- @Override
- protected Validator doCreateEditFieldValidator() {
- return new FileNameValidator(Validator.ATTR_MANDATORY |
- FileNameValidator.ATTR_MUST_EXIST |
- FileNameValidator.ATTR_CAN_READ |
- FileNameValidator.ATTR_ABSOLUT);
- }
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- super.configureEditFieldValidator(validator);
- validator.setMessageText(FileNameValidator.INFO_MISSING_FILE_NAME, Messages.ExternalExecutablesDialog_path_info_missingFilename);
- validator.setMessageText(FileNameValidator.ERROR_MUST_EXIST, Messages.ExternalExecutablesDialog_path_error_mustExist);
- validator.setMessageText(FileNameValidator.ERROR_INVALID_FILE_NAME, Messages.ExternalExecutablesDialog_path_error_invalidFilename);
- validator.setMessageText(FileNameValidator.ERROR_NO_ACCESS, Messages.ExternalExecutablesDialog_path_error_noAccess);
- validator.setMessageText(FileNameValidator.ERROR_IS_RELATIV, Messages.ExternalExecutablesDialog_path_error_isRelativ);
-
+ Label label = new Label(panel, SWT.HORIZONTAL);
+ label.setText(Messages.ExternalExecutablesDialog_field_name);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(layoutData);
- }
- @Override
- public IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
- }
- };
- path.setIsGroup(false);
- path.setParentControlIsInnerPanel(true);
- path.setEditFieldLabel(Messages.ExternalExecutablesDialog_field_path);
- path.setupPanel(panel);
+ name = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ name.setLayoutData(layoutData);
- args = new BaseEditBrowseTextControl(null) {
+ Composite panel2 = new Composite(panel, SWT.NONE);
+ layout = new GridLayout(3, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel2.setLayout(layout);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ panel2.setLayoutData(layoutData);
+
+ label = new Label(panel2, SWT.HORIZONTAL);
+ label.setText(Messages.ExternalExecutablesDialog_field_path);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(layoutData);
+
+ path = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ path.setLayoutData(layoutData);
+
+ Button button = new Button(panel2, SWT.PUSH);
+ button.setText(Messages.ExternalExecutablesDialog_button_browse);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(10);
+ button.setLayoutData(layoutData);
+ button.addSelectionListener(new SelectionAdapter() {
@Override
- public IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
+
+ String selectedFile = path.getText();
+ if (selectedFile != null && selectedFile.trim().length() > 0) {
+ IPath filePath = new Path(selectedFile);
+ // If the selected file points to an directory, use the directory as is
+ IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1);
+ while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) {
+ filterPath = filterPath.removeLastSegments(1);
+ }
+ String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment();
+
+ if (filterPath != null && !filterPath.isEmpty()) dialog.setFilterPath(filterPath.toString());
+ if (filterFileName != null) dialog.setFileName(filterFileName);
+ } else {
+ String workspace = null;
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+
+ String filterPath = last_filter_path != null ? last_filter_path : workspace;
+ dialog.setFilterPath(filterPath);
+ }
+
+ selectedFile = dialog.open();
+ if (selectedFile != null) {
+ last_filter_path = dialog.getFilterPath();
+ path.setText(selectedFile);
+ }
}
- };
- args.setEditFieldLabel(Messages.ExternalExecutablesDialog_field_args);
- args.setParentControlIsInnerPanel(true);
- args.setupPanel(panel);
+ });
- icon = new FileSelectionControl(null) {
- @Override
- protected Validator doCreateEditFieldValidator() {
- return new FileNameValidator(FileNameValidator.ATTR_MUST_EXIST | FileNameValidator.ATTR_CAN_READ | FileNameValidator.ATTR_ABSOLUT);
- }
- @Override
- protected void configureEditFieldValidator(Validator validator) {
- super.configureEditFieldValidator(validator);
- validator.setMessageText(FileNameValidator.ERROR_MUST_EXIST, Messages.ExternalExecutablesDialog_icon_error_mustExist);
- validator.setMessageText(FileNameValidator.ERROR_INVALID_FILE_NAME, Messages.ExternalExecutablesDialog_icon_error_invalidFilename);
- validator.setMessageText(FileNameValidator.ERROR_NO_ACCESS, Messages.ExternalExecutablesDialog_icon_error_noAccess);
- validator.setMessageText(FileNameValidator.ERROR_IS_RELATIV, Messages.ExternalExecutablesDialog_icon_error_isRelativ);
+ label = new Label(panel, SWT.HORIZONTAL);
+ label.setText(Messages.ExternalExecutablesDialog_field_args);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(layoutData);
+ args = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ args.setLayoutData(layoutData);
- }
+ panel2 = new Composite(panel, SWT.NONE);
+ layout = new GridLayout(3, false);
+ layout.marginHeight = 0; layout.marginWidth = 0;
+ panel2.setLayout(layout);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.horizontalSpan = 2;
+ panel2.setLayoutData(layoutData);
+
+ label = new Label(panel2, SWT.HORIZONTAL);
+ label.setText(Messages.ExternalExecutablesDialog_field_icon);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ label.setLayoutData(layoutData);
+
+ icon = new Text(panel, SWT.HORIZONTAL | SWT.SINGLE);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(30);
+ icon.setLayoutData(layoutData);
+
+ button = new Button(panel2, SWT.PUSH);
+ button.setText(Messages.ExternalExecutablesDialog_button_browse);
+ layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ layoutData.widthHint = convertWidthInCharsToPixels(10);
+ button.setLayoutData(layoutData);
+ button.addSelectionListener(new SelectionAdapter() {
@Override
- public IValidatingContainer getValidatingContainer() {
- return ExternalExecutablesDialog.this;
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
+
+ String selectedFile = icon.getText();
+ if (selectedFile != null && selectedFile.trim().length() > 0) {
+ IPath filePath = new Path(selectedFile);
+ // If the selected file points to an directory, use the directory as is
+ IPath filterPath = filePath.toFile().isDirectory() ? filePath : filePath.removeLastSegments(1);
+ while (filterPath != null && filterPath.segmentCount() > 1 && !filterPath.toFile().exists()) {
+ filterPath = filterPath.removeLastSegments(1);
+ }
+ String filterFileName = filePath.toFile().isDirectory() || !filePath.toFile().exists() ? null : filePath.lastSegment();
+
+ if (filterPath != null && !filterPath.isEmpty()) dialog.setFilterPath(filterPath.toString());
+ if (filterFileName != null) dialog.setFileName(filterFileName);
+ } else {
+ String workspace = null;
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+
+ String filterPath = last_filter_icon != null ? last_filter_icon : workspace;
+ dialog.setFilterPath(filterPath);
+ }
+
+ selectedFile = dialog.open();
+ if (selectedFile != null) {
+ last_filter_icon = dialog.getFilterPath();
+ icon.setText(selectedFile);
+ }
}
- };
- icon.setIsGroup(false);
- icon.setParentControlIsInnerPanel(true);
- icon.setEditFieldLabel(Messages.ExternalExecutablesDialog_field_icon);
- icon.setupPanel(panel);
+ });
translate = new Button(panel, SWT.CHECK);
translate.setText(Messages.ExternalExecutablesDialog_field_translate);
@@ -158,15 +273,15 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
translate.setLayoutData(layoutData);
if (executableData != null) {
- String value = (String)executableData.get(IExternalExecutablesProperties.PROP_NAME);
- name.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_PATH);
- path.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_ARGS);
- args.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_ICON);
- icon.setEditFieldControlText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
- value = (String)executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
+ String value = executableData.get(IExternalExecutablesProperties.PROP_NAME);
+ name.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ value = executableData.get(IExternalExecutablesProperties.PROP_PATH);
+ path.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ value = executableData.get(IExternalExecutablesProperties.PROP_ARGS);
+ args.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ value = executableData.get(IExternalExecutablesProperties.PROP_ICON);
+ icon.setText(value != null && !"".equals(value.trim()) ? value : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ value = executableData.get(IExternalExecutablesProperties.PROP_TRANSLATE);
translate.setSelection(value != null ? Boolean.parseBoolean(value) : false);
}
}
@@ -199,30 +314,30 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
protected void okPressed() {
if (name != null && path != null) {
// Extract the executable properties
- if (executableData == null) executableData = new HashMap<String, Object>();
+ if (executableData == null) executableData = new HashMap<String, String>();
- String value = name.getEditFieldControlText();
+ String value = name.getText();
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
executableData.put(IExternalExecutablesProperties.PROP_NAME, value);
} else {
executableData.remove(IExternalExecutablesProperties.PROP_NAME);
}
- value = path.getEditFieldControlText();
+ value = path.getText();
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
executableData.put(IExternalExecutablesProperties.PROP_PATH, value);
} else {
executableData.remove(IExternalExecutablesProperties.PROP_PATH);
}
- value = args.getEditFieldControlText();
+ value = args.getText();
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
executableData.put(IExternalExecutablesProperties.PROP_ARGS, value);
} else {
executableData.remove(IExternalExecutablesProperties.PROP_ARGS);
}
- value = icon.getEditFieldControlText();
+ value = icon.getText();
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
executableData.put(IExternalExecutablesProperties.PROP_ICON, value);
} else {
@@ -252,7 +367,7 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
*
* @return The executable properties or <code>null</code>.
*/
- public Map<String, Object> getExecutableData() {
+ public Map<String, String> getExecutableData() {
return executableData;
}
@@ -262,44 +377,54 @@ public class ExternalExecutablesDialog extends CustomTrayDialog implements IVali
*
* @param data The executable properties or <code>null</code>.
*/
- public void setExecutableData(Map<String, Object> data) {
+ public void setExecutableData(Map<String, String> data) {
if (data == null) {
executableData = data;
} else {
- executableData = new HashMap<String, Object>(data);
+ executableData = new HashMap<String, String>(data);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#validate()
+ /**
+ * Validate the dialog.
*/
- @Override
public void validate() {
boolean valid = true;
- if (name != null) {
- valid = name.isValid();
- }
-
- if (path != null) {
- valid |= path.isValid();
+ if (name != null && !name.isDisposed()) {
+ valid = !"".equals(name.getText()); //$NON-NLS-1$
}
- if (args != null) {
- valid |= args.isValid();
+ if (path != null && !path.isDisposed()) {
+ String value = path.getText();
+ if (!"".equals(value)) { //$NON-NLS-1$
+ File f = new File(value);
+ valid |= f.isAbsolute() && f.canRead();
+ } else {
+ valid = false;
+ }
}
- if (icon != null) {
- valid |= icon.isValid();
+ if (icon != null && !icon.isDisposed()) {
+ String value = icon.getText();
+ if (!"".equals(value)) { //$NON-NLS-1$
+ File f = new File(value);
+ valid |= f.isAbsolute() && f.canRead();
+ }
}
- SWTControlUtil.setEnabled(getButton(IDialogConstants.OK_ID), valid);
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null) okButton.setEnabled(valid);
}
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.jface.interfaces.IValidatingContainer#setMessage(java.lang.String, int)
+ /**
+ * Sets the title for this dialog.
+ *
+ * @param title The title.
*/
- @Override
- public void setMessage(String message, int messageType) {
- }
+ public void setDialogTitle(String title) {
+ if (getShell() != null && !getShell().isDisposed()) {
+ getShell().setText(title);
+ }
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java
index af9bade27..1bcca4a52 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
-import org.eclipse.tcf.te.runtime.utils.Host;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutablesProperties;
import org.eclipse.ui.IStartup;
@@ -31,7 +31,7 @@ public class ExternalExecutablesInitializer implements IStartup {
@Override
public void earlyStartup() {
// On Windows, initialize the "Git Bash" custom "Show In" menu entry
- if (Host.isWindowsHost()) {
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
String gitPath = null;
String iconPath = null;
@@ -59,12 +59,12 @@ public class ExternalExecutablesInitializer implements IStartup {
if (gitPath != null) {
// Load the configured external executables
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
- if (l == null) l = new ArrayList<Map<String, Object>>();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
+ if (l == null) l = new ArrayList<Map<String, String>>();
// Find a entry labeled "Git Bash"
- Map<String, Object> m = null;
- for (Map<String, Object> candidate : l) {
- String name = (String) candidate.get(IExternalExecutablesProperties.PROP_NAME);
+ Map<String, String> m = null;
+ for (Map<String, String> candidate : l) {
+ String name = candidate.get(IExternalExecutablesProperties.PROP_NAME);
if ("Git Bash".equals(name)) { //$NON-NLS-1$
m = candidate;
break;
@@ -72,7 +72,7 @@ public class ExternalExecutablesInitializer implements IStartup {
}
if (m == null) {
- m = new HashMap<String, Object>();
+ m = new HashMap<String, String>();
m.put(IExternalExecutablesProperties.PROP_NAME, "Git Bash"); //$NON-NLS-1$
m.put(IExternalExecutablesProperties.PROP_PATH, gitPath);
m.put(IExternalExecutablesProperties.PROP_ARGS, "--login -i"); //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
index 477d8b914..5178be44c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014, 2015 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -12,8 +12,13 @@ package org.eclipse.tcf.te.ui.terminals.local.showin;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
@@ -22,9 +27,6 @@ import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
/**
* External executables manager implementation.
*/
@@ -35,16 +37,45 @@ public class ExternalExecutablesManager {
*
* @return The list of all saved external executables or <code>null</code>.
*/
- public static List<Map<String, Object>> load() {
- List<Map<String, Object>> l = null;
+ public static List<Map<String, String>> load() {
+ List<Map<String, String>> l = new ArrayList<Map<String, String>>();
IPath stateLocation = UIPlugin.getDefault().getStateLocation();
if (stateLocation != null) {
- File f = stateLocation.append(".executables/data.json").toFile(); //$NON-NLS-1$
+ File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$
if (f.canRead()) {
try {
- Gson g = new GsonBuilder().create();
- l = g.fromJson(new FileReader(f), List.class);
+ Properties data = new Properties();
+ data.load(new FileReader(f));
+
+ Map<Integer, Map<String, String>> c = new HashMap<Integer, Map<String, String>>();
+ for (String name : data.stringPropertyNames()) {
+ if (name == null || name.indexOf('.') == -1) continue;
+ int ix = name.indexOf('.');
+ String n = name.substring(0, ix);
+ String k = (ix + 1) < name.length() ? name.substring(ix + 1) : null;
+ if (n == null || k == null) continue;
+
+ Integer i = null;
+ try { i = Integer.decode(n); } catch (NumberFormatException e) { /* ignored on purpose */ }
+ if (i == null) continue;
+
+ Map<String, String> m = c.get(i);
+ if (m == null) {
+ m = new HashMap<String, String>();
+ c.put(i, m);
+ }
+ Assert.isNotNull(m);
+
+ m.put(k, data.getProperty(name));
+ }
+
+ List<Integer> k = new ArrayList<Integer>(c.keySet());
+ Collections.sort(k);
+ for (Integer i : k) {
+ Map<String, String> m = c.get(i);
+ if (m != null && !m.isEmpty()) l.add(m);
+ }
} catch (Exception e) {
if (Platform.inDebugMode()) {
e.printStackTrace();
@@ -61,23 +92,31 @@ public class ExternalExecutablesManager {
*
* @param l The list of external executables or <code>null</code>.
*/
- public static void save(List<Map<String, Object>> l) {
+ public static void save(List<Map<String, String>> l) {
IPath stateLocation = UIPlugin.getDefault().getStateLocation();
if (stateLocation != null) {
- File f = stateLocation.append(".executables/data.json").toFile(); //$NON-NLS-1$
+ File f = stateLocation.append(".executables/data.properties").toFile(); //$NON-NLS-1$
if (f.isFile() && (l == null || l.isEmpty())) {
@SuppressWarnings("unused")
boolean s = f.delete();
} else {
try {
- Gson g = new GsonBuilder().setPrettyPrinting().create();
+ Properties data = new Properties();
+ for (int i = 0; i < l.size(); i++) {
+ Map<String, String> m = l.get(i);
+ for (Entry<String, String> e : m.entrySet()) {
+ String key = Integer.toString(i) + "." + e.getKey(); //$NON-NLS-1$
+ data.setProperty(key, e.getValue());
+ }
+ }
+
if (!f.exists()) {
@SuppressWarnings("unused")
boolean s = f.getParentFile().mkdirs();
s = f.createNewFile();
}
FileWriter w = new FileWriter(f);
- g.toJson(l, w);
+ data.store(w, null);
w.flush();
w.close();
} catch (Exception e) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
index bc4e2f0d8..9b4470a86 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
@@ -18,11 +18,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -39,6 +41,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.layout.GridData;
@@ -52,8 +55,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
-import org.eclipse.tcf.te.ui.swt.widgets.NoteCompositeHelper;
+import org.eclipse.tcf.te.ui.terminals.controls.NoteCompositeHelper;
import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.local.nls.Messages;
import org.eclipse.tcf.te.ui.terminals.local.showin.ExternalExecutablesDialog;
@@ -62,6 +64,7 @@ import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IExternalExecutab
import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.osgi.framework.Bundle;
/**
* Terminals top preference page implementation.
@@ -74,7 +77,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
/* default */ Combo workingDir;
private Button browseButton;
- /* default */ final List<Map<String, Object>> executables = new ArrayList<Map<String, Object>>();
+ /* default */ final List<Map<String, String>> executables = new ArrayList<Map<String, String>>();
/* default */ final Map<String, Image> images = new HashMap<String, Image>();
/* default */ static final Object[] NO_ELEMENTS = new Object[0];
@@ -91,6 +94,9 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
*/
@Override
protected Control createContents(final Composite parent) {
+ final GC gc = new GC(parent);
+ gc.setFont(JFaceResources.getDialogFont());
+
Composite panel = new Composite(parent, SWT.NONE);
panel.setLayout(new GridLayout());
GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
@@ -106,14 +112,19 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
workingDir = new Combo(group, SWT.DROP_DOWN);
- workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label, Messages.PreferencePage_workingDir_eclipsews_label });
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label, Messages.PreferencePage_workingDir_eclipsews_label });
+ } else {
+ workingDir.setItems(new String[] { Messages.PreferencePage_workingDir_userhome_label, Messages.PreferencePage_workingDir_eclipsehome_label });
+ }
workingDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
workingDir.select(0);
browseButton = new Button(group, SWT.PUSH);
browseButton.setText(Messages.PreferencePage_workingDir_button_browse);
layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
- layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(browseButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
browseButton.setLayoutData(layoutData);
browseButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -137,11 +148,14 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
// ECLIPSE_WORKSPACE
- if (ResourcesPlugin.getWorkspace() != null
- && ResourcesPlugin.getWorkspace().getRoot() != null
- && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- ew = ResourcesPlugin.getWorkspace().getRoot().getLocation();
- }
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
+ ew = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ }
+ }
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.OPEN);
@@ -211,7 +225,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
table.setLayout(tableLayout);
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
- layoutData.heightHint = SWTControlUtil.convertHeightInCharsToPixels(table, 10);
+ layoutData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 10);
table.setLayoutData(layoutData);
Composite buttonsPanel = new Composite(group, SWT.NONE);
@@ -223,7 +237,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
addButton = new Button(buttonsPanel, SWT.PUSH);
addButton.setText(Messages.PreferencePage_executables_button_add_label);
layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
- layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(addButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
addButton.setLayoutData(layoutData);
addButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -231,7 +245,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
ExternalExecutablesDialog dialog = new ExternalExecutablesDialog(PreferencePage.this.getShell(), false);
if (dialog.open() == Window.OK) {
// Get the executable properties and add it to the the list
- Map<String, Object> executableData = dialog.getExecutableData();
+ Map<String, String> executableData = dialog.getExecutableData();
if (executableData != null && !executables.contains(executableData)) {
executables.add(executableData);
viewer.refresh();
@@ -243,7 +257,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
editButton = new Button(buttonsPanel, SWT.PUSH);
editButton.setText(Messages.PreferencePage_executables_button_edit_label);
layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(editButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
editButton.setLayoutData(layoutData);
editButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("unchecked")
@@ -253,11 +267,11 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
if (s instanceof IStructuredSelection && !s.isEmpty()) {
Object element = ((IStructuredSelection)s).getFirstElement();
if (element instanceof Map) {
- final Map<String, Object> m = (Map<String, Object>)element;
+ final Map<String, String> m = (Map<String, String>)element;
ExternalExecutablesDialog dialog = new ExternalExecutablesDialog(PreferencePage.this.getShell(), true);
dialog.setExecutableData(m);
if (dialog.open() == Window.OK) {
- Map<String, Object> executableData = dialog.getExecutableData();
+ Map<String, String> executableData = dialog.getExecutableData();
if (executableData != null) {
m.clear();
m.putAll(executableData);
@@ -272,7 +286,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
removeButton = new Button(buttonsPanel, SWT.PUSH);
removeButton.setText(Messages.PreferencePage_executables_button_remove_label);
layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
- layoutData.widthHint = SWTControlUtil.convertWidthInCharsToPixels(removeButton, 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
removeButton.setLayoutData(layoutData);
removeButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("unchecked")
@@ -376,7 +390,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
});
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
if (l != null) executables.addAll(l);
viewer.setInput(executables);
@@ -390,6 +404,8 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
updateButtons();
+ gc.dispose();
+
return panel;
}
@@ -398,19 +414,19 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
*/
protected void updateButtons() {
if (viewer != null) {
- SWTControlUtil.setEnabled(addButton, true);
+ addButton.setEnabled(true);
ISelection selection = viewer.getSelection();
boolean hasSelection = selection != null && !selection.isEmpty();
int count = selection instanceof IStructuredSelection ? ((IStructuredSelection)selection).size() : 0;
- SWTControlUtil.setEnabled(editButton, hasSelection && count == 1);
- SWTControlUtil.setEnabled(removeButton, hasSelection && count > 0);
+ editButton.setEnabled(hasSelection && count == 1);
+ removeButton.setEnabled(hasSelection && count > 0);
} else {
- SWTControlUtil.setEnabled(addButton, false);
- SWTControlUtil.setEnabled(editButton, false);
- SWTControlUtil.setEnabled(removeButton, false);
+ addButton.setEnabled(false);
+ editButton.setEnabled(false);
+ removeButton.setEnabled(false);
}
}
@@ -431,7 +447,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
executables.clear();
- List<Map<String, Object>> l = ExternalExecutablesManager.load();
+ List<Map<String, String>> l = ExternalExecutablesManager.load();
if (l != null) executables.addAll(l);
viewer.refresh();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java
index b5729bc4e..11d7d9d1b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencesInitializer.java
@@ -10,7 +10,7 @@
package org.eclipse.tcf.te.ui.terminals.local.showin.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.tcf.te.runtime.preferences.ScopedEclipsePreferences;
+import org.eclipse.tcf.te.core.terminals.preferences.ScopedEclipsePreferences;
import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin;
import org.eclipse.tcf.te.ui.terminals.local.showin.interfaces.IPreferenceKeys;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
index 3586e004e..b5350ddf2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java
@@ -15,22 +15,22 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
import org.eclipse.cdt.utils.pty.PTY;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
-import org.eclipse.tcf.te.runtime.services.interfaces.ITerminalServiceOutputStreamMonitorListener;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants;
-import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants;
-import org.eclipse.tcf.te.runtime.utils.Host;
+import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalServiceOutputStreamMonitorListener;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ILineSeparatorConstants;
+import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore;
import org.eclipse.tcf.te.ui.terminals.process.ProcessSettings;
import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType;
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension;
+import org.osgi.framework.Bundle;
/**
* Streams terminal connector type implementation.
@@ -46,7 +46,7 @@ public class LocalConnectorType extends AbstractConnectorType {
*/
private final File defaultShell() {
String shell = null;
- if (Host.isWindowsHost()) {
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
if (System.getenv("ComSpec") != null && !"".equals(System.getenv("ComSpec").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
shell = System.getenv("ComSpec").trim(); //$NON-NLS-1$
} else {
@@ -65,64 +65,64 @@ public class LocalConnectorType extends AbstractConnectorType {
}
/* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer)
+ * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConnectorType#createTerminalConnector(java.util.Map)
*/
@Override
- public ITerminalConnector createTerminalConnector(IPropertiesContainer properties) {
+ public ITerminalConnector createTerminalConnector(Map<String, Object> properties) {
Assert.isNotNull(properties);
// Check for the terminal connector id
- String connectorId = properties.getStringProperty(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
+ String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
if (connectorId == null) connectorId = "org.eclipse.tcf.te.ui.terminals.local.LocalConnector"; //$NON-NLS-1$
// Extract the process properties using defaults
String image;
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_PATH)
- || properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) {
+ || properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH) == null) {
File defaultShell = defaultShell();
image = defaultShell.isAbsolute() ? defaultShell.getAbsolutePath() : defaultShell.getPath();
} else {
- image = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
+ image = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_PATH);
}
// Determine if a PTY will be used
- boolean isUsingPTY = (properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_OBJ) == null && PTY.isSupported(PTY.Mode.TERMINAL))
- || properties.getProperty(ITerminalsConnectorConstants.PROP_PTY_OBJ) instanceof PTY;
+ boolean isUsingPTY = (properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ) == null && PTY.isSupported(PTY.Mode.TERMINAL))
+ || properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ) instanceof PTY;
boolean localEcho = false;
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)
- || properties.getStringProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) == null) {
+ || !(properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO) instanceof Boolean)) {
// On Windows, turn on local echo by default if no PTY is used (bug 433645)
- if (Host.isWindowsHost()) {
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
localEcho = !isUsingPTY;
}
} else {
- localEcho = properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_LOCAL_ECHO);
+ localEcho = ((Boolean)properties.get(ITerminalsConnectorConstants.PROP_LOCAL_ECHO)).booleanValue();
}
String lineSeparator = null;
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR)
- || properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) == null) {
+ || !(properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR) instanceof String)) {
// No line separator will be set if a PTY is used
if (!isUsingPTY) {
- lineSeparator = Host.isWindowsHost() ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF;
+ lineSeparator = Platform.OS_WIN32.equals(Platform.getOS()) ? ILineSeparatorConstants.LINE_SEPARATOR_CRLF : ILineSeparatorConstants.LINE_SEPARATOR_LF;
}
} else {
- lineSeparator = properties.getStringProperty(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
+ lineSeparator = (String)properties.get(ITerminalsConnectorConstants.PROP_LINE_SEPARATOR);
}
- String arguments = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
- Process process = (Process)properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
- PTY pty = (PTY)properties.getProperty(ITerminalsConnectorConstants.PROP_PTY_OBJ);
- ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
- ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.getProperty(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
- String workingDir = properties.getStringProperty(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
+ String arguments = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ARGS);
+ Process process = (Process)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_OBJ);
+ PTY pty = (PTY)properties.get(ITerminalsConnectorConstants.PROP_PTY_OBJ);
+ ITerminalServiceOutputStreamMonitorListener[] stdoutListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDOUT_LISTENERS);
+ ITerminalServiceOutputStreamMonitorListener[] stderrListeners = (ITerminalServiceOutputStreamMonitorListener[])properties.get(ITerminalsConnectorConstants.PROP_STDERR_LISTENERS);
+ String workingDir = (String)properties.get(ITerminalsConnectorConstants.PROP_PROCESS_WORKING_DIR);
String[] envp = null;
if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) &&
- properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
- properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
- envp = (String[])properties.getProperty(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT);
+ properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) != null &&
+ properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT) instanceof String[]){
+ envp = (String[])properties.get(ITerminalsConnectorConstants.PROP_PROCESS_ENVIRONMENT);
}
// Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables
@@ -140,11 +140,14 @@ public class LocalConnectorType extends AbstractConnectorType {
}
// ECLIPSE_WORKSPACE
- if (ResourcesPlugin.getWorkspace() != null
- && ResourcesPlugin.getWorkspace().getRoot() != null
- && ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
- envpList.add("ECLIPSE_WORKSPACE=" + ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$
- }
+ Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
+ if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot() != null
+ && org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation() != null) {
+ envpList.add("ECLIPSE_WORKSPACE=" + org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); //$NON-NLS-1$
+ }
+ }
// Convert back into a string array
envp = envpList.toArray(new String[envpList.size()]);
@@ -168,7 +171,8 @@ public class LocalConnectorType extends AbstractConnectorType {
processSettings.setEnvironment(envp);
if (properties.containsKey(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT)) {
- processSettings.setMergeWithNativeEnvironment(properties.getBooleanProperty(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT));
+ Object value = properties.get(ITerminalsConnectorConstants.PROP_PROCESS_MERGE_ENVIRONMENT);
+ processSettings.setMergeWithNativeEnvironment(value instanceof Boolean ? ((Boolean)value).booleanValue() : false);
}
// And save the settings to the store

Back to the top