Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » How can PShelfItem be dynamically added and removed from PShelf
How can PShelfItem be dynamically added and removed from PShelf [message #37391] Thu, 19 July 2007 01:39 Go to next message
Peter is currently offline Peter
Messages: 10
Registered: July 2009
Junior Member
Recently I created a PShelf and add some PShelfItem to it at creation time.
After that, I want to remove some PShelfItem and add other PShelfItem to
this PShelf. Could I do that? I don't think PShelf offer the API to do that.

Best Regards,
Peter [
Re: How can PShelfItem be dynamically added and removed from PShelf [message #37459 is a reply to message #37391] Thu, 19 July 2007 02:21 Go to previous messageGo to next message
Peter is currently offline Peter
Messages: 10
Registered: July 2009
Junior Member
I've tried following code to remove PShelfItem from PShelf

PShelfItem[] items = shelf.getItems();
for(int i = items.length - 1; i >= 0; i--) {
items[i].dispose();
}

But it always report an index out of bound exception. Am i missing
something?

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled Code))
at java.util.ArrayList.get(ArrayList.java(Compiled Code))
at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
at org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
Code))
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled Code))
at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled Code))
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)


"Peter" <zhangjie80@gmail.com> д
Re: How can PShelfItem be dynamically added and removed from PShelf [message #37493 is a reply to message #37459] Thu, 19 July 2007 11:14 Go to previous messageGo to next message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Hi Peter,

I can't reproduce your problem. Are you disposing of the items during a
paint event?

Regards,
-Chris

Peter wrote:
> I've tried following code to remove PShelfItem from PShelf
>
> PShelfItem[] items = shelf.getItems();
> for(int i = items.length - 1; i >= 0; i--) {
> items[i].dispose();
> }
>
> But it always report an index out of bound exception. Am i missing
> something?
>
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled Code))
> at java.util.ArrayList.get(ArrayList.java(Compiled Code))
> at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
> at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
> at org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
> Code))
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
> at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled Code))
> at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled Code))
> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
> at java.lang.reflect.Method.invoke(Method.java:391)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>
> "Peter" <zhangjie80@gmail.com> дÈëÏûÏ¢ÐÂÎÅ:f7mtfg$918$1@build.eclipse.org...
>> Recently I created a PShelf and add some PShelfItem to it at creation
>> time. After that, I want to remove some PShelfItem and add other
>> PShelfItem to this PShelf. Could I do that? I don't think PShelf offer the
>> API to do that.
>>
>> Best Regards,
>> Peter [ÕŽÝ]
>>
>
>
Re: How can PShelfItem be dynamically added and removed from PShelf [message #37559 is a reply to message #37493] Tue, 24 July 2007 04:56 Go to previous messageGo to next message
Eclipse User
Originally posted by: vlalan.csc.com

Hi Peter,

I also had the same req, and got the solution as to create a new Shelf and
ShelfItems and dispose the old one, Since Pshelf doesnot provide addition
and deletion at runtime.

Thanks,
Vipul.

Chris Gross wrote:

> Hi Peter,

> I can't reproduce your problem. Are you disposing of the items during a
> paint event?

> Regards,
> -Chris

> Peter wrote:
>> I've tried following code to remove PShelfItem from PShelf
>>
>> PShelfItem[] items = shelf.getItems();
>> for(int i = items.length - 1; i >= 0; i--) {
>> items[i].dispose();
>> }
>>
>> But it always report an index out of bound exception. Am i missing
>> something?
>>
>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>> at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled Code))
>> at java.util.ArrayList.get(ArrayList.java(Compiled Code))
>> at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
>> at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
>> at org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
>> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
>> Code))
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
>> at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
>> at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled Code))
>> at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled Code))
>> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>> at
>>
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>> at
>>
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>> at
>>
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
>> at
>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
>> at
>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
>> at java.lang.reflect.Method.invoke(Method.java:391)
>> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>
>>
>> "Peter" <zhangjie80@gmail.com>
ÐŽÈëÏûÏ¢ÐÂÎÅ:f7mtfg$918$1@build.eclipse.org...
>>> Recently I created a PShelf and add some PShelfItem to it at creation
>>> time. After that, I want to remove some PShelfItem and add other
>>> PShelfItem to this PShelf. Could I do that? I don't think PShelf offer the
>>> API to do that.
>>>
>>> Best Regards,
>>> Peter [ÕÅœÝ]
>>>
>>
>>
Re: How can PShelfItem be dynamically added and removed from PShelf [message #37716 is a reply to message #37559] Tue, 24 July 2007 10:16 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 253
Registered: July 2009
Senior Member
Hi Vipul,

You're right that was a workaround for the issue. Regardless, the issue
has been fixed yesterday. It should be available in the currently
nightly build.

Regards,
-Chris

Vipul wrote:
> Hi Peter,
>
> I also had the same req, and got the solution as to create a new Shelf
> and ShelfItems and dispose the old one, Since Pshelf doesnot provide
> addition and deletion at runtime.
>
> Thanks,
> Vipul.
>
> Chris Gross wrote:
>
>> Hi Peter,
>
>> I can't reproduce your problem. Are you disposing of the items during
>> a paint event?
>
>> Regards,
>> -Chris
>
>> Peter wrote:
>>> I've tried following code to remove PShelfItem from PShelf
>>>
>>> PShelfItem[] items = shelf.getItems();
>>> for(int i = items.length - 1; i >= 0; i--) {
>>> items[i].dispose();
>>> }
>>>
>>> But it always report an index out of bound exception. Am i missing
>>> something?
>>>
>>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>>> at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled
>>> Code))
>>> at java.util.ArrayList.get(ArrayList.java(Compiled Code))
>>> at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
>>> at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
>>> at
>>> org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
>>> at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
>>> at
>>> org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
>>> Code))
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
>>> at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
>>> at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled
>>> Code))
>>> at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled
>>> Code))
>>> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>>> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
>>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
>>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
>>> at
>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
>>>
>>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>>> at
>>> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>>> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
>>> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
>>> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
>
>>> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
>
>>> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
>
>>> at java.lang.reflect.Method.invoke(Method.java:391)
>>> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>>
>>>
>>> "Peter" <zhangjie80@gmail.com>
> ÐŽÈëÏûÏ¢ÐÂÎÅ:f7mtfg$918$1@build.eclipse.org...
>>>> Recently I created a PShelf and add some PShelfItem to it at
>>>> creation time. After that, I want to remove some PShelfItem and add
>>>> other PShelfItem to this PShelf. Could I do that? I don't think
>>>> PShelf offer the API to do that.
>>>>
>>>> Best Regards,
>>>> Peter [ÕÅœÝ]
>>>>
>>>
>>>
>
>
Re: How can PShelfItem be dynamically added and removed from PShelf [message #583558 is a reply to message #37391] Thu, 19 July 2007 02:21 Go to previous message
Peter is currently offline Peter
Messages: 10
Registered: July 2009
Junior Member
I've tried following code to remove PShelfItem from PShelf

PShelfItem[] items = shelf.getItems();
for(int i = items.length - 1; i >= 0; i--) {
items[i].dispose();
}

But it always report an index out of bound exception. Am i missing
something?

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled Code))
at java.util.ArrayList.get(ArrayList.java(Compiled Code))
at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
at org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
Code))
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled Code))
at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled Code))
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)


