Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » CreationToolEntry and SimpleFactory
CreationToolEntry and SimpleFactory [message #143053] Fri, 16 July 2004 20:00 Go to next message
Eclipse UserFriend
Originally posted by: bandrews.bphnx.com

I have added a CreationToolEntry object to my PaletteGroup, like this:

control.add(new CreationToolEntry("Window",
"Create Window",
new SimpleFactory(WindowModel.class),
null,
null);

When I select this tool then click in the viewer, my execute() method of
my CreateCommand gets called, but nothing is drawn in the viewer.
I believe my createEditPart() method of the PartFactory is supposed to be
called by the framework somewhere in here, but where? It does not get
called at all. What could I be doing wrong?

Any help is very much appreciated as my hair is beginning to fall out!

thanks,

B
Re: CreationToolEntry and SimpleFactory [message #143063 is a reply to message #143053] Fri, 16 July 2004 21:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: webmaster.mafd.org

Barry,

are you "registering" the EditPartFactory with the editor?

This is typically done in "configureGraphicalViewer" method:
getGraphicalViewer().setEditPartFactory(new YourEditPartFactory());

Spack

"Barry Andrews" <bandrews@bphnx.com> wrote in message
news:cd9c4b$kbv$1@eclipse.org...
> I have added a CreationToolEntry object to my PaletteGroup, like this:
>
> control.add(new CreationToolEntry("Window",
> "Create Window",
> new SimpleFactory(WindowModel.class),
> null,
> null);
>
> When I select this tool then click in the viewer, my execute() method of
> my CreateCommand gets called, but nothing is drawn in the viewer.
> I believe my createEditPart() method of the PartFactory is supposed to be
> called by the framework somewhere in here, but where? It does not get
> called at all. What could I be doing wrong?
>
> Any help is very much appreciated as my hair is beginning to fall out!
>
> thanks,
>
> B
>
Re: CreationToolEntry and SimpleFactory [message #143069 is a reply to message #143063] Sat, 17 July 2004 00:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bandrews.bphnx.com

Yes, I did do that.


Richard Spackmann wrote:

> Barry,

> are you "registering" the EditPartFactory with the editor?

> This is typically done in "configureGraphicalViewer" method:
> getGraphicalViewer().setEditPartFactory(new YourEditPartFactory());

> Spack

> "Barry Andrews" <bandrews@bphnx.com> wrote in message
> news:cd9c4b$kbv$1@eclipse.org...
> > I have added a CreationToolEntry object to my PaletteGroup, like this:
> >
> > control.add(new CreationToolEntry("Window",
> > "Create Window",
> > new SimpleFactory(WindowModel.class),
> > null,
> > null);
> >
> > When I select this tool then click in the viewer, my execute() method of
> > my CreateCommand gets called, but nothing is drawn in the viewer.
> > I believe my createEditPart() method of the PartFactory is supposed to be
> > called by the framework somewhere in here, but where? It does not get
> > called at all. What could I be doing wrong?
> >
> > Any help is very much appreciated as my hair is beginning to fall out!
> >
> > thanks,
> >
> > B
> >
Re: CreationToolEntry and SimpleFactory [message #143079 is a reply to message #143069] Sat, 17 July 2004 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: RichardSpackmann.mafd.org

Hmmm....are you sure your EditPartFactory creates new EditParts of type
WindowModel ?

For example, the factories I have seen from tutorials have if statements
that check for the instance type of iModel.

What do you specifically do in your CreateCommand?

Also, the debugger is INVALUABLE, I recommend stepping through to see what's
not happening. Other than that - I really dont' know, I'm not that much of
an expert.

Maybe post your code so I can dig through and other people can chime in?

Spack

"Barry Andrews" <bandrews@bphnx.com> wrote in message
news:cd9qo1$66f$1@eclipse.org...
> Yes, I did do that.
>
>
> Richard Spackmann wrote:
>
> > Barry,
>
> > are you "registering" the EditPartFactory with the editor?
>
> > This is typically done in "configureGraphicalViewer" method:
> > getGraphicalViewer().setEditPartFactory(new YourEditPartFactory());
>
> > Spack
>
> > "Barry Andrews" <bandrews@bphnx.com> wrote in message
> > news:cd9c4b$kbv$1@eclipse.org...
> > > I have added a CreationToolEntry object to my PaletteGroup, like this:
> > >
> > > control.add(new CreationToolEntry("Window",
> > > "Create Window",
> > > new
SimpleFactory(WindowModel.class),
> > > null,
> > > null);
> > >
> > > When I select this tool then click in the viewer, my execute() method
of
> > > my CreateCommand gets called, but nothing is drawn in the viewer.
> > > I believe my createEditPart() method of the PartFactory is supposed to
be
> > > called by the framework somewhere in here, but where? It does not get
> > > called at all. What could I be doing wrong?
> > >
> > > Any help is very much appreciated as my hair is beginning to fall out!
> > >
> > > thanks,
> > >
> > > B
> > >
>
>
Re: CreationToolEntry and SimpleFactory [message #143364 is a reply to message #143053] Mon, 19 July 2004 17:15 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
Once your command creates the new object and adds it to the model, the model
parent should be firing a property change. When its corresponding EditPart
gets notified of the change in children, it should invoke refreshChildren()
(which will create the EditPart for the new child).

"Barry Andrews" <bandrews@bphnx.com> wrote in message
news:cd9c4b$kbv$1@eclipse.org...
> I have added a CreationToolEntry object to my PaletteGroup, like this:
>
> control.add(new CreationToolEntry("Window",
> "Create Window",
> new SimpleFactory(WindowModel.class),
> null,
> null);
>
> When I select this tool then click in the viewer, my execute() method of
> my CreateCommand gets called, but nothing is drawn in the viewer.
> I believe my createEditPart() method of the PartFactory is supposed to be
> called by the framework somewhere in here, but where? It does not get
> called at all. What could I be doing wrong?
>
> Any help is very much appreciated as my hair is beginning to fall out!
>
> thanks,
>
> B
>
Re: CreationToolEntry and SimpleFactory [message #143575 is a reply to message #143079] Tue, 20 July 2004 18:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bandrews.bphnx.com

Richard,

I sent you a zip file of the source code since it's too large to put here.
I didn't see a place to attach files, so I hope it's okay that I sent you
the email.

many thanks for your help!

Barry



Richard Spackmann wrote:

> Hmmm....are you sure your EditPartFactory creates new EditParts of type
> WindowModel ?

> For example, the factories I have seen from tutorials have if statements
> that check for the instance type of iModel.

> What do you specifically do in your CreateCommand?

> Also, the debugger is INVALUABLE, I recommend stepping through to see what's
> not happening. Other than that - I really dont' know, I'm not that much of
> an expert.

> Maybe post your code so I can dig through and other people can chime in?

> Spack

> "Barry Andrews" <bandrews@bphnx.com> wrote in message
> news:cd9qo1$66f$1@eclipse.org...
> > Yes, I did do that.
> >
> >
> > Richard Spackmann wrote:
> >
> > > Barry,
> >
> > > are you "registering" the EditPartFactory with the editor?
> >
> > > This is typically done in "configureGraphicalViewer" method:
> > > getGraphicalViewer().setEditPartFactory(new YourEditPartFactory());
> >
> > > Spack
> >
> > > "Barry Andrews" <bandrews@bphnx.com> wrote in message
> > > news:cd9c4b$kbv$1@eclipse.org...
> > > > I have added a CreationToolEntry object to my PaletteGroup, like this:
> > > >
> > > > control.add(new CreationToolEntry("Window",
> > > > "Create Window",
> > > > new
> SimpleFactory(WindowModel.class),
> > > > null,
> > > > null);
> > > >
> > > > When I select this tool then click in the viewer, my execute() method
> of
> > > > my CreateCommand gets called, but nothing is drawn in the viewer.
> > > > I believe my createEditPart() method of the PartFactory is supposed to
> be
> > > > called by the framework somewhere in here, but where? It does not get
> > > > called at all. What could I be doing wrong?
> > > >
> > > > Any help is very much appreciated as my hair is beginning to fall out!
> > > >
> > > > thanks,
> > > >
> > > > B
> > > >
> >
> >
Re: CreationToolEntry and SimpleFactory [message #143710 is a reply to message #143364] Tue, 20 July 2004 19:44 Go to previous message
Eclipse UserFriend
Originally posted by: bandrews.bphnx.com

Thanks! The problem was my "contents" EditPart did not implement a
PropertyChangeListener so it was not receiving notifications on addChild.

Pratik Shah wrote:

> Once your command creates the new object and adds it to the model, the model
> parent should be firing a property change. When its corresponding EditPart
> gets notified of the change in children, it should invoke refreshChildren()
> (which will create the EditPart for the new child).

> "Barry Andrews" <bandrews@bphnx.com> wrote in message
> news:cd9c4b$kbv$1@eclipse.org...
> > I have added a CreationToolEntry object to my PaletteGroup, like this:
> >
> > control.add(new CreationToolEntry("Window",
> > "Create Window",
> > new SimpleFactory(WindowModel.class),
> > null,
> > null);
> >
> > When I select this tool then click in the viewer, my execute() method of
> > my CreateCommand gets called, but nothing is drawn in the viewer.
> > I believe my createEditPart() method of the PartFactory is supposed to be
> > called by the framework somewhere in here, but where? It does not get
> > called at all. What could I be doing wrong?
> >
> > Any help is very much appreciated as my hair is beginning to fall out!
> >
> > thanks,
> >
> > B
> >
Previous Topic:Location Translation
Next Topic:About ManhattanConnectionRouter
Goto Forum:
  


Current Time: Fri Apr 19 05:21:00 GMT 2024

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

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

Back to the top