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.
Source: stackoverflow.com
Related Query
- Eclipse Plugin: Find location of selected project
- I need to find out the location of the error in the code by eclipse Imarker in jdt plugin
- How to find path of current selected project in eclipse plug-in
- How to find the execution steps of an Eclipse plugin project
- Move the files from the project folder and compile from new location using Eclipse Plugin
- GWT plugin - Eclipse Kepler 4.3 - cannot find toolbar button as "create a Java project with GWT support"
- How to create a project from existing source in Eclipse and then find it?
- Find methods calls in Eclipse project
- "Unable to find main class" with Maven on spring-boot project in Eclipse
- Eclipse change project files location
- Find unused classes in a Java Eclipse project
- Eclipse import project error, overlaps workspace location
- Running Gradle project via Eclipse errors "system Cannot find System Java Compiler"
- Restore maven plugin for a project on eclipse
- Where can I find the source code for the Android Development Tools (ADT) plugin for the Eclipse IDE?
- Eclipse Plugin and ADT modification for API Integration in Create Project menu
- How to get the selected node in the package explorer from an Eclipse plugin
- How to quickly find the main() in java project using eclipse ?
- How do I configure Eclipse to launch a browser when Run or Debug is selected using Pydev plugin
- Eclipse Plugin: how to get the path to the currently selected project
- Debug eclipse plugin project -- PermGen space, out of memory error
- Changing the Resource Location of an existing Eclipse project
- Where to find design patterns, best practices for Eclipse plugin development
- When to choose "Generate an activator..." when creating a new Eclipse plugin project
- Google Plugin not working for App Engine project - Eclipse Indigo - WindowsXP
- Eclipse plugin to find out unused methods in a class/package
- Eclipse Plugin project with other project dependencies
- SDK location not found. ANDROID_HOME - building a gradle project in eclipse on a MAC
- Finding the Eclipse Project file location
- Can't run Eclipse project - can't find API database
More Query from same tag
- How to create appengine flexible runtime in eclipse?
- Eclipse RCP Obfuscation
- Get rid of duplicate lines in try/catch statement
- How to request permissions during run time when using Gluon mobile environment?
- Can I sort the tabs in Eclipse alphabetically?
- How to integrate PyQt designer in Eclipse?
- Java TestPassByvalue
- ctrl click class in Eclipse shows binary / jar instead of source
- Project is missing required library - but correct JAR exists?
- Run a local command before starting eclipse debugging
- How to Load external .class file in Java?
- Trying to make an auto complete program but it is not working
- Directory structure for using git with Eclipse
- How to display an image with use of jar file in Android?
- Eclipse Kepler crashes regularly on Ubuntu 13.10
- Where to place a file within a Java Web Project?
- Eclipse getting too slow - workspace recreation helped
- Problem with conditionally hiding rows of a grid in generated PDF reports
- Build process in eclipse
- Type 'uint32_t' could not be resolved
- eclipse android emulator buttons don't work
- How to resolve binding of IMethod in JDT
- Sizing in Android layouts?
- proguard cant find javax.servlet
- how do I add classpath to the exported runnable java .jar file using eclipse
- Eclipse, How to add all dependencies of one project to another
- Using android library project, with multiple src / res folders?
- Relative Path for pom.xml with only a single pom.xml present
- how to assign XML tag to a string variable
- JFrame Issue: Syntax error on token "setDefaultCloseOperation"