Modify a pictogram element in Eclipse RCP Graphiti -
i tried solution provided here: automatic update of graphiti diagrams in case of changes in datamodel
i trying call upadate feature in updateneeded function of class implements abstractupdatefeature:
transactionaleditingdomain domain = transactionutils.geteditingdomain(diagram); domain.getcommandstack().execute(new recordingcommand(domain) { public void doexecute() { updatecontext updatecontext = new updatecontext(getdiagram().getchildren().get(0). getgraphicsalgorithm().getpictogramelement( )); iupdatefeature updatefeature = getfeatureprovider().getupdatefeature(updatecontext); updatefeature.update(updatecontext); }});
in update function trying change value of text field of pictogram element:
// set name in pictogram model if (pictogramelement instanceof containershape) { containershape cs = (containershape) pictogramelement; (shape shape : cs.getchildren()) { if (shape.getgraphicsalgorithm() instanceof text) { text text = (text) shape.getgraphicsalgorithm(); text.setvalue("aaa"); return true; } } }
but getting exception:
java.lang.illegalstateexception: cannot modify resource set without write transaction @ org.eclipse.emf.transaction.impl.transactionchangerecorder.assertwriting(transactionchangerecorder.java:348) @ org.eclipse.emf.transaction.impl.transactionchangerecorder.appendnotification(transactionchangerecorder.java:302) @ org.eclipse.emf.transaction.impl.transactionchangerecorder.processobjectnotification(transactionchangerecorder.java:284) @ org.eclipse.emf.transaction.impl.transactionchangerecorder.notifychanged(transactionchangerecorder.java:240)
try executing feature using diagrambehavior
getdiagrambehavior().executefeature(feature, context);
Comments
Post a Comment