Getting list of selected files from ISelection [message #16854] |
Sun, 17 August 2008 17:03  |
Eclipse User |
|
|
|
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 #16907 is a reply to message #16877] |
Sun, 17 August 2008 18:34  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03813 seconds