Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » [newbie] Accessing selected file
[newbie] Accessing selected file [message #42284] Sun, 25 January 2009 10:53 Go to next message
Eclipse UserFriend
Hi all. I'm trying to develop my first plug-in using the "pop-up"
template: when the user right-clicks a file (call it afile.xyz), a message
box is displayed. Now, I'd like to read the content of afile.xyz from
within the plug-in, so when the action is fired I can access the content
of the file: can you give me any hints on how to do that?
Thank you in advance :)
Armando.
Re: [newbie] Accessing selected file [message #42433 is a reply to message #42284] Mon, 26 January 2009 04:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi Armando,

You should take a look at Eclipse Selection Service here:

http://www.eclipse.org/articles/Article-WorkbenchSelections/ article.html

To sum up, you will need to add a Selection listener in your workbench's
project explorer view OR to get the current selection when you contextual
menu is opened, and you 'll be able to retrieve the IFile object
corresponding to this current selection.

Hope this can help

Manuel
Re: [newbie] Accessing selected file [message #42464 is a reply to message #42284] Mon, 26 January 2009 04:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: szchaler.acm.org

Hi,

I typically just save the selection in the action's selectionChanged()
method.

Steffen

Armando wrote:
> Hi all. I'm trying to develop my first plug-in using the "pop-up"
> template: when the user right-clicks a file (call it afile.xyz), a
> message box is displayed. Now, I'd like to read the content of
> afile.xyz from within the plug-in, so when the action is fired I can
> access the content of the file: can you give me any hints on how to do
> that?
> Thank you in advance :)
> Armando.
>

--
Dr. rer. nat. Steffen Zschaler
Senior Research Associate

Lancaster University
Lancaster, United Kingdom

Email szschaler@acm.org
Phone +44 (01524) 510354
WWW http://www.steffen-zschaler.de/

--
Consider submitting to ECMDA-FA 2009, the 5th European Conference on
Model-Driven Architecture Foundations and Applications.
http://www.ecmda-fa.org/

Consider submitting to QoSA 2009, the 5th International Conference on
the Quality of Software-Architectures.
http://qosa.ipd.uka.de/

Consider submitting to MiSE 2009, the 3rd International Workshop on
Models in Software Engineering
http://wikiserver.sse.cs.tu-bs.de/mise09
Re: [newbie] Accessing selected file [message #42495 is a reply to message #42284] Mon, 26 January 2009 06:56 Go to previous message
Eclipse UserFriend
Thanks Manuel and Steffen, surely your suggestion will be quite useful!
Ciao.
Armando.
Re: [newbie] Accessing selected file [message #590489 is a reply to message #42284] Mon, 26 January 2009 04:26 Go to previous message
Eclipse UserFriend
Hi Armando,

You should take a look at Eclipse Selection Service here:

http://www.eclipse.org/articles/Article-WorkbenchSelections/ article.html

To sum up, you will need to add a Selection listener in your workbench's
project explorer view OR to get the current selection when you contextual
menu is opened, and you 'll be able to retrieve the IFile object
corresponding to this current selection.

Hope this can help

Manuel
Re: [newbie] Accessing selected file [message #590513 is a reply to message #42284] Mon, 26 January 2009 04:39 Go to previous message
Eclipse UserFriend
Hi,

I typically just save the selection in the action's selectionChanged()
method.

Steffen

Armando wrote:
> Hi all. I'm trying to develop my first plug-in using the "pop-up"
> template: when the user right-clicks a file (call it afile.xyz), a
> message box is displayed. Now, I'd like to read the content of
> afile.xyz from within the plug-in, so when the action is fired I can
> access the content of the file: can you give me any hints on how to do
> that?
> Thank you in advance :)
> Armando.
>

--
Dr. rer. nat. Steffen Zschaler
Senior Research Associate

Lancaster University
Lancaster, United Kingdom

Email szschaler@acm.org
Phone +44 (01524) 510354
WWW http://www.steffen-zschaler.de/

--
Consider submitting to ECMDA-FA 2009, the 5th European Conference on
Model-Driven Architecture Foundations and Applications.
http://www.ecmda-fa.org/

Consider submitting to QoSA 2009, the 5th International Conference on
the Quality of Software-Architectures.
http://qosa.ipd.uka.de/

Consider submitting to MiSE 2009, the 3rd International Workshop on
Models in Software Engineering
http://wikiserver.sse.cs.tu-bs.de/mise09
Re: [newbie] Accessing selected file [message #590525 is a reply to message #42284] Mon, 26 January 2009 06:56 Go to previous message
Eclipse UserFriend
Thanks Manuel and Steffen, surely your suggestion will be quite useful!
Ciao.
Armando.
Previous Topic:PDE build fails with optional dependencies
Next Topic:Product export uses wrong bundle version
Goto Forum:
  


Current Time: Tue Jul 15 02:21:50 EDT 2025

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

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

Back to the top