"Peter" <zhangjie80@gmail.com> д
Re: How can PShelfItem be dynamically added and removed from PShelf [message #583573 is a reply to message #37459] Thu, 19 July 2007 11:14 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Hi Peter,

I can't reproduce your problem. Are you disposing of the items during a
paint event?

Regards,
-Chris

Peter wrote:
> I've tried following code to remove PShelfItem from PShelf
>
> PShelfItem[] items = shelf.getItems();
> for(int i = items.length - 1; i >= 0; i--) {
> items[i].dispose();
> }
>
> But it always report an index out of bound exception. Am i missing
> something?
>
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled Code))
> at java.util.ArrayList.get(ArrayList.java(Compiled Code))
> at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
> at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
> at org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
> Code))
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
> at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
> at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled Code))
> at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled Code))
> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
> at java.lang.reflect.Method.invoke(Method.java:391)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>
> "Peter" <zhangjie80@gmail.com> дÈëÏûÏ¢ÐÂÎÅ:f7mtfg$918$1@build.eclipse.org...
>> Recently I created a PShelf and add some PShelfItem to it at creation
>> time. After that, I want to remove some PShelfItem and add other
>> PShelfItem to this PShelf. Could I do that? I don't think PShelf offer the
>> API to do that.
>>
>> Best Regards,
>> Peter [ÕŽÝ]
>>
>
>
Re: How can PShelfItem be dynamically added and removed from PShelf [message #583597 is a reply to message #37493] Tue, 24 July 2007 04:56 Go to previous message
Vipul is currently offline Vipul
Messages: 6
Registered: July 2009
Junior Member
Hi Peter,

I also had the same req, and got the solution as to create a new Shelf and
ShelfItems and dispose the old one, Since Pshelf doesnot provide addition
and deletion at runtime.

Thanks,
Vipul.

Chris Gross wrote:

> Hi Peter,

> I can't reproduce your problem. Are you disposing of the items during a
> paint event?

> Regards,
> -Chris

> Peter wrote:
>> I've tried following code to remove PShelfItem from PShelf
>>
>> PShelfItem[] items = shelf.getItems();
>> for(int i = items.length - 1; i >= 0; i--) {
>> items[i].dispose();
>> }
>>
>> But it always report an index out of bound exception. Am i missing
>> something?
>>
>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>> at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled Code))
>> at java.util.ArrayList.get(ArrayList.java(Compiled Code))
>> at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
>> at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
>> at org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
>> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
>> Code))
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
>> at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
>> at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled Code))
>> at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled Code))
>> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>> at
>>
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>> at
>>
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>> at
>>
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
>> at
>>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
>> at
>>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
>> at java.lang.reflect.Method.invoke(Method.java:391)
>> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>
>>
>> "Peter" <zhangjie80@gmail.com>
ÐŽÈëÏûÏ¢ÐÂÎÅ:f7mtfg$918$1@build.eclipse.org...
>>> Recently I created a PShelf and add some PShelfItem to it at creation
>>> time. After that, I want to remove some PShelfItem and add other
>>> PShelfItem to this PShelf. Could I do that? I don't think PShelf offer the
>>> API to do that.
>>>
>>> Best Regards,
>>> Peter [ÕÅœÝ]
>>>
>>
>>
Re: How can PShelfItem be dynamically added and removed from PShelf [message #583662 is a reply to message #37559] Tue, 24 July 2007 10:16 Go to previous message
Chris Gross is currently offline Chris Gross
Messages: 471
Registered: July 2009
Senior Member
Hi Vipul,

You're right that was a workaround for the issue. Regardless, the issue
has been fixed yesterday. It should be available in the currently
nightly build.

Regards,
-Chris

Vipul wrote:
> Hi Peter,
>
> I also had the same req, and got the solution as to create a new Shelf
> and ShelfItems and dispose the old one, Since Pshelf doesnot provide
> addition and deletion at runtime.
>
> Thanks,
> Vipul.
>
> Chris Gross wrote:
>
>> Hi Peter,
>
>> I can't reproduce your problem. Are you disposing of the items during
>> a paint event?
>
>> Regards,
>> -Chris
>
>> Peter wrote:
>>> I've tried following code to remove PShelfItem from PShelf
>>>
>>> PShelfItem[] items = shelf.getItems();
>>> for(int i = items.length - 1; i >= 0; i--) {
>>> items[i].dispose();
>>> }
>>>
>>> But it always report an index out of bound exception. Am i missing
>>> something?
>>>
>>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>>> at java.util.ArrayList.RangeCheck(ArrayList.java(Inlined Compiled
>>> Code))
>>> at java.util.ArrayList.get(ArrayList.java(Compiled Code))
>>> at org.eclipse.nebula.widgets.pshelf.PShelf.onPaint(PShelf.java :265)
>>> at org.eclipse.nebula.widgets.pshelf.PShelf.access$0(PShelf.jav a:248)
>>> at
>>> org.eclipse.nebula.widgets.pshelf.PShelf$1.paintControl(PShe lf.java:108)
>>> at
>>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:83)
>>> at
>>> org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled
>>> Code))
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:952)
>>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
>>> at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:12 85)
>>> at org.eclipse.swt.widgets.Control.windowProc(Control.java(Comp iled
>>> Code))
>>> at org.eclipse.swt.widgets.Display.windowProc(Display.java(Comp iled
>>> Code))
>>> at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
>>> at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:19 32)
>>> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2966)
>>> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1930)
>>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
>>> at
>>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:422)
>>>
>>> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
>>> at
>>> org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
>>> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
>>> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
>>> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>>>
>>> at
>>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:85)
>
>>> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:58)
>
>>> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:60)
>
>>> at java.lang.reflect.Method.invoke(Method.java:391)
>>> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
>>> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
>>> at org.eclipse.core.launcher.Main.run(Main.java:977)
>>> at org.eclipse.core.launcher.Main.main(Main.java:952)
>>>
>>>
>>> "Peter" <zhangjie80@gmail.com>
> ÐŽÈëÏûÏ¢ÐÂÎÅ:f7mtfg$918$1@build.eclipse.org...
>>>> Recently I created a PShelf and add some PShelfItem to it at
>>>> creation time. After that, I want to remove some PShelfItem and add
>>>> other PShelfItem to this PShelf. Could I do that? I don't think
>>>> PShelf offer the API to do that.
>>>>
>>>> Best Regards,
>>>> Peter [ÕÅœÝ]
>>>>
>>>
>>>
>
>
Previous Topic:ToolTip support on Gallery
Next Topic:ToolTip support on Gallery
Goto Forum:
  


Current Time: Tue Jul 29 08:56:01 EDT 2014

Powered by FUDForum. Page generated in 0.02116 seconds