|
Re: Initail position of a node & palette changed at runtime [message #697043 is a reply to message #697040] |
Fri, 15 July 2011 11:48 |
Mauro P. Messages: 24 Registered: April 2011 |
Junior Member |
|
|
this is my code:
@Override
public void activate() {
super.activate();
AbstractEMFOperation emfOp = new AbstractEMFOperation(getEditingDomain(), "Location setting") {
@Override
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
Location lc = (Location) ((Node) getModel()).getLayoutConstraint();
int x=10;
int y=10;
//TODO: ---here the logic to calculate node position
lc.setX(x);
lc.setY(y);
return Status.OK_STATUS;
}
};
try {
OperationHistoryFactory.getOperationHistory().execute(emfOp, null, null);
} catch (ExecutionException e) {
e.printStackTrace();
}
}
this the printStackTrace
Caused by: java.lang.IllegalStateException: Cannot activate read/write transaction in read-only transaction context
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.acquire(TransactionalEditingDomainImpl.java:561)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.activate(TransactionalEditingDomainImpl.java:493)
at org.eclipse.emf.transaction.impl.TransactionImpl.start(TransactionImpl.java:204)
at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.startTransaction(TransactionalEditingDomainImpl.java:409)
at org.eclipse.emf.workspace.AbstractEMFOperation.createTransaction(AbstractEMFOperation.java:617)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:147)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
... 44 more
After some test, i've noticed that the above code works perfectly the first time the nodes are created, it start to throw exception when i call the refresh method on XXXDiagramEditPart.
Because i need to set node position after a Diagram.refresh() is there a way to solve this?
[Updated on: Fri, 15 July 2011 12:11] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04573 seconds