Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Torregrosa Paez2015-07-06 13:20:47 +0000
committerPablo Torregrosa Paez2015-07-07 10:13:55 +0000
commit1c9bd712bfbabca1d1541a6561972e12c665742a (patch)
tree9b44b4799da300b309112e0382e7af2f6d4500f8 /target_explorer
parentafac4a300ca88490c856b34043cac9aeeec9e95f (diff)
downloadorg.eclipse.tcf-1c9bd712bfbabca1d1541a6561972e12c665742a.tar.gz
org.eclipse.tcf-1c9bd712bfbabca1d1541a6561972e12c665742a.tar.xz
org.eclipse.tcf-1c9bd712bfbabca1d1541a6561972e12c665742a.zip
Target Explorer: Changed fixedwidth font to Eclipse Console default.
Change-Id: I5f45d658ffe12d803e172fd8559a92b0a9ce2ee2 Signed-off-by: Pablo Torregrosa Paez <pablo.torregrosa@windriver.com>
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.xml8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java66
3 files changed, 66 insertions, 10 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
index 55923c21d..4f118cf5d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/plugin.properties
@@ -106,3 +106,5 @@ command.historyLast.label=Execute Last Action
command.historyLast.mnemonic=x
toolbar.label=System Management
+matchColors.toolbarWarningBackground.label=Connection Toolbar Warning Background
+matchColors.toolbarWarningBackground.description=The color used to render the background of the connection dropdown in a warning status. \ No newline at end of file
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 b21d74fd1..4cdb7fda5 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
@@ -1180,5 +1180,13 @@
<hiddenMenuItem id="org.eclipse.tcf.te.tcf.ui.main.menu.system"/>
</perspectiveExtension>
</extension>
+
+<!-- Themes contributions -->
+ <extension point="org.eclipse.ui.themes">
+ <themeElementCategory label="%toolbar.label" id="org.eclipse.ui.themes.presentation" />
+ <colorDefinition label="%matchColors.toolbarWarningBackground.label" categoryId="org.eclipse.ui.themes.presentation" value="255,250,150" id="org.eclipse.ui.themes.matchColors.toolbarWarningBackground">
+ <description>%matchColors.toolbarWarningBackground.description</description>
+ </colorDefinition>
+ </extension>
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
index cbc9b2a6f..5ed795d0c 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.ui/src/org/eclipse/tcf/te/tcf/ui/handler/DefaultContextSelectorToolbarContribution.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
@@ -24,6 +24,9 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
@@ -76,7 +79,9 @@ import org.eclipse.ui.services.IServiceLocator;
* Configurations control implementation.
*/
public class DefaultContextSelectorToolbarContribution extends WorkbenchWindowControlContribution
-implements IWorkbenchContribution, IEventListener, IPeerModelListener {
+implements IWorkbenchContribution, IEventListener, IPeerModelListener, IPropertyChangeListener {
+
+ private static final String WARNING_BACKGROUND_FG_COLOR_NAME = "org.eclipse.ui.themes.matchColors.toolbarWarningBackground"; //$NON-NLS-1$
private Composite panel = null;
private Composite labelPanel = null;
@@ -93,12 +98,16 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
private final RGB lightYellowRgb = new RGB(255, 250, 150); // Warning background color
/* default */ Color lightYellowColor = null;
+ private enum PanelStyle {DEFAULT,WARNING} // Color styles
+ /* default */ Color warningBackgroundColor = null;
/**
* Constructor.
*/
public DefaultContextSelectorToolbarContribution() {
this("org.eclipse.tcf.te.tcf.ui.DefaultContextSelectorToolbarContribution"); //$NON-NLS-1$
+ PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
+ JFaceResources.getColorRegistry().addListener(this);
}
/**
@@ -108,6 +117,8 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
*/
public DefaultContextSelectorToolbarContribution(String id) {
super(id);
+ PlatformUI.getPreferenceStore().addPropertyChangeListener(this);
+ JFaceResources.getColorRegistry().addListener(this);
}
/* (non-Javadoc)
@@ -139,6 +150,8 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
}
});
+ initThemeColors();
+
labelPanel = new Composite(panel, SWT.BORDER);
labelPanel.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_WHITE));
GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
@@ -203,6 +216,15 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
return panel;
}
+ private void initThemeColors() {
+ // Get colors from Theme preferences
+ warningBackgroundColor = JFaceResources.getColorRegistry().get(WARNING_BACKGROUND_FG_COLOR_NAME);
+ if (warningBackgroundColor == null) {
+ JFaceResources.getColorRegistry().put(WARNING_BACKGROUND_FG_COLOR_NAME, lightYellowRgb);
+ warningBackgroundColor = JFaceResources.getColorRegistry().get(WARNING_BACKGROUND_FG_COLOR_NAME);
+ }
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.action.ContributionItem#dispose()
*/
@@ -261,6 +283,7 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
return;
}
}
+ changePanelStyle(PanelStyle.DEFAULT);
if (peerNode != null) {
DelegatingLabelProvider labelProvider = new DelegatingLabelProvider();
@@ -287,8 +310,7 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
else if (peerNode.getConnectState() == IConnectable.STATE_CONNECTED) {
Map<String,String> warnings = CommonUtils.getPeerWarnings(peerNode);
if (warnings != null && !warnings.isEmpty()) {
- // Change background color to the warning color
- labelPanel.setBackground(lightYellowColor);
+ changePanelStyle(PanelStyle.WARNING);
tooltip = !fullName.equals(name) ? fullName : ""; //$NON-NLS-1$
for (String warning : warnings.values()) {
@@ -298,12 +320,11 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
tooltip += warning;
}
}
- else {
- labelPanel.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_WHITE));
- }
}
- else {
- labelPanel.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ else if (peerNode.getConnectState() == IConnectable.STATE_CONNECTION_LOST ||
+ peerNode.getConnectState() == IConnectable.STATE_CONNECTION_RECOVERING ||
+ peerNode.getConnectState() == IConnectable.STATE_UNKNOWN) {
+ changePanelStyle(PanelStyle.WARNING);
}
image.setToolTipText(tooltip);
@@ -318,11 +339,27 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
image.setToolTipText(Messages.DefaultContextSelectorToolbarContribution_tooltip_new);
text.setToolTipText(Messages.DefaultContextSelectorToolbarContribution_tooltip_new);
button.setToolTipText(Messages.DefaultContextSelectorToolbarContribution_tooltip_new);
+ }
+ }
+ }
+ /**
+ * Switches between themes.
+ * - Default: when there aren't issues with the connection.
+ * - Warning: when there is some kind of warning. The background turns yellow.
+ * @param pStyle
+ */
+ private void changePanelStyle(PanelStyle pStyle) {
+ if (text != null && labelPanel != null) {
+ if (pStyle.equals(PanelStyle.DEFAULT)) {
labelPanel.setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ text.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLACK));
+ } else if (pStyle.equals(PanelStyle.WARNING)) {
+ labelPanel.setBackground(warningBackgroundColor);
+ text.setForeground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_BLACK));
}
}
- }
+ }
protected void onButtonClick() {
if (!clickRunning) {
@@ -482,4 +519,13 @@ implements IWorkbenchContribution, IEventListener, IPeerModelListener {
@Override
public void modelDisposed(IPeerModel model) {
}
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property= event.getProperty();
+ if (property.equals(WARNING_BACKGROUND_FG_COLOR_NAME)) {
+ initThemeColors();
+ update();
+ }
+ }
} \ No newline at end of file

Back to the top