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 59578 Details for
Bug 174355
[Viewers] IViewerLabelProvider isn't supported by the TreeViewer anymore
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 incooperating ViewerRow#getTreePath() into Boris M5a solution
clipboard50233.txt (text/plain), 7.13 KB, created by
Thomas Schindl
on 2007-02-22 11:00:28 EST
(
hide
)
Description:
Patch incooperating ViewerRow#getTreePath() into Boris M5a solution
Filename:
MIME Type:
Creator:
Thomas Schindl
Created:
2007-02-22 11:00:28 EST
Size:
7.13 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: src/org/eclipse/jface/viewers/TableViewerRow.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerRow.java,v >retrieving revision 1.4 >diff -u -r1.4 TableViewerRow.java >--- src/org/eclipse/jface/viewers/TableViewerRow.java 20 Jan 2007 05:11:39 -0000 1.4 >+++ src/org/eclipse/jface/viewers/TableViewerRow.java 22 Feb 2007 15:54:46 -0000 >@@ -9,6 +9,7 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Tom Shindl <tom.schindl@bestsolution.at> - initial API and implementation >+ * - Fix for bug 174355 > ******************************************************************************/ > > package org.eclipse.jface.viewers; >@@ -181,4 +182,9 @@ > return null; > } > >+ public TreePath getTreePath() { >+ // Tables don't support paths >+ return null; >+ } >+ > } >Index: src/org/eclipse/jface/viewers/WrappedViewerLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/WrappedViewerLabelProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 WrappedViewerLabelProvider.java >--- src/org/eclipse/jface/viewers/WrappedViewerLabelProvider.java 25 Sep 2006 13:35:58 -0000 1.1 >+++ src/org/eclipse/jface/viewers/WrappedViewerLabelProvider.java 22 Feb 2007 15:54:46 -0000 >@@ -11,6 +11,7 @@ > > package org.eclipse.jface.viewers; > >+import org.eclipse.core.runtime.Assert; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Font; > import org.eclipse.swt.graphics.Image; >@@ -33,6 +34,10 @@ > > private IFontProvider fontProvider; > >+ private IViewerLabelProvider viewerLabelProvider; >+ >+ private ITreePathLabelProvider treePathLabelProvider; >+ > /** > * Create a new instance of the receiver based on labelProvider. > * >@@ -50,6 +55,12 @@ > * {@link Object} > */ > public void setProviders(Object provider) { >+ if (provider instanceof ITreePathLabelProvider) >+ treePathLabelProvider = ((ITreePathLabelProvider) provider); >+ >+ if (provider instanceof IViewerLabelProvider) >+ viewerLabelProvider = ((IViewerLabelProvider) provider); >+ > if (provider instanceof ILabelProvider) > labelProvider = ((ILabelProvider) provider); > >@@ -138,4 +149,40 @@ > IFontProvider getFontProvider() { > return fontProvider; > } >+ >+ public void update(ViewerCell cell) { >+ if (viewerLabelProvider != null) { >+ ViewerLabel label = new ViewerLabel(cell.getText(), cell.getImage()); >+ viewerLabelProvider.updateLabel(label, cell.getElement()); >+ applyViewerLabel(cell, label); >+ } else if (treePathLabelProvider != null) { >+ ViewerLabel label = new ViewerLabel(cell.getText(), cell.getImage()); >+ TreePath treePath = cell.getViewerRow().getTreePath(); >+ >+ Assert.isNotNull(treePath); >+ treePathLabelProvider.updateLabel(label, treePath); >+ >+ applyViewerLabel(cell, label); >+ } else { >+ super.update(cell); >+ } >+ } >+ >+ private void applyViewerLabel(ViewerCell cell, ViewerLabel label) { >+ if (label.hasNewText()) { >+ cell.setText(label.getText()); >+ } >+ if (label.hasNewImage()) { >+ cell.setImage(label.getImage()); >+ } >+ if (label.hasNewBackground()) { >+ cell.setBackground(label.getBackground()); >+ } >+ if (label.hasNewForeground()) { >+ cell.setForeground(label.getForeground()); >+ } >+ if (label.hasNewFont()) { >+ cell.setFont(label.getFont()); >+ } >+ } > } >Index: src/org/eclipse/jface/viewers/TreeViewerRow.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewerRow.java,v >retrieving revision 1.4 >diff -u -r1.4 TreeViewerRow.java >--- src/org/eclipse/jface/viewers/TreeViewerRow.java 20 Jan 2007 05:11:39 -0000 1.4 >+++ src/org/eclipse/jface/viewers/TreeViewerRow.java 22 Feb 2007 15:54:46 -0000 >@@ -8,10 +8,15 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation >+ * - Fix for bug 174355 > ******************************************************************************/ > > package org.eclipse.jface.viewers; > >+import java.util.ArrayList; >+import java.util.LinkedList; >+ >+import org.eclipse.core.runtime.Assert; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Font; > import org.eclipse.swt.graphics.Image; >@@ -293,6 +298,20 @@ > > return rv; > } >- >- >-} >+ >+ public TreePath getTreePath() { >+ ArrayList path = new ArrayList(); >+ path.add(item.getData()); >+ >+ TreeItem tItem = item; >+ LinkedList segments = new LinkedList(); >+ while (tItem != null) { >+ Object segment = tItem.getData(); >+ Assert.isNotNull(segment); >+ segments.addFirst(segment); >+ tItem = tItem.getParentItem(); >+ } >+ >+ return new TreePath(segments.toArray()); >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/jface/viewers/ViewerRow.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerRow.java,v >retrieving revision 1.8 >diff -u -r1.8 ViewerRow.java >--- src/org/eclipse/jface/viewers/ViewerRow.java 20 Jan 2007 05:11:39 -0000 1.8 >+++ src/org/eclipse/jface/viewers/ViewerRow.java 22 Feb 2007 15:54:46 -0000 >@@ -9,6 +9,7 @@ > * IBM Corporation - initial API and implementation > * Tom Shindl <tom.schindl@bestsolution.at> - initial API and implementation > * fix for bug 166346, bug 167325s >+ * - Fix for bug 174355 > ******************************************************************************/ > > package org.eclipse.jface.viewers; >@@ -40,12 +41,14 @@ > > /** > * Constant denoting the row above the current one (value is 1). >+ * > * @see #getNeighbor(int, boolean) > */ > public static final int ABOVE = 1; > > /** > * Constant denoting the row below the current one (value is 2). >+ * > * @see #getNeighbor(int, boolean) > */ > public static final int BELOW = 2; >@@ -224,10 +227,9 @@ > public abstract Control getControl(); > > /** >- * Returns a neighboring row, or <code>null</code> if no >- * neighbor exists in the given direction. If <code>sameLevel</code> is >- * <code>true</code>, only sibling rows (under the same parent) will be >- * considered. >+ * Returns a neighboring row, or <code>null</code> if no neighbor exists >+ * in the given direction. If <code>sameLevel</code> is <code>true</code>, >+ * only sibling rows (under the same parent) will be considered. > * > * @param direction > * the direction {@link #BELOW} or {@link #ABOVE} >@@ -238,4 +240,9 @@ > */ > public abstract ViewerRow getNeighbor(int direction, boolean sameLevel); > >+ /** >+ * The tree path used to identify an element by the unique path >+ * @return the path or <code>null</code> if no path exists >+ */ >+ public abstract TreePath getTreePath(); > }
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 174355
:
59101
|
59103
|
59158
|
59165
|
59535
|
59551
|
59557
|
59578
|
60281