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 244466 Details for
Bug 438023
[Tree] Expand/Collapse event has null item in some cases
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]
Workbench Demo patch to reproduce the issue
tree-viewer-refresh.patch (text/plain), 7.51 KB, created by
Ivan Furnadjiev
on 2014-06-24 07:17:55 EDT
(
hide
)
Description:
Workbench Demo patch to reproduce the issue
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2014-06-24 07:17:55 EDT
Size:
7.51 KB
patch
obsolete
>diff --git a/examples/org.eclipse.rap.demo/icons/refresh.gif b/examples/org.eclipse.rap.demo/icons/refresh.gif >new file mode 100644 >index 0000000..049cac6 >--- /dev/null >+++ b/examples/org.eclipse.rap.demo/icons/refresh.gif >Binary files differ >diff --git a/examples/org.eclipse.rap.demo/plugin.xml b/examples/org.eclipse.rap.demo/plugin.xml >index 8b02cfc..bd58e66 100644 >--- a/examples/org.eclipse.rap.demo/plugin.xml >+++ b/examples/org.eclipse.rap.demo/plugin.xml >@@ -318,4 +318,26 @@ > </page> > </extension> > >+ <extension >+ point="org.eclipse.ui.menus"> >+ <menuContribution >+ locationURI="toolbar:org.eclipse.rap.demo.DemoTreeViewPartII?after=additions"> >+ <command >+ commandId="command.refresh" >+ icon="icons/refresh.gif" >+ label="refresh" >+ style="push" >+ tooltip="erfresh"> >+ </command> >+ </menuContribution> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.commands"> >+ <command >+ defaultHandler="org.eclipse.rap.demo.RefreshViewHandler" >+ id="command.refresh" >+ name="refresh"> >+ </command> >+ </extension> > </plugin> >diff --git a/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/DemoTreeViewPart.java b/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/DemoTreeViewPart.java >index 09ac248..6f48f54 100644 >--- a/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/DemoTreeViewPart.java >+++ b/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/DemoTreeViewPart.java >@@ -14,12 +14,13 @@ > import java.util.ArrayList; > import java.util.List; > >+import org.eclipse.jface.action.GroupMarker; >+import org.eclipse.jface.action.MenuManager; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.*; > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Image; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.*; > import org.eclipse.ui.*; > import org.eclipse.ui.part.ViewPart; > import org.eclipse.ui.views.properties.*; >@@ -30,24 +31,24 @@ > private TreeViewer viewer; > private IPropertySheetPage propertyPage; > >-// TODO [rst] Add via extension >-// private final class LeafStarLabelDecorator extends LabelProvider >-// implements ILabelDecorator >-// { >+// TODO [rst] Add via extension >+// private final class LeafStarLabelDecorator extends LabelProvider >+// implements ILabelDecorator >+// { > // >-// public String decorateText( String text, Object element ) { >-// if( text.startsWith( "Leaf" ) ) { >-// return text + "*"; >-// } >-// return text; >-// } >+// public String decorateText( String text, Object element ) { >+// if( text.startsWith( "Leaf" ) ) { >+// return text + "*"; >+// } >+// return text; >+// } > // >-// public Image decorateImage( Image image, Object element ) { >-// return null; >-// } >-// } >- >+// public Image decorateImage( Image image, Object element ) { >+// return null; >+// } >+// } > private static final class ViewLabelProvider extends LabelProvider { >+ > @Override > public Image getImage( Object element ) { > IWorkbench workbench = PlatformUI.getWorkbench(); >@@ -55,8 +56,8 @@ > return sharedImages.getImage( ISharedImages.IMG_OBJ_ELEMENT ); > } > } >- > class TreeObject implements IPropertySource { >+ > private static final String PROP_ID_LOCATION = "location"; > private static final String PROP_ID_NAME = "name"; > private String name; >@@ -141,16 +142,15 @@ > update( this ); > } > } >- > /** > * Instances of this type are decorated with an error marker > */ > private class BrokenTreeObject extends TreeObject { >+ > public BrokenTreeObject( String name ) { > super( name ); > } > } >- > private class TreeParent extends TreeObject { > > private final List<TreeObject> children; >@@ -182,6 +182,12 @@ > private TreeParent invisibleRoot; > > public void inputChanged( Viewer v, Object oldInput, Object newInput ) { >+ try { >+ Thread.sleep( 3000 ); >+ initialize(); >+ } catch( InterruptedException e ) { >+ e.printStackTrace(); >+ } > } > > public void dispose() { >@@ -219,16 +225,19 @@ > } > > /* >- * We will set up a dummy model to initialize tree heararchy. In a real >- * code, you will connect to a real model and expose its hierarchy. >+ * We will set up a dummy model to initialize tree heararchy. In a real code, you will connect >+ * to a real model and expose its hierarchy. > */ > private void initialize() { >+ invisibleRoot = new TreeParent( "" ); >+ invisibleRoot.addChild( createContent() ); >+ } >+ >+ private TreeParent createContent() { > TreeObject to1 = new TreeObject( "EclipseCon location", > "http://maps.google.com/maps?q=5001%20Great%20America%20Pkwy%20Santa%20Clara%20CA%2095054" ); >- TreeObject to2 = new TreeObject( "Eclipse Foundation", >- "http://maps.google.com/maps?q=Ottawa" ); >- TreeObject to3 = new TreeObject( "Innoopract Inc", >- "http://maps.google.com/maps?q=Portland" ); >+ TreeObject to2 = new TreeObject( "Eclipse Foundation", "http://maps.google.com/maps?q=Ottawa" ); >+ TreeObject to3 = new TreeObject( "Innoopract Inc", "http://maps.google.com/maps?q=Portland" ); > TreeParent p1 = new TreeParent( "Locate in browser view" ); > p1.addChild( to1 ); > p1.addChild( to2 ); >@@ -241,8 +250,7 @@ > root.addChild( p1 ); > root.addChild( p2 ); > root.addChild( p3 ); >- invisibleRoot = new TreeParent( "" ); >- invisibleRoot.addChild( root ); >+ return root; > } > } > >@@ -250,10 +258,11 @@ > public void createPartControl( Composite parent ) { > viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL ); > viewer.setContentProvider( new TreeViewerContentProvider() ); >- ILabelDecorator labelDecorator >- = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); >- ILabelProvider labelProvider >- = new DecoratingLabelProvider( new ViewLabelProvider(), labelDecorator ); >+ ILabelDecorator labelDecorator = PlatformUI.getWorkbench() >+ .getDecoratorManager() >+ .getLabelDecorator(); >+ ILabelProvider labelProvider = new DecoratingLabelProvider( new ViewLabelProvider(), >+ labelDecorator ); > viewer.setLabelProvider( labelProvider ); > viewer.setInput( this ); > viewer.addDoubleClickListener( this ); >@@ -290,4 +299,8 @@ > public TreeViewer getViewer() { > return viewer; > } >+ >+ public void refresh() { >+ viewer.setInput( this ); >+ } > } >diff --git a/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/RefreshViewHandler.java b/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/RefreshViewHandler.java >new file mode 100644 >index 0000000..ccccd4d >--- /dev/null >+++ b/examples/org.eclipse.rap.demo/src/org/eclipse/rap/demo/RefreshViewHandler.java >@@ -0,0 +1,17 @@ >+package org.eclipse.rap.demo; >+ >+import org.eclipse.core.commands.*; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+ >+public class RefreshViewHandler extends AbstractHandler { >+ >+ public Object execute( final ExecutionEvent event ) throws ExecutionException { >+ final IWorkbenchPart part = HandlerUtil.getActivePartChecked( event ); >+ if( part instanceof DemoTreeViewPart ) { >+ ( ( DemoTreeViewPart )part ).refresh(); >+ } >+ return null; >+ } >+} >\ No newline at end of file
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 438023
: 244466