Non-moveable edit parts [message #184941] |
Tue, 21 June 2005 08:56 |
Eclipse User |
|
|
|
Originally posted by: sidney.lee.ibs.net
Hi!
How do I make an child part completely stationary with any attempt to
move it having no effect, no ghost rectangle, etc.
What I have done thus far is have the edit policy for the parent
implement createChildEditPolicy(EditPart) to return the
NonResizableEditPolicy with setDragAllowed(false). I selected the object
and when I try to move it (hoping it would remain stationary), I get the
exception posted below (P.S. I find it odd that dragging is being
handled when I have explicitly asked that it not be):
Any suggestions?
Many Thanks!
java.lang.NullPointerException
at
org.eclipse.gef.tools.DragEditPartsTracker.updateTargetReque st(DragEditPartsTracker.java:593)
at
org.eclipse.gef.tools.DragEditPartsTracker.handleDragInProgr ess(DragEditPartsTracker.java:333)
at org.eclipse.gef.tools.AbstractTool.mouseDrag(AbstractTool.ja va:994)
at org.eclipse.gef.tools.SelectionTool.mouseDrag(SelectionTool. java:511)
at org.eclipse.gef.EditDomain.mouseDrag(EditDomain.java:212)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Moved(DomainEventDispatcher.java:342)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove( LightweightSystem.java:523)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:144)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
at org.eclipse.core.launcher.Main.run(Main.java:704)
at org.eclipse.core.launcher.Main.main(Main.java:688)
|
|
|
|
Re: Non-moveable edit parts [message #184980 is a reply to message #184949] |
Tue, 21 June 2005 11:22 |
Eclipse User |
|
|
|
Originally posted by: sidney.lee.ibs.net
thanks, but that seems to have had no effect... :(
Steve Jones wrote:
> Sidney Lee wrote:
>
>
>>Hi!
>>
>>How do I make an child part completely stationary with any attempt to
>>move it having no effect, no ghost rectangle, etc.
>>What I have done thus far is have the edit policy for the parent
>>implement createChildEditPolicy(EditPart) to return the
>>NonResizableEditPolicy with setDragAllowed(false). I selected the object
>>and when I try to move it (hoping it would remain stationary), I get the
>>exception posted below (P.S. I find it odd that dragging is being
>>handled when I have explicitly asked that it not be):
>>
>>Any suggestions?
>>
>>Many Thanks!
>>
>>java.lang.NullPointerException
>>at
>>
>
> org.eclipse.gef.tools.DragEditPartsTracker.updateTargetReque st(DragEditPartsTracker.java:593)
>
>>at
>>
>
> org.eclipse.gef.tools.DragEditPartsTracker.handleDragInProgr ess(DragEditPartsTracker.java:333)
>
>>at org.eclipse.gef.tools.AbstractTool.mouseDrag(AbstractTool.ja va:994)
>>at org.eclipse.gef.tools.SelectionTool.mouseDrag(SelectionTool. java:511)
>>at org.eclipse.gef.EditDomain.mouseDrag(EditDomain.java:212)
>>at
>>
>
> org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Moved(DomainEventDispatcher.java:342)
>
>>at
>>
>
> org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove( LightweightSystem.java:523)
>
>>at
>> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:144)
>>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(Unknown Source)
>>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>at java.lang.reflect.Method.invoke(Unknown Source)
>>at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
>>at org.eclipse.core.launcher.Main.run(Main.java:704)
>>at org.eclipse.core.launcher.Main.main(Main.java:688)
>
>
> Hi,
>
> I'm working on a similar problem. I've subclassed ResizableEditPolicy. In
> it's constructor have:
>
> public MyChildSelectionEditPolicy() {
> setResizeDirections(0);
> setDragAllowed(false);
> }
>
> The policy is installed on the child edit part as:
>
> installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
> new ParentSelectionEditPolicy());
>
> You should now be able to select the child. It will have corner resize
> handles but attempts to resize or drag will fail. It dosen't seem to matter
> what policies are installed on the parent.
>
> Cheers, Steve.
>
|
|
|
non-moveable edit part - a solution ??? [message #185013 is a reply to message #184949] |
Tue, 21 June 2005 16:49 |
Eclipse User |
|
|
|
Originally posted by: sidney.lee.ibs.net
well, solved the problem - here was what I had to do:
(i) I subclassed NonResizableEditPolicy as follows:
public MyNonResizableEditPolicy(){
super();
setDragAllowed (false);
}
(ii) I used the parents layout policy to install it as follows:
protected EditPolicy createChildEditPolicy(EditPart child) {
return new MyNonResizableEditPolicy();
}
( amounts to the same as being installed on the child edit part as:
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
new MyNonResizableEditPolicy()); )
(iii) but there seems to be a problem with the dragTracker, which I
solved in my non-moveable EditPart class by returning the
SelectEditPartTracker (as oppose to the DragEditPartsTracker) in
getDragTracker(Request)
is this last step really necessary?
(I did override createSelectionHandles() in the MyNonResizableEditPolicy
to return Collections.EMPTY_LIST as I didn't want the part decorated --
but even if I did not do so, the problem persisted. The GEF
NonResizableEditPolicy does seem to use the SelectEditPartTracker...
something seems to be going wrong somewhere)
|
|
|
Re: non-moveable edit part - a solution ??? [message #185089 is a reply to message #185013] |
Wed, 22 June 2005 13:49 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
> (i) I subclassed NonResizableEditPolicy as follows:
> public MyNonResizableEditPolicy(){
> super(); setDragAllowed (false);
> }
That's a public method. Couldn't you have also just called it after
instantiating?
>
> (ii) I used the parents layout policy to install it as follows:
> protected EditPolicy createChildEditPolicy(EditPart child) {
> return new MyNonResizableEditPolicy();
> }
> ( amounts to the same as being installed on the child edit part as:
> installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
> new MyNonResizableEditPolicy()); )
>
> (iii) but there seems to be a problem with the dragTracker, which I solved
> in my non-moveable EditPart class by returning the SelectEditPartTracker
> (as oppose to the DragEditPartsTracker) in getDragTracker(Request)
>
> is this last step really necessary?
> (I did override createSelectionHandles() in the MyNonResizableEditPolicy
> to return Collections.EMPTY_LIST as I didn't want the part decorated --
> but even if I did not do so, the problem persisted. The GEF
> NonResizableEditPolicy does seem to use the SelectEditPartTracker...
> something seems to be going wrong somewhere)
|
|
|
Powered by
FUDForum. Page generated in 0.24415 seconds