Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Multiple creation factories for tool palette entries
Multiple creation factories for tool palette entries [message #139306] Tue, 22 June 2004 14:16 Go to next message
Eclipse User
Originally posted by: invalid.soft-gems.net

Hi all,

In my GEF editor I have a palette with a couple of tool entries created as
CombinedTemplateCreationEntry, which take a creation factory to create a
new instance of the tool each time the user selects the tool entry.

Unfortunately, due to restrictions for my application I have to use one
tool for two different actual target classes. The character of the target
class depends on the container it is placed in. My problem is now that the
new tool element is created already when the tool palette is clicked on
and does not change anymore when the mouse pointer is dragged arround.

I can fake one type to be the other one to have the drag operation
accepted and would need to create the other type whenever my create
command is created and I have this special case. However this seems like a
ugly hack to me and I would rather tell during the drag (or at least after
the drop) operation, which element I really need.

Can somebody help to solve that problem?

Mike
Re: Multiple creation factories for tool palette entries [message #139358 is a reply to message #139306] Tue, 22 June 2004 15:23 Go to previous messageGo to next message
Eclipse User
Originally posted by: none.us.ibm.com

Get the factory from the CreateRequest, and flip a switch on it based on
what you need to create.

"Mike Lischke" <invalid@soft-gems.net> wrote in message
news:cb9evp$o5s$1@eclipse.org...
> Hi all,
>
> In my GEF editor I have a palette with a couple of tool entries created as
> CombinedTemplateCreationEntry, which take a creation factory to create a
> new instance of the tool each time the user selects the tool entry.
>
> Unfortunately, due to restrictions for my application I have to use one
> tool for two different actual target classes. The character of the target
> class depends on the container it is placed in. My problem is now that the
> new tool element is created already when the tool palette is clicked on
> and does not change anymore when the mouse pointer is dragged arround.
>
> I can fake one type to be the other one to have the drag operation
> accepted and would need to create the other type whenever my create
> command is created and I have this special case. However this seems like a
> ugly hack to me and I would rather tell during the drag (or at least after
> the drop) operation, which element I really need.
>
> Can somebody help to solve that problem?
>
> Mike
>
Re: Multiple creation factories for tool palette entries [message #139569 is a reply to message #139358] Wed, 23 June 2004 06:18 Go to previous messageGo to next message
Eclipse User
Originally posted by: invalid.soft-gems.net

Randy Hudson wrote:

> Get the factory from the CreateRequest, and flip a switch on it based on
> what you need to create.

This is so simple, I should have seen that already ...

Thank you Randy.

Mike
--
www.soft-gems.net
Re: Multiple creation factories for tool palette entries [message #139580 is a reply to message #139358] Wed, 23 June 2004 06:21 Go to previous messageGo to next message
Eclipse User
Originally posted by: invalid.soft-gems.net

Randy Hudson wrote:

> Get the factory from the CreateRequest, and flip a switch on it based on
> what you need to create.

I should mention, though, that getFactory() protected is, while setFactory
is public. I wonder how I am supposed to access the factory. Why is the
getter protected?

Mike
--
www.soft-gems.net
Re: Multiple creation factories for tool palette entries [message #139647 is a reply to message #139580] Wed, 23 June 2004 14:20 Go to previous message
Eclipse User
Originally posted by: none.us.ibm.com

You'll have to promote it in a subclass. There is concern with accessing
the factory directly because each EditPolicy could get the factory, and ask
it to create a new object. This pattern fails when 2 or more editpolicies
need to contribute to a command during creation. If they both obtain a new
object, they will not be acting on the same object. But, if they use the
CreateRequest, the object is created once and cached by the request.

Can you use setFactory? Or will the tool overwrite your change?

"Mike Lischke" <invalid@soft-gems.net> wrote in message
news:cbb7ge$4e0$1@eclipse.org...
> Randy Hudson wrote:
>
> > Get the factory from the CreateRequest, and flip a switch on it based on
> > what you need to create.
>
> I should mention, though, that getFactory() protected is, while setFactory
> is public. I wonder how I am supposed to access the factory. Why is the
> getter protected?
>
> Mike
> --
> www.soft-gems.net
>
Previous Topic:test
Next Topic:MarqueeSelectionTool
Goto Forum:
  


Current Time: Fri Oct 31 18:03:36 GMT 2014

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

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