Where to find the IServiceConstants? [message #1004630] |
Wed, 23 January 2013 15:14 |
Eclipse User |
|
|
|
Hello,
in almost each tutorial the annotation
@Named(IServiceConstants.ACTIVE_SELECTION) Some thing is described. But
where can I find the IServiceConstants? Which plugin contains this
interface and what feature to install?
best regards,
Gilbert
|
|
|
|
|
|
|
|
Re: Where to find the IServiceConstants? [message #1004981 is a reply to message #1004640] |
Thu, 24 January 2013 09:03 |
Eclipse User |
|
|
|
Ok, I added the dependency to org.eclipse.e4.ui.services and now I can
access the IServiceConstants. More interesting, after adding the
dependency the IServiceConstants are listed when pressing CTRL + SHFT +
T. Thanks to all.
best regards,
Gilbert
Christoph Keimel wrote:
> Hi Gilbert,
>
> IServiceConstants is in the org.eclipse.e4.ui.services plugin. But I
> don't know which feature to use for a pure e4 application ... but would
> also be interessted in the answer :).
>
> Hope that helps.
> Christoph
|
|
|
Re: Where to find the IServiceConstants? [message #1004988 is a reply to message #1004981] |
Thu, 24 January 2013 09:11 |
Eclipse User |
|
|
|
One last question: how do I inject the active selection when
right-clicking in the Ecore diagram editor (or in an GMF editor in
general)? I tried this what always results in an null object:
@Execute
public void execute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION)
IGraphicalEditPart editPart){
// do something)
}
|
|
|
Re: Where to find the IServiceConstants? [message #1004999 is a reply to message #1004988] |
Thu, 24 January 2013 09:39 |
Eclipse User |
|
|
|
Ok I got it:
@Execute
public void execute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION)
StructuredSelection structuredSelection){
// do something)
if(!structuredSelection.isEmpty()){
Object selectedElement = structuredSelection.getFirstElement();
if(selectedElement instanceof IGraphicalEditPart){
// do something
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02881 seconds