Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 12979 Details for
Bug 61869
[JFace] JFace does not reflect the new color options for SWT Table and tree
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for column based colors for TableViewers
ITableColorProvider.patch (text/plain), 3.85 KB, created by
Gunnar Ahlberg
on 2004-07-06 09:18:09 EDT
(
hide
)
Description:
Patch for column based colors for TableViewers
Filename:
MIME Type:
Creator:
Gunnar Ahlberg
Created:
2004-07-06 09:18:09 EDT
Size:
3.85 KB
patch
obsolete
>Index: src/org/eclipse/jface/viewers/TableViewer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java,v >retrieving revision 1.13 >diff -u -r1.13 TableViewer.java >--- src/org/eclipse/jface/viewers/TableViewer.java 17 Jun 2004 02:12:37 -0000 1.13 >+++ src/org/eclipse/jface/viewers/TableViewer.java 6 Jul 2004 13:10:06 -0000 >@@ -180,7 +180,11 @@ > IBaseLabelProvider prov = getLabelProvider(); > ITableLabelProvider tprov = null; > ILabelProvider lprov = null; >+ ITableColorProvider cprov = null; > >+ if (prov instanceof ITableColorProvider) { >+ cprov = (ITableColorProvider)prov; >+ } > > if (prov instanceof ITableLabelProvider) { > tprov = (ITableLabelProvider) prov; >@@ -195,6 +199,10 @@ > // Similar code in TableTreeViewer.doUpdateItem() > String text = "";//$NON-NLS-1$ > Image image = null; >+ if(cprov != null) { >+ ti.setBackground(column, cprov.getBackground(element, column)); >+ ti.setForeground(column, cprov.getForeground(element, column)); >+ } > if (tprov != null) { > text = tprov.getColumnText(element, column); > image = tprov.getColumnImage(element, column); >@@ -216,16 +224,17 @@ > } > } > } >+ > ti.setText(column, text); > if (ti.getImage(column) != image) { > ti.setImage(column, image); > } > } >- if (prov instanceof IColorProvider) { >- IColorProvider cprov = (IColorProvider) prov; >- ti.setForeground(cprov.getForeground(element)); >- ti.setBackground(cprov.getBackground(element)); >- } >+// if (prov instanceof IColorProvider) { >+// IColorProvider cprov = (IColorProvider) prov; >+// ti.setForeground(cprov.getForeground(element)); >+// ti.setBackground(cprov.getBackground(element)); >+// } > if (prov instanceof IFontProvider) { > IFontProvider fprov = (IFontProvider) prov; > ti.setFont(fprov.getFont(element)); >Index: src/org/eclipse/jface/viewers/ITableColorProvider.java >=================================================================== >RCS file: src/org/eclipse/jface/viewers/ITableColorProvider.java >diff -N src/org/eclipse/jface/viewers/ITableColorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/viewers/ITableColorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+/* >+ * Contributed by Gunnar Ahlberg (www.gunnarahlberg.com) >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * Gunnar Ahlberg - www.gunnarahlberg.com >+ *******************************************************************************/ >+ >+package org.eclipse.jface.viewers; >+ >+import org.eclipse.swt.graphics.Color; >+ >+/** >+ * Interface to provide color representation for a given element. >+ */ >+public interface ITableColorProvider { >+ >+ /** >+ * Provides a foreground color for the given element. >+ * >+ * @param element the element >+ * @param columnIndex the zero-based index of the column in which >+ * the color appears >+ * @return the foreground color for the element, or <code>null</code> to >+ * use the default foreground color >+ */ >+ Color getForeground(Object element, int columnIndex); >+ >+ /** >+ * Provides a background color for the given element at the specified index >+ * >+ * @param element the element >+ * @param columnIndex the zero-based index of the column in which the color appears >+ * @return the background color for the element, or <code>null</code> to >+ * use the default background color >+ * >+ */ >+ Color getBackground(Object element, int columnIndex); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 61869
: 12979 |
12980
|
12981