Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Editor is dirty when create method returns EMPTY
Editor is dirty when create method returns EMPTY [message #902971] Tue, 21 August 2012 09:17 Go to previous message
Joao S is currently offline Joao S
Messages: 51
Registered: January 2011
Member
Hello everyone,

Following graphiti tutorial:

public Object[] create(ICreateContext context) {
        // ask user for EClass name
        String newClassName = ExampleUtil.askString(TITLE, USER_QUESTION, "");
        if (newClassName == null || newClassName.trim().length() == 0) {
            return EMPTY;
        }
 
        // create EClass
        EClass newClass = EcoreFactory.eINSTANCE.createEClass();
        // Add model element to resource.
        // We add the model element to the resource of the diagram for
        // simplicity's sake. Normally, a customer would use its own
        // model persistence layer for storing the business model separately.
        getDiagram().eResource().getContents().add(newClass);
        newClass.setName(newClassName);
 
        // do the add
        addGraphicalRepresentation(context, newClass);
 
        // return newly created business object(s)
        return new Object[] { newClass };
    }


When this method returns EMPTY, the editor still gets dirty despite no object was added to the resource.

Is this the expected behaviour?

Is there anyway that I can avoid this?

Thanks,
Joao
 
Read Message
Read Message
Previous Topic:Populating Diagram with all domain objects
Next Topic:Resize shape (only horizontal)
Goto Forum:
  


Current Time: Thu May 23 08:03:02 EDT 2013

Powered by FUDForum. Page generated in 0.02916 seconds