IStructuredSelection [message #8945] |
Thu, 21 May 2009 21:51 |
|
Hi,
I constantly find myself writing this code:
if (selection instanceof IStructuredSelection) {
if (((IStructuredSelection)
selection).getFirstElement().getClass().equals(clazz)) {
return ((IStructuredSelection) selection).getFirstElement();
}
}
Is there a utility class available for ISelection and subordinates?
Thanks in advance and best regards,
Wim Jongman
http://www.remainsoftware.com
http://www.industrial-tsi.com
|
|
|
|
Re: IStructuredSelection [message #9007 is a reply to message #8987] |
Fri, 22 May 2009 12:17 |
|
Hi Boris,
Thanks for your help. I already started a SelectionUtil class and if i'm
happy with it I wil do as you suggested. I'm curious about the e4 solution.
Have not seen e4 yet, but if I can find it I will give it a spin today.
--
Best Regards,
Wim Jongman
http://www.remainsoftware.com
http://www.industrial-tsi.com
"Boris Bokowski" <Boris_Bokowski@ca.ibm.com> wrote in message
news:gv4vo8$juq$1@build.eclipse.org...
> Hi Wim,
>
> Not that I know of. We have quite an elegant (IMO) solution in e4, but
> that probably does not count. ;-)
>
> A good first step towards a common solution is to build one yourself, in
> your code, that works for your use cases. Then, once you have enough
> confidence in the API, you could contribute it back through Bugzilla.
>
> Boris
>
> "Wim Jongman" <wim.jongman@remainsoftware.com> wrote in message
> news:gv4ick$7v0$1@build.eclipse.org...
>> Hi,
>>
>> I constantly find myself writing this code:
>>
>> if (selection instanceof IStructuredSelection) {
>> if (((IStructuredSelection)
>> selection).getFirstElement().getClass().equals(clazz)) {
>> return ((IStructuredSelection) selection).getFirstElement();
>> }
>> }
>>
>> Is there a utility class available for ISelection and subordinates?
>>
>> Thanks in advance and best regards,
>>
>> Wim Jongman
>> http://www.remainsoftware.com
>> http://www.industrial-tsi.com
>
>
|
|
|
Re: IStructuredSelection [message #9026 is a reply to message #9007] |
Fri, 22 May 2009 12:45 |
Boris Bokowski Messages: 272 Registered: July 2009 |
Senior Member |
|
|
Hi Wim,
The solution for this in e4 is maybe not that easy to find... have a look at
the class "ExifTable" which implements the view displaying Exif data for
images. The idea is that the code that unwraps a selection should be outside
of the views, all you do is implement a method setInput(DomainObject o),
which will be called when there is an "input" of that type available for the
view.
Boris
"Wim Jongman" <wim.jongman@remainsoftware.com> wrote in message
news:gv655h$elh$1@build.eclipse.org...
> Hi Boris,
>
> Thanks for your help. I already started a SelectionUtil class and if i'm
> happy with it I wil do as you suggested. I'm curious about the e4
> solution. Have not seen e4 yet, but if I can find it I will give it a spin
> today.
>
> --
> Best Regards,
>
> Wim Jongman
> http://www.remainsoftware.com
> http://www.industrial-tsi.com
>
>
> "Boris Bokowski" <Boris_Bokowski@ca.ibm.com> wrote in message
> news:gv4vo8$juq$1@build.eclipse.org...
>> Hi Wim,
>>
>> Not that I know of. We have quite an elegant (IMO) solution in e4, but
>> that probably does not count. ;-)
>>
>> A good first step towards a common solution is to build one yourself, in
>> your code, that works for your use cases. Then, once you have enough
>> confidence in the API, you could contribute it back through Bugzilla.
>>
>> Boris
>>
>> "Wim Jongman" <wim.jongman@remainsoftware.com> wrote in message
>> news:gv4ick$7v0$1@build.eclipse.org...
>>> Hi,
>>>
>>> I constantly find myself writing this code:
>>>
>>> if (selection instanceof IStructuredSelection) {
>>> if (((IStructuredSelection)
>>> selection).getFirstElement().getClass().equals(clazz)) {
>>> return ((IStructuredSelection) selection).getFirstElement();
>>> }
>>> }
>>>
>>> Is there a utility class available for ISelection and subordinates?
>>>
>>> Thanks in advance and best regards,
>>>
>>> Wim Jongman
>>> http://www.remainsoftware.com
>>> http://www.industrial-tsi.com
>>
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04163 seconds