getSelection() returns null [message #325896] |
Sun, 02 March 2008 00:55 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.49873 seconds