Greetings,
I have a
different behavior in Linux and Windows for the following piece of code:
protected void
sampleGetSelectedProject() {
ISelectionService ss=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
String projExpID = "org.eclipse.ui.navigator.ProjectExplorer";
ISelection sel = ss.getSelection(projExpID);
Object selectedObject=sel;
if(sel instanceof IStructuredSelection) {
selectedObject=((IStructuredSelection)sel).getFirstElement();
}
if (selectedObject instanceof IAdaptable) {
IResource res = (IResource)
((IAdaptable) selectedObject).getAdapter(IResource.class);
IProject project = res.getProject();
MessageDialog.openInformation(
window.getShell(),
project.getName(),
project.getName());
}
}
In Windows the function correctly works, while in Linux there shows the
following message box:
“The chosen operation is not currently available”
Eclipse version and the cdt version are the same in Linux and Windows.
Any hint about this strange behavior?
Thanks in advance,
Daniele Palmas