Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Wrong IJavaProject returned
Wrong IJavaProject returned [message #1700874] Tue, 07 July 2015 15:21
Eclipse UserFriend
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?
Previous Topic:Unable to Run Database App
Next Topic:Bug 470977: Formatter Removes Space between Assert and Unary
Goto Forum:
  


Current Time: Sun Apr 20 10:12:32 EDT 2025

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

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

Back to the top