|
Re: NPE While creating SequenceFlow between events after Mars.2 update [message #1726120 is a reply to message #1726110] |
Wed, 09 March 2016 20:16 |
|
I don't understand how this was working before because a CreateConnectionContext requires both source/target Anchors as well as source/target PictogramElements (!?)
May I suggest the following code for creating your source/target Anchors?
CreateConnectionContext cc = new CreateConnectionContext();
PictogramElement source; // the source shape
PictogramElement target; // the target shape
Point sp = GraphicsUtil.getShapeCenter((AnchorContainer)source);
Point tp = GraphicsUtil.getShapeCenter((AnchorContainer)target);
FixPointAnchor sourceAnchor = AnchorUtil.createAnchor((AnchorContainer)source, tp);
FixPointAnchor targetAnchor = AnchorUtil.createAnchor((AnchorContainer)target, sp);
cc.setSourcePictogramElement(source);
cc.setTargetPictogramElement(target);
cc.setSourceAnchor(sourceAnchor);
cc.setTargetAnchor(targetAnchor);
BTW, you may want to investigate the <toolPalette> extension element for your plugin - this allows you to define tool palette items that construct arbitrary sequences of activities, events and gateways without having to write Java code. See the "Workflow Patterns" tool drawer for examples.
|
|
|
|
|
|
|
|
|
|
|
Re: NPE While creating SequenceFlow between events after Mars.2 update [message #1726272 is a reply to message #1726258] |
Thu, 10 March 2016 21:37 |
|
Maybe the problem lies with the createdParticipant object. In order for the create methods to correctly insert the flow elements (start/end events and your sequence flow) they need a FlowElementsContainer; Participant is not a FlowElementsContainer, but the Process object it references is. Can you check if the Participant.processRef is non-null (i.e. it should reference a Process that was created previously and inserted into the Definitions root element.
|
|
|
|
Re: NPE While creating SequenceFlow between events after Mars.2 update [message #1726353 is a reply to message #1726352] |
Fri, 11 March 2016 18:34 |
|
There was a problem with adding Participants that has since been fixed: I don't recall all the details, but if the diagram contained only a single Process, and a new Pool (Participant) was added, the original Process was incorrectly added to the Participant.processRef (I think!) What should have been happening (and this has been fixed now) is that a Collaboration element is created and a Participant for the original Process was added; then the new Participant for the Pool was created and added to the Collaboration. I hope all this makes sense, because I'm getting confused just trying to explain it
Anyway, I'm glad it's starting to work again.
Can you explain exactly WHAT you are trying to do with the editor? Why are you writing all this code to mess around with the model? Maybe I can suggest an alternative...
Cheers,
Bob
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03969 seconds