Wrong IJavaProject returned [message #1700874] |
Tue, 07 July 2015 15:21 |
Eclipse User |
|
|
|
I am creating Plugin project, that contributes a popup menu to Package Explorer.
When selecting class file (also within a jar) plugin should return the name of eclipse project to which the class belongs.
This is my code:
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
if(selection instanceof IStructuredSelection) {
Object element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof IClassFile){
IJavaProject jProject = ((IClassFile) element).getJavaProject();
IProject project = jProject.getProject();
System.out.println(project.getName());
//returns 'Proj1' and not 'Proj2'
}
}
An issue that I just encountered when I have multiple JAVA projects in workspace Proj1 and Proj2.
Both have the JRE System Library in their build_path.
when I open ,first, Proj2 in Package Explorer and select a class in rt.jar within JRE lib, I am getting 'Proj2'
Then, I open Proj1 in Package Explorer and also select any class file in rt.jar (or any other jar) within JRE lib, I am getting also 'Proj2' and no 'Proj1'
Is it a bug?
|
|
|
Powered by
FUDForum. Page generated in 0.03575 seconds