aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2012-10-15 11:35:41 (EDT)
committerMike Rennie2012-10-15 11:35:41 (EDT)
commit89edba14ccd0fda0b97d6c20625276bae34c786a (patch)
treefefd76f00daf4dc16537028739e8139e9cf70997
parente38de2f54fe88bc617776385822419d76ca29021 (diff)
downloadeclipse.platform-89edba14ccd0fda0b97d6c20625276bae34c786a.zip
eclipse.platform-89edba14ccd0fda0b97d6c20625276bae34c786a.tar.gz
eclipse.platform-89edba14ccd0fda0b97d6c20625276bae34c786a.tar.bz2
Bug 389755 - Set SWT.COLOR_INFO_FOREGROUNDv20121015-153541I20121016-2240I20121016-0800
-rw-r--r--ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntClasspathLabelProvider.java29
-rw-r--r--ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntObjectLabelProvider.java22
2 files changed, 36 insertions, 15 deletions
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntClasspathLabelProvider.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntClasspathLabelProvider.java
index bb4f665..84aeb9f 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntClasspathLabelProvider.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntClasspathLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation 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
@@ -99,14 +99,9 @@ public class AntClasspathLabelProvider implements ILabelProvider, IColorProvider
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
*/
public Color getBackground(Object element) {
- if (element instanceof GlobalClasspathEntries) {
- int type= ((GlobalClasspathEntries) element).getType();
- if (type == ClasspathModel.CONTRIBUTED) {
- Display display= Display.getCurrent();
- return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
- }
- } else if (element instanceof ClasspathEntry) {
- return getBackground(((ClasspathEntry) element).getParent());
+ if (isUnmodifiable(element)) {
+ Display display= Display.getCurrent();
+ return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
}
return null;
}
@@ -115,9 +110,25 @@ public class AntClasspathLabelProvider implements ILabelProvider, IColorProvider
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
*/
public Color getForeground(Object element) {
+ if (isUnmodifiable(element)) {
+ Display display= Display.getCurrent();
+ return display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ }
return null;
}
+ private boolean isUnmodifiable(Object element) {
+ if (element instanceof GlobalClasspathEntries) {
+ int type= ((GlobalClasspathEntries) element).getType();
+ if (type == ClasspathModel.CONTRIBUTED) {
+ return true;
+ }
+ } else if (element instanceof ClasspathEntry) {
+ return isUnmodifiable(((ClasspathEntry) element).getParent());
+ }
+ return false;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
diff --git a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntObjectLabelProvider.java b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntObjectLabelProvider.java
index 5d7c070..6e3b49c 100644
--- a/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntObjectLabelProvider.java
+++ b/ant/org.eclipse.ant.ui/Ant Tools Support/org/eclipse/ant/internal/ui/preferences/AntObjectLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation 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
@@ -118,6 +118,10 @@ public class AntObjectLabelProvider extends LabelProvider implements ITableLabel
* @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
*/
public Color getForeground(Object element) {
+ if (isUnmodifiable(element)) {
+ Display display= Display.getCurrent();
+ return display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ }
return null;
}
@@ -125,17 +129,23 @@ public class AntObjectLabelProvider extends LabelProvider implements ITableLabel
* @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
*/
public Color getBackground(Object element) {
+ if (isUnmodifiable(element)) {
+ Display display= Display.getCurrent();
+ return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ }
+ return null;
+ }
+
+ private boolean isUnmodifiable(Object element) {
if (element instanceof AntObject) {
if (((AntObject) element).isDefault()) {
- Display display= Display.getCurrent();
- return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ return true;
}
} else if (element instanceof Property) {
if (((Property) element).isDefault()) {
- Display display= Display.getCurrent();
- return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ return true;
}
}
- return null;
+ return false;
}
} \ No newline at end of file