Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Getting list of selected files from ISelection
Getting list of selected files from ISelection [message #16854] Sun, 17 August 2008 17:03 Go to next message
Eclipse UserFriend
Originally posted by: nick.allen.onlinehome.de

Hi,

This may be another simple question but I could not find the answer
after searching the newsgroups.

I want to get the set of selected files from an ISelection object. As
long as the user clicks on a file in the browser (that is not a java
source file, project, package but just a text file) then the selection
contains an IFile object and this is easy. When a Java project is
selected though I don't have an IFile and am not sure how to get it. I
don't want to add special code for every kind of object that can be
selected in Eclipse (this is probably infinite because of the plugin
mechanism anyway) in order to find the file from that object either. Is
there a generic way to get an IFile from a selected object?

Thanks,

Nicholas Allen
Re: Getting list of selected files from ISelection [message #16877 is a reply to message #16854] Sun, 17 August 2008 17:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nick.allen.onlinehome.de

I found the answer to this one. I need to use the IAdaptable interface.

Cheers,

Nick

Nicholas Allen wrote:
> Hi,
>
> This may be another simple question but I could not find the answer
> after searching the newsgroups.
>
> I want to get the set of selected files from an ISelection object. As
> long as the user clicks on a file in the browser (that is not a java
> source file, project, package but just a text file) then the selection
> contains an IFile object and this is easy. When a Java project is
> selected though I don't have an IFile and am not sure how to get it. I
> don't want to add special code for every kind of object that can be
> selected in Eclipse (this is probably infinite because of the plugin
> mechanism anyway) in order to find the file from that object either. Is
> there a generic way to get an IFile from a selected object?
>
> Thanks,
>
> Nicholas Allen
Re: Getting list of selected files from ISelection [message #16907 is a reply to message #16877] Sun, 17 August 2008 18:34 Go to previous message
Eclipse UserFriend
I've read that we shouldn't use the Adaptable interface but rather should
declare an AdapterFactory extension. It achieves the same thing but
doesn't pollute the domain model.

On Sun, 17 Aug 2008 23:11:33 +0200, Nicholas Allen wrote:

> I found the answer to this one. I need to use the IAdaptable interface.
>
> Cheers,
>
> Nick
>
> Nicholas Allen wrote:
>> Hi,
>>
>> This may be another simple question but I could not find the answer
>> after searching the newsgroups.
>>
>> I want to get the set of selected files from an ISelection object. As
>> long as the user clicks on a file in the browser (that is not a java
>> source file, project, package but just a text file) then the selection
>> contains an IFile object and this is easy. When a Java project is
>> selected though I don't have an IFile and am not sure how to get it. I
>> don't want to add special code for every kind of object that can be
>> selected in Eclipse (this is probably infinite because of the plugin
>> mechanism anyway) in order to find the file from that object either. Is
>> there a generic way to get an IFile from a selected object?
>>
>> Thanks,
>>
>> Nicholas Allen
Re: Getting list of selected files from ISelection [message #576632 is a reply to message #16854] Sun, 17 August 2008 17:11 Go to previous message
Eclipse UserFriend
I found the answer to this one. I need to use the IAdaptable interface.

Cheers,

Nick

Nicholas Allen wrote:
> Hi,
>
> This may be another simple question but I could not find the answer
> after searching the newsgroups.
>
> I want to get the set of selected files from an ISelection object. As
> long as the user clicks on a file in the browser (that is not a java
> source file, project, package but just a text file) then the selection
> contains an IFile object and this is easy. When a Java project is
> selected though I don't have an IFile and am not sure how to get it. I
> don't want to add special code for every kind of object that can be
> selected in Eclipse (this is probably infinite because of the plugin
> mechanism anyway) in order to find the file from that object either. Is
> there a generic way to get an IFile from a selected object?
>
> Thanks,
>
> Nicholas Allen
Re: Getting list of selected files from ISelection [message #576647 is a reply to message #16877] Sun, 17 August 2008 18:34 Go to previous message
Eclipse UserFriend
I've read that we shouldn't use the Adaptable interface but rather should
declare an AdapterFactory extension. It achieves the same thing but
doesn't pollute the domain model.

On Sun, 17 Aug 2008 23:11:33 +0200, Nicholas Allen wrote:

> I found the answer to this one. I need to use the IAdaptable interface.
>
> Cheers,
>
> Nick
>
> Nicholas Allen wrote:
>> Hi,
>>
>> This may be another simple question but I could not find the answer
>> after searching the newsgroups.
>>
>> I want to get the set of selected files from an ISelection object. As
>> long as the user clicks on a file in the browser (that is not a java
>> source file, project, package but just a text file) then the selection
>> contains an IFile object and this is easy. When a Java project is
>> selected though I don't have an IFile and am not sure how to get it. I
>> don't want to add special code for every kind of object that can be
>> selected in Eclipse (this is probably infinite because of the plugin
>> mechanism anyway) in order to find the file from that object either. Is
>> there a generic way to get an IFile from a selected object?
>>
>> Thanks,
>>
>> Nicholas Allen
Previous Topic:Getting list of selected files from ISelection
Next Topic:Project Explorer view does not show loaded project
Goto Forum:
  


Current Time: Sun Jun 08 13:19:14 EDT 2025

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

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

Back to the top