Reputation: 16736
I am developing an Ant task that runs inside an Eclipse workbench.
The Ant task needs to complete a simple mission: closing and reopening a project.
However, the following code:
IProject project = ...;
project.close(null);
project.open(null);
Doesn't seem to have exactly the same outcome as closing a project and re-opening it using the UI.
It seems to me that the UI operation of "opening a project" consists of more than just calling project.open()
; something along the the lines of calling plugins that "respond" to the project's open()
call.
Is there a convenient way to imitate Eclipse's UI functionality of opening a project? I reckon that this code has to be encapsulated somewhere, but looking through Eclipse's vast source code doesn't seem to reveal much.
EDIT background:
I am actually using Rational Application Developer (v9). I am using the projectSetImport
Ant task to import existing projects from the filesystem into the workbench. These projects are a part of Git repository. What I noticed is that, once the projects are imported into the workspace, the EGit functionality isn't available on these projects unless I close the projects and reopen them (through the UI).
Upvotes: 0
Views: 47
Reputation: 111142
The Project Open GUI code does not do much more than call IProject.open
, it does use a progress monitor and an IWorkspaceRunnable
- which will change the way resource change events are generated slightly.
The code is org.eclipse.jdt.ui.actions.OpenProjectAction
- particularly the internalRun
method.
Upvotes: 1