Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » [newbie] Accessing selected file
[newbie] Accessing selected file [message #42284] Sun, 25 January 2009 15:53 Go to next message
Armando is currently offline ArmandoFriend
Messages: 12
Registered: July 2009
Junior Member
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 09:26 Go to previous messageGo to next message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
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 09: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 11:56 Go to previous message
Armando is currently offline ArmandoFriend
Messages: 12
Registered: July 2009
Junior Member
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 09:26 Go to previous message
Manuel Selva is currently offline Manuel SelvaFriend
Messages: 189
Registered: July 2009
Location: Grenoble, France
Senior Member
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 09:39 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
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 11:56 Go to previous message
Armando is currently offline ArmandoFriend
Messages: 12
Registered: July 2009
Junior Member
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: Fri Mar 29 01:02:52 GMT 2024

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

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

Back to the top