Repopulate palette -- Null pointer in PaletteViewer [message #151633] |
Tue, 21 September 2004 16:55  |
Eclipse User |
|
|
|
I'm having the same problem with reloading/refreshing the palette that is
described in this message:
http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg0 7029.html
I'm using GEF 3.0. I have a singleton palette root instance that on
occaision is repopulated with additional items that are put into my project.
(See stack trace). My class that creates the palette root, when it detects
changes to the project, removes all children from the palette root and then
rebuilds the palette (keeping the same palette root instance). If my editor
is open, I then get this NPE when the user clicks on a tool in the palette
after the root has been rebuilt. It seems that the query to get the
ToolEntryEditPart from the edit part registry using a reference to the
active entry which returns null--I'm guessing because the children have been
replaced so there is a different set of editparts.
I was able to work around this by adding a listener to my palette root and
then when the children change, I get the palette viewer and
setActiveTool(null), but wouldn't it be cleaner if the palette viewer--when
it receives change events from the model clears the active tool if the
referenced active tool has been removed? I don't think external listeners
should need to know to set the active tool null when the PaletteViewer
should already be able to handle this.
Defect?
Erik
java.lang.NullPointerException
at
org.eclipse.gef.ui.palette.PaletteViewer.setActiveTool(Palet teViewer.java:36
1)
at
org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditP art$2.actionPerf
ormed(ToolEntryEditPart.java:256)
at org.eclipse.draw2d.Clickable.fireActionPerformed(Clickable.j ava:200)
at org.eclipse.draw2d.Clickable$1.actionPerformed(Clickable.jav a:172)
at org.eclipse.draw2d.ButtonModel.fireActionPerformed(ButtonMod el.java:131)
at org.eclipse.draw2d.ToggleModel.fireActionPerformed(ToggleMod el.java:28)
at
org.eclipse.draw2d.ButtonModel$DefaultFiringBehavior.release d(ButtonModel.ja
va:484)
at org.eclipse.draw2d.ButtonModel.fireReleased(ButtonModel.java :169)
at org.eclipse.draw2d.ButtonModel.setPressed(ButtonModel.java:4 44)
at
org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditP art$OtherToggleB
uttonTracker.handleButtonUp(ToolEntryEditPart.java:159)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1042)
at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.ja va:535)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:241)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainE
ventDispatcher.java:344)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.
java:516)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:136)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2772)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2431)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1377)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:254)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:141)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:96)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.
java:335)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
at org.eclipse.core.launcher.Main.run(Main.java:644)
at org.eclipse.core.launcher.Main.main(Main.java:628)
|
|
|
Re: Repopulate palette -- Null pointer in PaletteViewer [message #151699 is a reply to message #151633] |
Wed, 22 September 2004 13:20  |
Eclipse User |
|
|
|
Sounds plausible. The parent EditPart could set the active tool to be null
before removing it. Open a bug report.
"Erik Johnson" <ejohnson@avaya.com> wrote in message
news:ciq48r$79o$1@eclipse.org...
> I'm having the same problem with reloading/refreshing the palette that is
> described in this message:
> http://dev.eclipse.org/newslists/news.eclipse.tools.gef/msg0 7029.html
>
> I'm using GEF 3.0. I have a singleton palette root instance that on
> occaision is repopulated with additional items that are put into my
project.
> (See stack trace). My class that creates the palette root, when it
detects
> changes to the project, removes all children from the palette root and
then
> rebuilds the palette (keeping the same palette root instance). If my
editor
> is open, I then get this NPE when the user clicks on a tool in the palette
> after the root has been rebuilt. It seems that the query to get the
> ToolEntryEditPart from the edit part registry using a reference to the
> active entry which returns null--I'm guessing because the children have
been
> replaced so there is a different set of editparts.
>
> I was able to work around this by adding a listener to my palette root and
> then when the children change, I get the palette viewer and
> setActiveTool(null), but wouldn't it be cleaner if the palette
viewer--when
> it receives change events from the model clears the active tool if the
> referenced active tool has been removed? I don't think external listeners
> should need to know to set the active tool null when the PaletteViewer
> should already be able to handle this.
>
> Defect?
> Erik
>
>
> java.lang.NullPointerException
> at
>
org.eclipse.gef.ui.palette.PaletteViewer.setActiveTool(Palet teViewer.java:36
> 1)
> at
>
org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditP art$2.actionPerf
> ormed(ToolEntryEditPart.java:256)
> at org.eclipse.draw2d.Clickable.fireActionPerformed(Clickable.j ava:200)
> at org.eclipse.draw2d.Clickable$1.actionPerformed(Clickable.jav a:172)
> at
org.eclipse.draw2d.ButtonModel.fireActionPerformed(ButtonMod el.java:131)
> at
org.eclipse.draw2d.ToggleModel.fireActionPerformed(ToggleMod el.java:28)
> at
>
org.eclipse.draw2d.ButtonModel$DefaultFiringBehavior.release d(ButtonModel.ja
> va:484)
> at org.eclipse.draw2d.ButtonModel.fireReleased(ButtonModel.java :169)
> at org.eclipse.draw2d.ButtonModel.setPressed(ButtonModel.java:4 44)
> at
>
org.eclipse.gef.internal.ui.palette.editparts.ToolEntryEditP art$OtherToggleB
> uttonTracker.handleButtonUp(ToolEntryEditPart.java:159)
> at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1042)
> at org.eclipse.gef.tools.SelectionTool.mouseUp(SelectionTool.ja va:535)
> at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:241)
> at
>
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainE
> ventDispatcher.java:344)
> at
>
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.
> java:516)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:136)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :82)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:2772)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2431)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1377)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348)
> at
>
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:254)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:141)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:96)
> at
>
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.
> java:335)
> at
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:273)
> at
>
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:129)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39
> )
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.eclipse.core.launcher.Main.basicRun(Main.java:183)
> at org.eclipse.core.launcher.Main.run(Main.java:644)
> at org.eclipse.core.launcher.Main.main(Main.java:628)
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03602 seconds