Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » EditpartFactory does not get called
EditpartFactory does not get called [message #244738] Thu, 31 July 2008 14:46 Go to next message
Eclipse UserFriend
Originally posted by: dkdle.gmail.com

Hi

I got some strange behavior. I created a custom tool in the palette and
when I click the palette. The tool is working fine but the only problem is
that EditpartFactory does not get called when I call XXWritingShape. Apart
from XXWritingShape, everything is working well.

Here is the part of code.

private static PaletteContainer createToolsGroup(PaletteRoot palette) {
toolGroup.add(new XXwritingToolEntry());
}
public class FreeHandwritingToolEntry extends ToolEntry {

public Tool createTool()
{
return new XXwritingTool();
}
}

public class XXwritingTool extends CreationTool {
public XXwritingTool()
{
super();
setFactory(new XXwritingToolFactory());
setUnloadWhenFinished(false);
}

public class XXEditPartFactory implements EditPartFactory {
private EditPart getPartForElement(Object modelElement) {

if (modelElement instanceof XXDiagram) {
return new XXDiagramEditPart(modelElement);
}
if (modelElement instanceof Shape) {
eturn new ShapeEditPart(modelElement);
}
if (modelElement instanceof Connection) {
return new ConnectionEditPart(modelElement);
}
if(modelElement instanceof XXWritingShape) {
return new XXShapeEditPart();
}
}
Re: EditpartFactory does not get called [message #244745 is a reply to message #244738] Fri, 01 August 2008 14:49 Go to previous message
Simon Bernard is currently offline Simon BernardFriend
Messages: 345
Registered: July 2009
Senior Member
hi,

Two possibles ways :
- does XXWritingShape inherit from Shape ? if it's right your factory
will create only ShapeEditParts.
- Did you implements correctly the getModelChildren() of the editpart
in which you try to add a new XXWritingShape ?

good luck!


julia a écrit :
> Hi
>
> I got some strange behavior. I created a custom tool in the palette and
> when I click the palette. The tool is working fine but the only problem
> is that EditpartFactory does not get called when I call XXWritingShape.
> Apart from XXWritingShape, everything is working well.
>
> Here is the part of code.
> private static PaletteContainer createToolsGroup(PaletteRoot palette) {
> toolGroup.add(new XXwritingToolEntry());
> }
> public class FreeHandwritingToolEntry extends ToolEntry {
>
> public Tool createTool()
> {
> return new XXwritingTool();
> }
> }
>
> public class XXwritingTool extends CreationTool {
> public XXwritingTool()
> {
> super();
> setFactory(new XXwritingToolFactory());
> setUnloadWhenFinished(false);
> }
>
> public class XXEditPartFactory implements EditPartFactory {
> private EditPart getPartForElement(Object modelElement) {
>
> if (modelElement instanceof XXDiagram) {
> return new XXDiagramEditPart(modelElement);
> }
> if (modelElement instanceof Shape) {
> eturn new ShapeEditPart(modelElement);
> }
> if (modelElement instanceof Connection) {
> return new ConnectionEditPart(modelElement);
> }
> if(modelElement instanceof XXWritingShape) {
> return new XXShapeEditPart();
> }
> }
>
>
>
>
>
Previous Topic:[Announce] GEF 3.5.0 I200807300140 is available
Next Topic:Zest custom container
Goto Forum:
  


Current Time: Fri Apr 19 13:56:19 GMT 2024

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

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

Back to the top