get the URI of a file selected [message #481341] |
Thu, 20 August 2009 14:43 |
Eclipse User |
|
|
|
Hi,
Im new in plugin development. I would like to get the URI of the file
when I right click on it to do some operations with it.
I have created a plug in and an extension org.eclipse.ui.popupMenus with
the template popupMenu to define the context menu. I obtained the class
here under.
How it is possible, in the function run to get the URI of the file
selected?
Thank you for your Help
Aurelie
public class NewAction implements IObjectActionDelegate {
/**
* Constructor for Action1.
*/
public NewAction() {
super();
}
/**
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
Shell shell = new Shell();
MessageDialog.openInformation(
shell,
"Monplugin Plug-in",
"Verif Ordo was executed.");
}
/**
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
}
}
|
|
|
Re: get the URI of a file selected [message #481345 is a reply to message #481341] |
Thu, 20 August 2009 14:48 |
Eclipse User |
|
|
|
Originally posted by: aurelien.pupier.esial.net
You can get the selected element via the selection element in the method selectionChanged(generally take the first)
guenin a écrit :
> Hi,
>
> I�m new in plugin development. I would like to get the URI of the file
> when I right click on it to do some operations with it. I have created a
> plug in and an extension org.eclipse.ui.popupMenus with the template
> popupMenu to define the context menu. I obtained the class here under.
> How it is possible, in the function run to get the URI of the file
> selected?
> Thank you for your Help
>
> Aurelie
>
>
> public class NewAction implements IObjectActionDelegate {
>
> /**
> * Constructor for Action1.
> */
> public NewAction() {
> super();
> }
>
> /**
> * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
> */
> public void setActivePart(IAction action, IWorkbenchPart targetPart) {
> }
>
> /**
> * @see IActionDelegate#run(IAction)
> */
> public void run(IAction action) {
> Shell shell = new Shell();
> MessageDialog.openInformation(
> shell,
> "Monplugin Plug-in",
> "Verif Ordo was executed.");
> }
>
> /**
> * @see IActionDelegate#selectionChanged(IAction, ISelection)
> */
> public void selectionChanged(IAction action, ISelection selection) {
> }
>
>
> }
>
>
>
>
|
|
|
Re: get the URI of a file selected [message #600869 is a reply to message #481341] |
Thu, 20 August 2009 14:48 |
|
You can get the selected element via the selection element in the method selectionChanged(generally take the first)
guenin a écrit :
> Hi,
>
> I�m new in plugin development. I would like to get the URI of the file
> when I right click on it to do some operations with it. I have created a
> plug in and an extension org.eclipse.ui.popupMenus with the template
> popupMenu to define the context menu. I obtained the class here under.
> How it is possible, in the function run to get the URI of the file
> selected?
> Thank you for your Help
>
> Aurelie
>
>
> public class NewAction implements IObjectActionDelegate {
>
> /**
> * Constructor for Action1.
> */
> public NewAction() {
> super();
> }
>
> /**
> * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
> */
> public void setActivePart(IAction action, IWorkbenchPart targetPart) {
> }
>
> /**
> * @see IActionDelegate#run(IAction)
> */
> public void run(IAction action) {
> Shell shell = new Shell();
> MessageDialog.openInformation(
> shell,
> "Monplugin Plug-in",
> "Verif Ordo was executed.");
> }
>
> /**
> * @see IActionDelegate#selectionChanged(IAction, ISelection)
> */
> public void selectionChanged(IAction action, ISelection selection) {
> }
>
>
> }
>
>
>
>
Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
|
|
|
Powered by
FUDForum. Page generated in 0.03254 seconds