Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue imixs#205
rsoika committed Mar 10, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d7b7eba commit 38d55b0
Showing 3 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@
import org.openbpmn.glsp.bpmn.IconGCompartment;
import org.openbpmn.glsp.bpmn.TaskGNode;
import org.openbpmn.glsp.elements.IconGCompartmentBuilder;
import org.openbpmn.glsp.model.BPMNGModelFactory;
import org.openbpmn.glsp.utils.BPMNGraphUtil;

/**
@@ -43,7 +42,7 @@
*/
public class TaskGNodeBuilder extends AbstractGNodeBuilder<TaskGNode, TaskGNodeBuilder> {

private static Logger logger = Logger.getLogger(BPMNGModelFactory.class.getName());
private static Logger logger = Logger.getLogger(TaskGNodeBuilder.class.getName());
private static final String V_GRAB = "vGrab";
private static final String H_GRAB = "hGrab";
private final String name;
Original file line number Diff line number Diff line change
@@ -132,10 +132,13 @@ public void createGModel() {
}

if (!modelState.isInitialized()) {

long l = System.currentTimeMillis();
GGraph newGModel = buildGGraph(getBpmnModel());

modelState.updateRoot(newGModel);
modelState.getRoot().setRevision(-1);
// modelState.getRoot().setRevision(-1); // do not reset revision!
// see https://github.com/eclipse-glsp/glsp/discussions/949

if (newGModel == null) {
logger.warn("Unable to create model - no processes found - creating an empty model");
@@ -194,9 +197,9 @@ public static GModelRoot createNewEmptyRoot(final String rootID) {
*/
public GGraph buildGGraph(final BPMNModel model) {

// create the RootBuiler
// create the RootBuilder
GGraphBuilder rootBuilder = new GGraphBuilder() //
.id("root_" + BPMNModel.generateShortID());
.id(modelState.getRootID());

List<GModelElement> gRootNodeList = new ArrayList<>();
try {
Original file line number Diff line number Diff line change
@@ -15,15 +15,8 @@
********************************************************************************/
package org.openbpmn.glsp.model;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.eclipse.glsp.server.model.DefaultGModelState;
import org.openbpmn.bpmn.BPMNModel;
import org.openbpmn.extension.BPMNExtension;

import com.google.inject.Inject;

/**
* The BPMNGModelState extends the DefaultGModelState and provides the property
@@ -36,20 +29,23 @@ public class BPMNGModelState extends DefaultGModelState {

private BPMNModel bpmnModel;
private boolean initialized = false;
List<String> extensionKinds = new ArrayList<>();

@Inject
protected Set<BPMNExtension> extensions;
private String rootID = "undefined_root_id";

public BPMNModel getBpmnModel() {
return bpmnModel;
}

public void setBpmnModel(final BPMNModel bpmnModel) {
this.bpmnModel = bpmnModel;
// create a new unique id
rootID = "root_" + BPMNModel.generateShortID();
this.setRoot(null);
}

public String getRootID() {
return rootID;
}

public boolean isInitialized() {
return initialized;
}

0 comments on commit 38d55b0

Please sign in to comment.