Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Wrong IJavaProject returned
Wrong IJavaProject returned [message #1700874] Tue, 07 July 2015 19:21
ehud Tirmean is currently offline ehud TirmeanFriend
Messages: 1
Registered: July 2015
Junior Member
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:Lắp Mạng Internet fPT Long Biên Siêu Rẻ
Next Topic:Bug 470977: Formatter Removes Space between Assert and Unary
Goto Forum:
  


Current Time: Tue Feb 20 11:17:24 GMT 2018

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

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