Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Are Gallery Items adaptable?(Adapting Gallery Items to other objects.)
Are Gallery Items adaptable? [message #549910] Wed, 28 July 2010 12:46 Go to next message
Rick Vaughan is currently offline Rick VaughanFriend
Messages: 4
Registered: July 2010
Junior Member
I am just wondering if it is possible to adapt a gallery item to another type.

Here are snippets from my implementation.

I have set breakpoints in all of these methods and do not get into any them when debugging. I am working from examples in other portions of our product which do work, so am kind of perplexed as to what I might have wrong (if anything). Or if this is even supported by the Gallery.

in my plugin.xml file

<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="com.xxx.yyy.results.ResultsGalleryItem"
class="com.xxx.yyy.results.ResultsGalleryItemAdapterFactory ">
<adapter type="com.xxx.yyy.results.RG"/>
</factory>
</extension>

AdapterFactory class

public class ResultsGalleryItemAdapterFactory implements IAdapterFactory
{
public Object getAdapter( Object adaptableObject, Class adapterType )
{
if ( adapterType.equals(com.xxx.yyy.results.RG.class) )
{
if ( adaptableObject instanceof ResultsGalleryItem )
{
ResultsGalleryItem t = ( ResultsGalleryItem )adaptableObject;
return t.getAdapter(adapterType);
}
}

return null;
}

public Class[] getAdapterList()
{
return new Class[] { com.xxx.yyy.results.RG.class };
}
}

In ResultsGalleryItem, which implements IAdaptable

public Object getAdapter(Class adapter) {
if( (com.xxx.yyy.results.RG)getData() != null
&& adapter.isAssignableFrom( com.xxx.yyy.results.RG.class ) )
{
return getData();
}

return null;
}


Re: Are Gallery Items adaptable? [message #553631 is a reply to message #549910] Wed, 18 August 2010 09:09 Go to previous message
Nicolas Richeton is currently offline Nicolas RichetonFriend
Messages: 179
Registered: July 2009
Senior Member
Hi Rick,

Gallery is an SWT component so it does not use classes from RCP :
GalleryItem does not implement IAdaptable.

You can still attach your own adaptable objects to GalleryItems using
setData() / getData().

--
Nicolas


Le 28/07/10 14:46, Rick Vaughan a écrit :
> I am just wondering if it is possible to adapt a gallery item to another
> type.
> Here are snippets from my implementation.
>
> I have set breakpoints in all of these methods and do not get into any
> them when debugging. I am working from examples in other portions of our
> product which do work, so am kind of perplexed as to what I might have
> wrong (if anything). Or if this is even supported by the Gallery.
>
> in my plugin.xml file
>
> <extension
> point="org.eclipse.core.runtime.adapters">
> <factory
> adaptableType="com.xxx.yyy.results.ResultsGalleryItem"
> class="com.xxx.yyy.results.ResultsGalleryItemAdapterFactory ">
> <adapter type="com.xxx.yyy.results.RG"/>
> </factory>
> </extension>
>
> AdapterFactory class
>
> public class ResultsGalleryItemAdapterFactory implements IAdapterFactory
> {
> public Object getAdapter( Object adaptableObject, Class adapterType )
> {
> if ( adapterType.equals(com.xxx.yyy.results.RG.class) )
> {
> if ( adaptableObject instanceof ResultsGalleryItem )
> {
> ResultsGalleryItem t = ( ResultsGalleryItem )adaptableObject;
> return t.getAdapter(adapterType);
> }
> }
>
> return null;
> }
>
> public Class[] getAdapterList()
> {
> return new Class[] { com.xxx.yyy.results.RG.class };
> }
> }
>
> In ResultsGalleryItem, which implements IAdaptable
>
> public Object getAdapter(Class adapter) {
> if( (com.xxx.yyy.results.RG)getData() != null
> && adapter.isAssignableFrom( com.xxx.yyy.results.RG.class ) )
> {
> return getData();
> }
>
> return null;
> }
>
>
>
Previous Topic:[Paperclips] is possible a Print composed by a TextPrint and GridPrint
Next Topic:Are Gallery Items adaptable?
Goto Forum:
  


Current Time: Fri Apr 19 21:23:32 GMT 2024

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

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

Back to the top