Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2015-02-18 08:08:16 -0500
committerUwe Stieber2015-02-18 08:08:34 -0500
commit1f5377c773b8f6d7e214667ae2d41b597d216b03 (patch)
tree837b6e76dce65213aefe3d202923ac56b2d774ce
parenta6fee71299ed5c8b8099ffda96bb2fe6ffb72991 (diff)
downloadorg.eclipse.tcf-1f5377c773b8f6d7e214667ae2d41b597d216b03.tar.gz
org.eclipse.tcf-1f5377c773b8f6d7e214667ae2d41b597d216b03.tar.xz
org.eclipse.tcf-1f5377c773b8f6d7e214667ae2d41b597d216b03.zip
Terminals: Allow the use of Eclipse variables to specify the initial
local terminal working directory within the Terminals View preferences
-rw-r--r--terminals/features/org.eclipse.tcf.te.terminals.feature/feature.xml1
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF2
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java4
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java25
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java1
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties5
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java4
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java106
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java2
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java2
-rw-r--r--terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java2
11 files changed, 128 insertions, 26 deletions
diff --git a/terminals/features/org.eclipse.tcf.te.terminals.feature/feature.xml b/terminals/features/org.eclipse.tcf.te.terminals.feature/feature.xml
index 3da816208..50fdbd81e 100644
--- a/terminals/features/org.eclipse.tcf.te.terminals.feature/feature.xml
+++ b/terminals/features/org.eclipse.tcf.te.terminals.feature/feature.xml
@@ -41,6 +41,7 @@
<import feature="org.eclipse.tm.terminal.serial" version="2.1.300" match="greaterOrEqual"/>
<import feature="org.eclipse.tm.terminal.ssh" version="2.1.300" match="greaterOrEqual"/>
<import feature="org.eclipse.tm.terminal.telnet" version="2.1.300" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.core.variables" version="3.2.800" match="greaterOrEqual"/>
</requires>
<plugin
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
index a389bc2fc..0fc626826 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF
@@ -10,6 +10,8 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6";resolution:=optional,
org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.core.resources;bundle-version="3.8.1";resolution:=optional,
org.eclipse.core.runtime;bundle-version="3.8.0",
+ org.eclipse.core.variables;bundle-version="3.2.800",
+ org.eclipse.debug.ui;bundle-version="3.8.1";resolution:=optional,
org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0",
org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0",
org.eclipse.tcf.te.ui.terminals.process;bundle-version="1.3.0",
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
index 37b0b12b2..9e13f0d43 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/controls/LocalWizardConfigurationPanel.java
@@ -77,7 +77,7 @@ public class LocalWizardConfigurationPanel extends AbstractExtendedConfiguration
label.setLayoutData(layoutData);
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
resource = getSelectionResource();
}
@@ -107,7 +107,7 @@ public class LocalWizardConfigurationPanel extends AbstractExtendedConfiguration
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 (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
// 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();
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
index 10222e316..533be9359 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/launcher/LocalLauncherDelegate.java
@@ -22,11 +22,14 @@ import java.util.Map;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
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.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory;
@@ -125,7 +128,7 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
}
} else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
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) {
@@ -133,9 +136,19 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
}
}
} else {
- IPath p = new Path(initialCwd);
- if (p.toFile().canRead() && p.toFile().isDirectory()) {
- cwd = p.toOSString();
+ try {
+ // Resolve possible dynamic variables
+ IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
+ String resolved = vm.performStringSubstitution(initialCwd);
+
+ IPath p = new Path(resolved);
+ if (p.toFile().canRead() && p.toFile().isDirectory()) {
+ cwd = p.toOSString();
+ }
+ } catch (CoreException ex) {
+ if (Platform.inDebugMode()) {
+ UIPlugin.getDefault().getLog().log(ex.getStatus());
+ }
}
}
@@ -156,7 +169,7 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
Object element = iter.next();
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
// 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;
@@ -331,7 +344,7 @@ public class LocalLauncherDelegate extends AbstractLauncherDelegate {
// ECLIPSE_WORKSPACE
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
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) {
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
index 5052f96cf..515c37d6a 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.java
@@ -45,6 +45,7 @@ public class Messages extends NLS {
public static String PreferencePage_workingDir_button_browse;
public static String PreferencePage_workingDir_note_label;
public static String PreferencePage_workingDir_note_text;
+ public static String PreferencePage_workingDir_button_variables;
public static String ExternalExecutablesDialog_title_add;
public static String ExternalExecutablesDialog_title_edit;
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
index accf1b47f..aa446624e 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/nls/Messages.properties
@@ -33,6 +33,7 @@ PreferencePage_workingDir_label=Local Terminal Initial Working Directory
PreferencePage_workingDir_userhome_label=User home
PreferencePage_workingDir_eclipsehome_label=Eclipse home
PreferencePage_workingDir_eclipsews_label=Eclipse workspace
-PreferencePage_workingDir_button_browse=Browse...
+PreferencePage_workingDir_button_browse=&Browse...
PreferencePage_workingDir_note_label=Note:
-PreferencePage_workingDir_note_text=The chosen initial working directory might be overwritten by the current selection of the active view.
+PreferencePage_workingDir_note_text=The chosen initial working directory might be overwritten by the current selection of the active view.
+PreferencePage_workingDir_button_variables=&Variables...
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
index 99aa5b100..44e57c562 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/ExternalExecutablesDialog.java
@@ -194,7 +194,7 @@ public class ExternalExecutablesDialog extends TrayDialog {
} 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)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
}
@@ -274,7 +274,7 @@ public class ExternalExecutablesDialog extends TrayDialog {
} 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)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
workspace = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
}
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
index 9b4470a86..8a3e9d140 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/showin/preferences/PreferencePage.java
@@ -18,10 +18,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.runtime.CoreException;
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.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
@@ -39,6 +42,8 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
@@ -77,6 +82,9 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
/* default */ Combo workingDir;
private Button browseButton;
+ private Button variablesButton;
+ private boolean hasVariablesButton = false;
+
/* default */ final List<Map<String, String>> executables = new ArrayList<Map<String, String>>();
/* default */ final Map<String, Image> images = new HashMap<String, Image>();
@@ -87,6 +95,10 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
*/
@Override
public void init(IWorkbench workbench) {
+ Bundle bundle = Platform.getBundle("org.eclipse.debug.ui"); //$NON-NLS-1$
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
+ hasVariablesButton = true;
+ }
}
/* (non-Javadoc)
@@ -108,23 +120,51 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
Group group = new Group(panel, SWT.NONE);
group.setText(Messages.PreferencePage_workingDir_label);
- group.setLayout(new GridLayout(2, false));
+ group.setLayout(new GridLayout(hasVariablesButton ? 3 : 2, false));
group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
workingDir = new Combo(group, SWT.DROP_DOWN);
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
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);
+ workingDir.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ boolean valid = true;
+ String message = null;
+
+ String text = workingDir.getText();
+ if (text != null && !"".equals(text.trim()) //$NON-NLS-1$
+ && !Messages.PreferencePage_workingDir_userhome_label.equals(text)
+ && !Messages.PreferencePage_workingDir_eclipsehome_label.equals(text)
+ && !Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) {
+ try {
+ // Resolve possible dynamic variables
+ IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
+ String resolved = vm.performStringSubstitution(text.trim());
+
+ IPath p = new Path(resolved);
+ valid = p.toFile().canRead() && p.toFile().isDirectory();
+ } catch (CoreException ex) {
+ valid = false;
+ message = ex.getLocalizedMessage();
+ }
+ }
+
+ setValid(valid);
+ setErrorMessage(message);
+ }
+ });
browseButton = new Button(group, SWT.PUSH);
browseButton.setText(Messages.PreferencePage_workingDir_button_browse);
layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
- layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 10);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 14);
browseButton.setLayoutData(layoutData);
browseButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -149,7 +189,7 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
// ECLIPSE_WORKSPACE
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
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) {
@@ -168,7 +208,16 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
} else if (Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) {
dialog.setFilterPath(ew.toOSString());
} else if (text != null && !"".equals(text.trim())) { //$NON-NLS-1$
- dialog.setFilterPath(text.trim());
+ try {
+ // Resolve possible dynamic variables
+ IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
+ String resolved = vm.performStringSubstitution(text.trim());
+ dialog.setFilterPath(resolved);
+ } catch (CoreException ex) {
+ if (Platform.inDebugMode()) {
+ UIPlugin.getDefault().getLog().log(ex.getStatus());
+ }
+ }
}
String selected = dialog.open();
@@ -188,12 +237,37 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
}
});
+ if (hasVariablesButton) {
+ variablesButton = new Button(group, SWT.PUSH);
+ variablesButton.setText(Messages.PreferencePage_workingDir_button_variables);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ layoutData.widthHint = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), 14);
+ variablesButton.setLayoutData(layoutData);
+ variablesButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ org.eclipse.debug.ui.StringVariableSelectionDialog dialog = new org.eclipse.debug.ui.StringVariableSelectionDialog(getShell());
+ dialog.open();
+ String expression = dialog.getVariableExpression();
+ if (expression != null) {
+ if ("${eclipse_home}".equals(expression)) { //$NON-NLS-1$
+ workingDir.select(1);
+ } else if ("${workspace_loc}".equals(expression)) { //$NON-NLS-1$
+ workingDir.select(2);
+ } else {
+ workingDir.setText(expression);
+ }
+ }
+ }
+ });
+ }
+
String initialCwd = UIPlugin.getScopedPreferences().getString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD);
if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$
workingDir.select(0);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) {
+ } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd) || "${eclipse_home}".equals(initialCwd)) { //$NON-NLS-1$
workingDir.select(1);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
+ } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd) || "${workspace_loc}".equals(initialCwd)) { //$NON-NLS-1$
workingDir.select(2);
} else {
workingDir.setText(new Path(initialCwd).toOSString());
@@ -438,9 +512,9 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
String initialCwd = UIPlugin.getScopedPreferences().getDefaultString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD);
if (initialCwd == null || IPreferenceKeys.PREF_INITIAL_CWD_USER_HOME.equals(initialCwd) || "".equals(initialCwd.trim())) { //$NON-NLS-1$
workingDir.select(0);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd)) {
+ } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_HOME.equals(initialCwd) || "${eclipse_home}".equals(initialCwd)) { //$NON-NLS-1$
workingDir.select(1);
- } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd)) {
+ } else if (IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS.equals(initialCwd) || "${workspace_loc}".equals(initialCwd)) { //$NON-NLS-1$
workingDir.select(2);
} else {
workingDir.setText(new Path(initialCwd).toOSString());
@@ -467,8 +541,18 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
} else if (Messages.PreferencePage_workingDir_eclipsews_label.equals(text)) {
UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, IPreferenceKeys.PREF_INITIAL_CWD_ECLIPSE_WS);
} else {
- IPath p = new Path(text.trim());
- UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, p.toFile().canRead() && p.toFile().isDirectory() ? p.toString() : null);
+ try {
+ // Resolve possible dynamic variables
+ IStringVariableManager vm = VariablesPlugin.getDefault().getStringVariableManager();
+ String resolved = vm.performStringSubstitution(text.trim());
+
+ IPath p = new Path(resolved);
+ UIPlugin.getScopedPreferences().putString(IPreferenceKeys.PREF_LOCAL_TERMINAL_INITIAL_CWD, p.toFile().canRead() && p.toFile().isDirectory() ? text.trim() : null);
+ } catch (CoreException e) {
+ if (Platform.inDebugMode()) {
+ UIPlugin.getDefault().getLog().log(e.getStatus());
+ }
+ }
}
ExternalExecutablesManager.save(executables);
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java
index 150f6c6cb..ab4d292ee 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.process/src/org/eclipse/tcf/te/ui/terminals/process/ProcessSettingsPage.java
@@ -149,7 +149,7 @@ public class ProcessSettingsPage extends AbstractSettingsPage {
}
} else {
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
dialog.setFilterPath(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
}
}
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java
index 63cd09311..6277dc6c3 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/panels/AbstractExtendedConfigurationPanel.java
@@ -562,7 +562,7 @@ public abstract class AbstractExtendedConfigurationPanel extends AbstractConfigu
private String getResourceEncoding() {
String preference = null;
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
preference = org.eclipse.core.resources.ResourcesPlugin.getPlugin().getPluginPreferences().getString(org.eclipse.core.resources.ResourcesPlugin.PREF_ENCODING);
}
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
index 4120959fd..86e750a82 100644
--- a/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
+++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/view/TerminalsView.java
@@ -662,7 +662,7 @@ public class TerminalsView extends ViewPart implements ITerminalsView, IShowInTa
Object adapted = null;
Bundle bundle = Platform.getBundle("org.eclipse.core.resources"); //$NON-NLS-1$
- if (bundle != null && (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.ACTIVE)) {
+ if (bundle != null && bundle.getState() != Bundle.UNINSTALLED && bundle.getState() != Bundle.STOPPING) {
if (element instanceof org.eclipse.core.resources.IResource) continue;
adapted = element instanceof IAdaptable ? ((IAdaptable)element).getAdapter(org.eclipse.core.resources.IResource.class) : null;

Back to the top