Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Different EditParts selected in GraphicalViewer and SelectionAction
Different EditParts selected in GraphicalViewer and SelectionAction [message #195680] Mon, 12 September 2005 22:13 Go to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
My diagram has node and children within those nodes. The children have a
NonResizableEditPolicy so that they can be selected. The children also have
their own context menu SelectionAction. When I right-click a child, the List
of EditParts obtained of the diagram's GraphicalViewer is what I would
expect, i.e. the EditPart of the child. However, in the SelectionAction it
is just the diagram's EditPart, which means the action cannot do its job.
What is the problem? The SelectionAction is properly registered as such.
Re: Different EditParts selected in GraphicalViewer and SelectionAction [message #195799 is a reply to message #195680] Tue, 13 September 2005 15:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

So you've added that action to both the action registry and the list of
selection actions? Does its update() method get called properly when the
selection changes?

"Felix L J Mayer" <felix.mayer@objectaid.com> wrote in message
news:dg4uam$cdp$1@news.eclipse.org...
> My diagram has node and children within those nodes. The children have a
> NonResizableEditPolicy so that they can be selected. The children also
have
> their own context menu SelectionAction. When I right-click a child, the
List
> of EditParts obtained of the diagram's GraphicalViewer is what I would
> expect, i.e. the EditPart of the child. However, in the SelectionAction it
> is just the diagram's EditPart, which means the action cannot do its job.
> What is the problem? The SelectionAction is properly registered as such.
>
>
Re: Different EditParts selected in GraphicalViewer and SelectionAction [message #196476 is a reply to message #195799] Wed, 21 September 2005 09:13 Go to previous messageGo to next message
Nicolai Guba is currently offline Nicolai GubaFriend
Messages: 8
Registered: July 2009
Junior Member
Pratik Shah wrote:

> So you've added that action to both the action registry and the list of
> selection actions? Does its update() method get called properly when the
> selection changes?

Ah. I seem to have a related problem. I also have a SelectionAction and I
initialized it as follows (in my GraphicalEditorWithFlyoutPalette)

IAction action = new RenameAction(this);
getActionRegistry().registerAction(action);
getSelectionActions().add(action.getId());

However, getSelection() inside my action always returns null. For eg

/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run()
{
System.out.println(getSelection());
super.run();
}

Prints null to the console.

I set a trace on the update method and noticed it never gets called.
Something escaped me but I am a bit lost as to what I forgot to make it
work.

Any pointers greatly appreciated :)

--
Nicolai Guba
+44.(0)151.282.3709
Sony Computer Entertainment Europe
http://www.scee.com
Re: Different EditParts selected in GraphicalViewer and SelectionAction [message #196540 is a reply to message #196476] Thu, 22 September 2005 19:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.unknown.com

In that case, does the selectionChanged() method in the GraphicalEditor ever
get called? Graphical editor adds itself as a selection listener in the
init() method, and it should be getting called whenever the seleciton
changes. If it's not being invoked, is your editor class overriding
GraphicalEditor#hookGraphicalViewer()?

"Nicolai Guba" <nicolai_guba@scee.net> wrote in message
news:1127294032.995532@joshua.ni.scee.sony.co.uk...
> Pratik Shah wrote:
>
> > So you've added that action to both the action registry and the list of
> > selection actions? Does its update() method get called properly when
the
> > selection changes?
>
> Ah. I seem to have a related problem. I also have a SelectionAction and
I
> initialized it as follows (in my GraphicalEditorWithFlyoutPalette)
>
> IAction action = new RenameAction(this);
> getActionRegistry().registerAction(action);
> getSelectionActions().add(action.getId());
>
> However, getSelection() inside my action always returns null. For eg
>
> /**
> * @see org.eclipse.jface.action.Action#run()
> */
> @Override
> public void run()
> {
> System.out.println(getSelection());
> super.run();
> }
>
> Prints null to the console.
>
> I set a trace on the update method and noticed it never gets called.
> Something escaped me but I am a bit lost as to what I forgot to make it
> work.
>
> Any pointers greatly appreciated :)
>
> --
> Nicolai Guba
> +44.(0)151.282.3709
> Sony Computer Entertainment Europe
> http://www.scee.com
Re: Different EditParts selected in GraphicalViewer and SelectionAction [message #196598 is a reply to message #196540] Fri, 23 September 2005 09:46 Go to previous messageGo to next message
Nicolai Guba is currently offline Nicolai GubaFriend
Messages: 8
Registered: July 2009
Junior Member
Pratik Shah wrote:

> In that case, does the selectionChanged() method in the GraphicalEditor
> ever
> get called? Graphical editor adds itself as a selection listener in the
> init() method, and it should be getting called whenever the seleciton
> changes. If it's not being invoked, is your editor class overriding
> GraphicalEditor#hookGraphicalViewer()?

o_O thank you for coming up with possible troublespots. I'll definitively
give it a good looking into.

I forgot to mention that I started off with a MultiPageEditor... Humbly, I
reverted that to a simple editor and presto, selections work.

Admittedly, I am not a pro at using the eclipse api (yet). I am currently
evaluating it to see whether we cannot use its frameworks to engineer the
tools helping us making the next generation of (PS3) games...

Hmpf, guess I need to dig a little deeper to find out how to hook the
GraphicalEditor into a MultiPageEditor....

--
Nicolai Guba
+44.(0)151.282.3709
Sony Computer Entertainment Europe
http://www.scee.com
Re: Different EditParts selected in GraphicalViewer and SelectionAction [message #196688 is a reply to message #196598] Fri, 23 September 2005 18:24 Go to previous message
Eclipse UserFriend
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl

Nicolai Guba wrote:
> I forgot to mention that I started off with a MultiPageEditor... Humbly, I
> reverted that to a simple editor and presto, selections work.

I ran into exactly the same problem a while ago. Please see:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=107703

Regards,

Martijn.
Previous Topic:mutlisectional report
Next Topic:How to create a DirectEditManager using ComboBoxCellEditor in GEF?
Goto Forum:
  


Current Time: Fri Apr 26 02:53:53 GMT 2024

Powered by FUDForum. Page generated in 0.04066 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top