Objects become null after removing connection between them

5 views
Skip to first unread message

Simone Di Cola

unread,
Jun 17, 2014, 9:06:48 AM6/17/14
to spray...@googlegroups.com
Hi Joerg, 
 I'm experimenting with a very strange behavior. If I connect two pictogram elements with a connection, and then I remove it, the two objects become null (indeed I cannot move them or try another connection).

Is this a known bug?

Simone

Simone Di Cola

unread,
Jun 17, 2014, 10:22:47 AM6/17/14
to spray...@googlegroups.com
I can shed some light on this case: 

The problem is that, once I create a connection, the eContainer of the two elements become the connection itself (very weird). I did not override anything. 

Any idea?
Simone 

Simone Di Cola

unread,
Jun 17, 2014, 10:37:21 AM6/17/14
to spray...@googlegroups.com
The eContainer changes here:

/**
     * Creates a EReference between two EClasses.
     */
    protected uk.man.xman.xcore.CoordinationConnection createCoordinationConnection(final uk.man.xman.xcore.Connector source, final uk.man.xman.xcore.Composable target) {
        // TODO: Domain Object
        final uk.man.xman.xcore.CoordinationConnection domainObject = XcoreFactory.eINSTANCE.createCoordinationConnection();
        domainObject.setSource(source);              <-----------------------------
        domainObject.setTarget(target);                   <--------------------------

        setDoneChanges(true);
        return domainObject;

Simone Di Cola

unread,
Jun 17, 2014, 11:13:23 AM6/17/14
to spray...@googlegroups.com
This method changes it:

public void setSource(Connector newSource)
  {
    if (newSource != source)
    {
      NotificationChain msgs = null;
      if (source != null)
        msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XcorePackage.COORDINATION_CONNECTION__SOURCE, null, msgs);
      if (newSource != null)
       msgs = ((InternalEObject)newSource).eInverseAdd (this, EOPPOSITE_FEATURE_BASE - XcorePackage.COORDINATION_CONNECTION__SOURCE, null, msgs);                  //<------------------------- HERE
      msgs = basicSetSource(newSource, msgs);
      if (msgs != null) msgs.dispatch();

Simone Di Cola

unread,
Jun 17, 2014, 11:36:42 AM6/17/14
to spray...@googlegroups.com
I've created a screencast that reproduces the error. 
error_graphiti.mp4

Simone Di Cola

unread,
Jun 17, 2014, 2:46:06 PM6/17/14
to spray...@googlegroups.com
After having played with another project that I'm working on,  I figure that maybe thereis some problem with my xcore model. Could you please have a look at it?

package uk.man.xman.xcore

enum ChannelPolicy{
CACHELESS = 0
CACHEFULL = 1
}

enum LoopType{
DoWhile = 0
WhileDo = 1
}

interface Composable{
}

interface Connector extends Composable{
String fullName
String showedName
}
 
abstract class CompositionConnector extends Connector{
contains Connection[2..*] connections
}

class Sequencer extends CompositionConnector{
}

class Selector extends CompositionConnector{
contains Input[1..1] input
}

abstract class AdapterConnector extends Connector{
String conditionalStatement
contains Input [1..1] input
contains Connection[1..1] connection
}

class Loop extends AdapterConnector{
LoopType loopType
}

class Guard extends AdapterConnector{ 
}


interface Connection{
}

class CoordinationConnection extends Connection{
String order
String condition
contains Connector source
contains Composable  target
}

abstract class Component{
String name
String author
String comment
Boolean verified
Boolean valid
contains  Service[1..*] services 
contains  DataElement[0..*] dataElements opposite component
}

class AtomicComponent extends Component{
contains ComputationUnit[1..1] computationUnit opposite atomicComponent
}

//@Ecore(constraints="MustContainAtLeastOneMethod")
class ComputationUnit{
String sourceCode
container AtomicComponent[1] atomicComponent opposite computationUnit
}

//@Ecore(constraints = "ValueCannotBeNull NameConnotBeNull DefaultValueConnotBeNull")
class DataElement{
String datatype
String defaultValue = ""
String value= ""
String name = ""
container Component component opposite dataElements
}

class CompositeComponent extends Component{
contains Composable[1..*] composables
contains CoordinationConnection[1..*] connections
contains DataChannel[0..*] dataChannels
}

//@Ecore(constraints = "OrderMustBeSpecified")
abstract class Parameter{
int order = "-1"
String dataType
String name
container Service service opposite parameters
}

class Input extends Parameter{
}

class Output extends Parameter{
}

class DataChannel{
String content
ChannelPolicy policy
contains Parameter source
contains Parameter target
}

class Service{
String name
String comment
contains DataChannel[0..*] dataChannels
contains Parameter[1..*] parameters opposite service
contains Contract[0..*] contracts 
}

class Contract{
String name
String preCondition
String postCondition
}

class ComponentInstance extends Composable{
String name
contains Service [1..*]  selectedServices
contains Component[1..1] componentReference
}

class DeploymentSetting{
contains KeyedValue[0..*] settings
}

class KeyedValue{
String key
String value
}

class System{
String name
contains Composable[1..*] composables
refers Service[1..*] services
contains DeploymentSetting[0..*] deploymentSettings
}

Simone Di Cola

unread,
Jun 18, 2014, 7:02:09 AM6/18/14
to spray...@googlegroups.com
This was the error:


class CoordinationConnection extends Connection{
String order
String condition
refers Connector source 
refers Composable target

Jörg Reichert

unread,
Jun 18, 2014, 8:26:54 AM6/18/14
to spray...@googlegroups.com
Glad to hear, that you find it on your own, I just miss this contains mistake when I had look at your model.

Joerg
--
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "spray-user" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an spray-users...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages