Skip to main content


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
Eclipse UserFriend
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 UserFriend
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
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
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 - Red Hat
Senior Software Engineer in Fuse Tooling team
Previous Topic:get the URI of a file selected
Next Topic:What is the proper way to change Java Compiler?
Goto Forum:
  


Current Time: Fri Mar 29 02:35:04 GMT 2024

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

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

Back to the top