Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » getSelection() returns null
getSelection() returns null [message #325896] Sun, 02 March 2008 00:55 Go to next message
Eclipse UserFriend
Hi All!

I have some problems with the getSelection() method of the
AbstractPropertySection class:

I have a MultiPage Editor consisting of a GMF based editor and a TextEditor.
Furthermore I'm using the a PropertyPage consisting of multiple
PropertySheets/Sections.

When I select an element in my GMF graph I'm using the following code in the
PropertySheet that appears as default when selecting such an element in the
graph:

StructuredSelection selection = (StructuredSelection) getSelection();
StateEditPart stateEditPart = (StateEditPart) selection.getFirstElement();
State semanticObject = (State) ((Node)
stateEditPart.getModel()).getElement();

This snippet is woking without any problem, but only in the default
PropertySheet (appearing automatically when selecting a "State" element in
my GMF graph).

Whenever I select another PropertySheet in the PropertiesView (I'm using the
above code in all my PropertySheets) the getSe
Re: getSelection() returns null [message #325901 is a reply to message #325896] Sun, 02 March 2008 13:26 Go to previous message
Eclipse UserFriend
I found my fault... i didnt thought about using the SelectionProvider and
retrieving the current selection in the editor directly from the editor ;-)
Now it's working...

Sorry for the inconvenience

Markus

"Markus Gieser" <markus.gieser@googlemail.com> schrieb im Newsbeitrag
news:fqctta$o7o$1@build.eclipse.org...
> Hi All!
>
> I have some problems with the getSelection() method of the
> AbstractPropertySection class:
>
> I have a MultiPage Editor consisting of a GMF based editor and a
> TextEditor. Furthermore I'm using the a PropertyPage consisting of
> multiple PropertySheets/Sections.
>
> When I select an element in my GMF graph I'm using the following code in
> the PropertySheet that appears as default when selecting such an element
> in the graph:
>
> StructuredSelection selection = (StructuredSelection) getSelection();
> StateEditPart stateEditPart = (StateEditPart) selection.getFirstElement();
> State semanticObject = (State) ((Node)
> stateEditPart.getModel()).getElement();
>
> This snippet is woking without any problem, but only in the default
> PropertySheet (appearing automatically when selecting a "State" element in
> my GMF graph).
>
> Whenever I select another PropertySheet in the PropertiesView (I'm using
> the above code in all my PropertySheets) the getSe
Previous Topic:When to use Application with Equinox
Next Topic:ToolItems Width
Goto Forum:
  


Current Time: Wed Jul 17 23:23:24 GMT 2024

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

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

Back to the top