score:1

eclipse doesn't really have a notion of a 'current project'. there is a current selection in each view but most views don't save the selection between sessions.

in an editor you probably want the project that the file you are current editing belongs to. in the editor you can use something like:

ieditorinput editorinput = geteditorinput();

ifile file = (ifile)editorinput.getadapter(ifile.class);

iproject project = file.getproject();

note: file might be null if you are editing a file which is not in the workspace. you don't need the (ifile) cast on the most recent versions of eclipse.


Related Query

More Query from same tag