Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » get the URI of a file selected
get the URI of a file selected [message #481341] Thu, 20 August 2009 14:43 Go to next message
guenin is currently offline guenin
Messages: 42
Registered: July 2009
Member
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 #481345 is a reply to message #481341] Thu, 20 August 2009 14:48 Go to previous message
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 Go to previous message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 563
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

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 - Bonitasoft S.A.
My company Eclipse-related blog
Previous Topic:get the URI of a file selected
Next Topic:What is the proper way to change Java Compiler?
Goto Forum:
  


Current Time: Tue Sep 23 08:22:38 GMT 2014

Powered by FUDForum. Page generated in 0.01538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software