Hi Daniele.
May be implementation of buttons "Manage configuration" or
"Build Project"
can be a sample for you ?
They are implemented in classes:
org.eclipse.cdt.ui.actions.ChangeBuildConfigMenuAction
org.eclipse.cdt.ui.actions.BuildActiveConfigMenuAction
They are referred from
"org.eclipse.cdt.ui/plugin.xml"
How do they obtain selected project
?
Both of mentioned classes implement IWorkbenchWindowPulldownDelegate2 interface.
In particular, the method "selectionChanged(...)" is called when user changes
selection
in Project Explorer. Normally, our code should scan all
objects contained in selection.
Further actions may depend on situation. For example, we
can save refs to all objects
of required class (IProject) and ignore all others. Or, if
unwanted object(s) selection
detected, disable your action at all ( action.setEnabled(false); )
When user presses your button, "run()" method can use a
list of projects prepared
by last-called "selectionChanged(...)"
to perform required actions.
----------------------------------- With best regards, Oleg
Krasilnikov
Greetings,
I am trying to extend the cdt plugin
with a new button: when the user clicks on this button there starts a process
which updates some files of a project. However I would like to know which
project is selected in the Project Explorer so I can update only the files of
the chosen project. If I make this process via external tool I can use the
environment variable ${project_name}: is there a way I can find the same
information via Java code?
Thanks in
advance,
Daniele
Palmas
--------------------------------------------------------------------
Closed Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
|