aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Milburn2013-12-19 05:48:30 (EST)
committerDani Megert2013-12-19 05:49:27 (EST)
commit50fe15070d10491b584a27a7fa12f699a30a458d (patch)
tree2b056eb567c0f965774714e1a5acdf149383d6da
parent2994dd2632c7f7cf28e213c928db10586a0d97d7 (diff)
downloadeclipse.platform.ui-50fe15070d10491b584a27a7fa12f699a30a458d.zip
eclipse.platform.ui-50fe15070d10491b584a27a7fa12f699a30a458d.tar.gz
eclipse.platform.ui-50fe15070d10491b584a27a7fa12f699a30a458d.tar.bz2
Fixed bug 423214: [PropertiesView] add support for IColorProvider and IFontProvider
Signed-off-by: Kevin Milburn <kmilburn@gpslsolutions.com>
-rw-r--r--bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.ui.views/pom.xml4
-rw-r--r--bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java51
-rw-r--r--bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java28
4 files changed, 78 insertions, 7 deletions
diff --git a/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF
index 35343ea..b7da047 100644
--- a/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.views/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ui.views; singleton:=true
-Bundle-Version: 3.6.100.qualifier
+Bundle-Version: 3.7.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.ui.internal.views.ViewsPlugin
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.ui.views/pom.xml b/bundles/org.eclipse.ui.views/pom.xml
index 7b00cfb..19a161f 100644
--- a/bundles/org.eclipse.ui.views/pom.xml
+++ b/bundles/org.eclipse.ui.views/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012 Eclipse Foundation.
+ Copyright (c) 2012, 2013 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -19,6 +19,6 @@
</parent>
<groupId>org.eclipse.ui</groupId>
<artifactId>org.eclipse.ui.views</artifactId>
- <version>3.6.100-SNAPSHOT</version>
+ <version>3.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
index c95bfd5..ad5995a 100644
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
+++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Gunnar Wagenknecht - fix for bug 21756 [PropertiesView] property view sorting
+ * Kevin Milburn - [Bug 423214] [PropertiesView] add support for IColorProvider and IFontProvider
*******************************************************************************/
package org.eclipse.ui.views.properties;
@@ -21,7 +22,11 @@ import java.util.Map;
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellEditorListener;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.internal.views.ViewsPlugin;
@@ -788,4 +793,48 @@ public class PropertySheetEntry extends EventManager implements
parent.valueChanged(this);
}
}
+
+ /**
+ * Returns the foreground color for the entry.
+ *
+ * @return the foreground color for the entry, or <code>null</code> to use the default
+ * foreground color
+ * @since 3.7
+ */
+ protected Color getForeground() {
+ ILabelProvider provider = descriptor.getLabelProvider();
+ if (provider instanceof IColorProvider) {
+ return ((IColorProvider) provider).getForeground(this);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the background color for the entry.
+ *
+ * @return the background color for the entry, or <code>null</code> to use the default
+ * background color
+ * @since 3.7
+ */
+ protected Color getBackground() {
+ ILabelProvider provider = descriptor.getLabelProvider();
+ if (provider instanceof IColorProvider) {
+ return ((IColorProvider) provider).getBackground(this);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the font for the entry.
+ *
+ * @return the font for the entry, or <code>null</code> to use the default font
+ * @since 3.7
+ */
+ protected Font getFont() {
+ ILabelProvider provider = descriptor.getLabelProvider();
+ if (provider instanceof IFontProvider) {
+ return ((IFontProvider) provider).getFont(this);
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
index 514f64f..e306a86 100644
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
+++ b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Gunnar Wagenknecht - fix for bug 21756 [PropertiesView] property view sorting
+ * Kevin Milburn - [Bug 423214] [PropertiesView] add support for IColorProvider and IFontProvider
*******************************************************************************/
package org.eclipse.ui.views.properties;
@@ -44,6 +45,8 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.events.TreeListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
@@ -1337,8 +1340,27 @@ class PropertySheetViewer extends Viewer {
item.setText(1, entry.getValueAsString());
Image image = entry.getImage();
if (item.getImage(1) != image) {
- item.setImage(1, image);
- }
+ item.setImage(1, image);
+ }
+
+ if (entry instanceof PropertySheetEntry) {
+ PropertySheetEntry entry2 = (PropertySheetEntry) entry;
+
+ Color color = entry2.getForeground();
+ if (item.getForeground() != color) {
+ item.setForeground(color);
+ }
+
+ color = entry2.getBackground();
+ if (item.getBackground() != color) {
+ item.setBackground(color);
+ }
+
+ Font font = entry2.getFont();
+ if (item.getFont() != font) {
+ item.setFont(font);
+ }
+ }
// update the "+" icon
updatePlus(entry, item);