Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-core-dev] get IProject in a Wizard


This kind of question should be asked in the eclipse.platform newsgroup.  Or, you could consult the FAQ:

http://wiki.eclipse.org/index.php/FAQ_How_do_I_access_the_active_project%3F

John



Dennis Meyer <durchgedreht@xxxxxx>
Sent by: platform-core-dev-bounces@xxxxxxxxxxx

07/03/2007 03:51 AM

Please respond to
"Eclipse Platform Core component developers list."        <platform-core-dev@xxxxxxxxxxx>

To
platform-core-dev@xxxxxxxxxxx
cc
Subject
[platform-core-dev] get IProject in a Wizard





-----------------------------------
Sorry for posting this here, but the newsgroup did not deliver the information I need!
-----------------------------------

I got a wizard and want to get the corresponding IProject from StructuredSelection (or from whereever)


public static IProject getProject(IStructuredSelection select){
IProject out = null;
Object o = select.getFirstElement();
IResource resource = null;
if (obj instanceof IResource){
System.out.println("IResource");
resource = (IResource) obj;
}
if (obj instanceof IFile){
System.out.println("IFile");

if (obj instanceof IProject) {
System.out.println("IProject");

}
}
This works for Files + Folders in the resource explorer but not in the Java package explorer. There it only works for the file. I get some Inferfaces from the JDT (org.eclipse.jdt.internal.core.PackageFragment). I do not want to be dependent on what plugin (C++/Java) I develop as my wizard adds some XML functionality. So is there a way to get the IProject out of a wizard even in the Package Explorer?

Thank you very much,
Dennis
_______________________________________________
platform-core-dev mailing list
platform-core-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-core-dev


Back to the top