Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-09-18 08:02:00 -0400
committerUwe Stieber2013-09-18 08:06:12 -0400
commit473797305d4243ba76c3921a9a214d7c34b47ff9 (patch)
treeca7cb8d0412cad60a779f7e47a758499e30a715d
parent6ed2614942c85108b84f0a1daf655d2766e32caa (diff)
downloadorg.eclipse.tcf-473797305d4243ba76c3921a9a214d7c34b47ff9.tar.gz
org.eclipse.tcf-473797305d4243ba76c3921a9a214d7c34b47ff9.tar.xz
org.eclipse.tcf-473797305d4243ba76c3921a9a214d7c34b47ff9.zip
Target Explorer: Bind active connection status bar trim control to a hidden preference or system property. Use gray font and set tooltip.
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/properties/PropertyTester.java22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties3
8 files changed, 60 insertions, 3 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml
index df6d06214..54947d312 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml
@@ -18,7 +18,7 @@
class="org.eclipse.tcf.te.core.properties.PropertyTester"
id="org.eclipse.tcf.te.core.properties.PropertyTester"
namespace="org.eclipse.tcf.te.core"
- properties="hasAdapter,canAdaptTo,hasEnvVar"
+ properties="hasAdapter,canAdaptTo,hasEnvVar,envVar"
type="java.lang.Object">
</propertyTester>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/properties/PropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/properties/PropertyTester.java
index 42c4e97db..bc19b2a24 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/properties/PropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/properties/PropertyTester.java
@@ -77,6 +77,28 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
return hasEnvVar == ((Boolean)expectedValue).booleanValue();
}
+ // "envVar" tests for the value of a system property or environment variable
+ // with the name passed in via the arguments.
+ if ("envVar".equals(property)) { //$NON-NLS-1$
+ String value = null;
+
+ String name = null;
+ for (Object arg : args) {
+ if (arg instanceof String) {
+ name = (String)arg;
+ break;
+ }
+ }
+
+ if (name != null) {
+ value = System.getProperty(name);
+ if (value == null) value = System.getenv(name);
+ }
+
+ // Always check against the string value
+ return value != null ? expectedValue.toString().equals(value) : false;
+ }
+
return false;
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
index bdd1b5716..0ffd45565 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml
@@ -460,6 +460,20 @@
<control
class="org.eclipse.tcf.te.tcf.ui.controls.ActiveConnectionStatusTrimControl"
id="org.eclipse.tcf.te.tcf.ui.trim.status.ActiveConnectionStatusTrimControl">
+ <visibleWhen checkEnabled="false">
+ <or>
+ <test
+ property="org.eclipse.tcf.te.runtime.preference"
+ args="bundleId=org.eclipse.tcf.te.tcf.ui,key=te.tcf.ui.feature.statusbar.trim.activeconnection.enable"
+ value="true">
+ </test>
+ <test
+ property="org.eclipse.tcf.te.core.hasEnvVar"
+ args="trim.activeconnection.enable"
+ value="true">
+ </test>
+ </or>
+ </visibleWhen>
</control>
</toolbar>
</menuContribution>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java
index 5a020d44d..111e299da 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/controls/ActiveConnectionStatusTrimControl.java
@@ -26,6 +26,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.ISelectionService;
import org.eclipse.tcf.te.tcf.ui.nls.Messages;
import org.eclipse.tcf.te.ui.swt.SWTControlUtil;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
/**
@@ -37,7 +38,7 @@ public class ActiveConnectionStatusTrimControl extends WorkbenchWindowControlCon
/* (non-Javadoc)
* @see org.eclipse.jface.action.ControlContribution#createControl(org.eclipse.swt.widgets.Composite)
*/
- @Override
+ @Override
protected Control createControl(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
@@ -46,6 +47,8 @@ public class ActiveConnectionStatusTrimControl extends WorkbenchWindowControlCon
text = new Text(panel, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ text.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ text.setToolTipText(Messages.ActiveConnectionStatusTrimControl_tooltip);
String selected = ""; //$NON-NLS-1$
@@ -91,6 +94,15 @@ public class ActiveConnectionStatusTrimControl extends WorkbenchWindowControlCon
}
SWTControlUtil.setText(text, selected);
+ getParent().update(true);
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.ContributionItem#isDynamic()
+ */
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java
index ea12e0c95..6bb9094f5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/IPreferenceKeys.java
@@ -32,4 +32,9 @@ public interface IPreferenceKeys {
* Preference key to access the flag to activate the current user filter on first launch.
*/
public static final String PREF_ACTIVATE_CURRENT_USER_FILTER = PREFIX + "model.currentUserFilter.activate"; //$NON-NLS-1$
+
+ /**
+ * Preference key to access the flag to enable the active connection status bar trim area.
+ */
+ public static final String PREF_ACTIVE_CONNECTION_TRIM_AREA_ENABLE = PREFIX + "feature.statusbar.trim.activeconnection.enable"; //$NON-NLS-1$
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java
index a14357ec3..df410dc86 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/internal/preferences/PreferencesInitializer.java
@@ -37,5 +37,7 @@ public class PreferencesInitializer extends AbstractPreferenceInitializer {
store.setDefault(IPreferenceKeys.PREF_HIDE_VALUEADDS, true);
// [Hidden] Activate current user filter: default off
store.setDefault(IPreferenceKeys.PREF_ACTIVATE_CURRENT_USER_FILTER, false);
+ // [Hidden] Enable active connection status bar trim area: default off
+ store.setDefault(IPreferenceKeys.PREF_ACTIVE_CONNECTION_TRIM_AREA_ENABLE, false);
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
index 4bf693963..7561219f7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.java
@@ -241,4 +241,5 @@ public class Messages extends NLS {
public static String PeerImportWizardPage_overwriteDialogToggle_message;
public static String ActiveConnectionStatusTrimControl_label;
+ public static String ActiveConnectionStatusTrimControl_tooltip;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
index 9b831c3ed..7178b5bd6 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/nls/Messages.properties
@@ -199,5 +199,6 @@ PeerImportWizardPage_overwrite_button=Overwrite existing configuration(s) withou
PeerImportWizardPage_overwriteDialog_message=The configuration ''{0}'' already exists. Do you want to overwrite it?
PeerImportWizardPage_overwriteDialogToggle_message=Remember my decision
-ActiveConnectionStatusTrimControl_label=Active Connection: {0}
+ActiveConnectionStatusTrimControl_label={0}
+ActiveConnectionStatusTrimControl_tooltip=Most recently used connection

Back to the top