Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » palette entry creation trouble
palette entry creation trouble [message #151921] Fri, 24 September 2004 12:40 Go to next message
Eclipse UserFriend
Originally posted by: jojo.virtutech.se

Hi!

I'm wondering how the 'template' and 'factory' parameters of the
CombinedTemplateCreationEntry class constructor interact. I'm trying to
create a number of such palette entries which are supposed to create
objects in the data model of the same class but I need to be able to pass
parameters to them.

I have, say, a list of names

String[] names = { "joe", "alice", "bob" }

and I want to create a CombinedTemplateCreationEntry for each of these. I
don't want to have a separate class for each of the entries (I don't know
them on beforehand), but I want to pass the name to the data model as a
parameter.

How to I accomplish this?
Re: palette entry creation trouble [message #151935 is a reply to message #151921] Fri, 24 September 2004 15:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

To do this all you need to do is extend CreationFactory and allow it to
accept parameters. So when you instanciate your creation factory pass in
the string ( or what ever ). In the extension you will also want to
over-ride the getNewObject() method and teach it now to create the
correct model object....depending on the parameters you gave it when you
instanciated it.

When you create the CombinedTemplateCreationEntry instance for the
palette entry, give it your CreationFactory instance.

Guy.


Jesper Eskilson wrote:
> Hi!
>
> I'm wondering how the 'template' and 'factory' parameters of the
> CombinedTemplateCreationEntry class constructor interact. I'm trying to
> create a number of such palette entries which are supposed to create
> objects in the data model of the same class but I need to be able to pass
> parameters to them.
>
> I have, say, a list of names
>
> String[] names = { "joe", "alice", "bob" }
>
> and I want to create a CombinedTemplateCreationEntry for each of these. I
> don't want to have a separate class for each of the entries (I don't know
> them on beforehand), but I want to pass the name to the data model as a
> parameter.
>
> How to I accomplish this?
>
>
Re: palette entry creation trouble [message #151945 is a reply to message #151921] Fri, 24 September 2004 15:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

A template can be anything, including a creation factory if you want.

"Jesper Eskilson" <jojo@virtutech.se> wrote in message
news:cj14j6$ft9$1@eclipse.org...
> Hi!
>
> I'm wondering how the 'template' and 'factory' parameters of the
> CombinedTemplateCreationEntry class constructor interact. I'm trying to
> create a number of such palette entries which are supposed to create
> objects in the data model of the same class but I need to be able to pass
> parameters to them.
>
> I have, say, a list of names
>
> String[] names = { "joe", "alice", "bob" }
>
> and I want to create a CombinedTemplateCreationEntry for each of these. I
> don't want to have a separate class for each of the entries (I don't know
> them on beforehand), but I want to pass the name to the data model as a
> parameter.
>
> How to I accomplish this?
>
>
Re: palette entry creation trouble [message #152470 is a reply to message #151945] Thu, 30 September 2004 13:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jojo.virtutech.se

Randy Hudson wrote:

> A template can be anything, including a creation factory if you want.

Yes, but what do you do with the template? How do you use it if you
subclass your own CreationFactory?

/Jesper
Re: palette entry creation trouble [message #152487 is a reply to message #152470] Thu, 30 September 2004 19:03 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

The template is used by the Template Drop target listener. Similar to the
creation tool, it will turn a native drop into a CreateRequest.

"Jesper Eskilson" <jojo@virtutech.se> wrote in message
news:cjh1r0$pi6$1@eclipse.org...
> Randy Hudson wrote:
>
> > A template can be anything, including a creation factory if you want.
>
> Yes, but what do you do with the template? How do you use it if you
> subclass your own CreationFactory?
>
> /Jesper
>
>
Previous Topic:problems trying to use org.eclipse.gef.ui.parts.TreeViewer in the simplest way
Next Topic:Refresh Edit parts
Goto Forum:
  


Current Time: Fri Apr 19 20:44:19 GMT 2024

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

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

Back to the top