Adding an Action to the Navigator View [message #466236] |
Thu, 05 January 2006 04:58  |
Eclipse User |
|
|
|
I made a "org.eclipse.ui.popupMenus extension" to the Navigator view.
The item menu appears well, and the action is executed on the chosen IFile
of the view.
BUT: i can't get the absolute java.io.file from it using the usual way: the
device is missing at the beginning.
Any hep appreciated,
merci
nicolas.
public class Execute implements org.eclipse.ui.IObjectActionDelegate {
IAction fAction;
private IWorkbenchPart fView;
ISelection fSelection;
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
fAction = action;
fView = targetPart;
}
public void run(IAction action) {
Object selection = ((IStructuredSelection) fSelection).getFirstElement();
if(selection instanceof IFile) {
IFile is = (IFile)selection;
File s = new File(is.getFullPath().makeAbsolute().toOSString());
**** Here, s is \myPlugin\build\GenerateBuildFiles.lsp
instead of
E:\myPlugin\build\GenerateBuildFiles.lsp
....
}
public void selectionChanged(IAction action, ISelection selection) {
fAction = action;
fSelection = selection;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
id="com.digitalairways.ilisp.plugin.Execute"
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.lsp">
<action
id="com.digitalairways.ilisp.plugin.Execute"
class="com.digitalairways.ilisp.plugin.Execute"
label="Execute with iLisp"
icon="icons/exec.gif"
menubarPath="additions"
>
</action>
</objectContribution>
</extension>
</plugin>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04146 seconds