[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: EMF / GMF : sharing Editing Domain

Hi,

I tried your solution. I still have an error :
While executing the operation, an exception occurred
Caused by: java.lang.NullPointerException
at org.eclipse.emf.workspace.AbstractEMFOperation.inheritedOptions(AbstractEMFOperation.java:240)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:149)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:511)
... 50 more


The problem I have is that when I try to get my editing domain (from refresh method or inside My Operation), it returns to me null.

Do I have something special to do to register my editing domain ?

here is the code I added : public void refresh() {
TransactionalEditingDomain.Registry registry = TransactionalEditingDomain.Registry.INSTANCE;
final TransactionalEditingDomain txDomain = registry.getEditingDomain("org.bonitasoft.studio.diagram.EditingDomain");
try {
OperationHistoryFactory.getOperationHistory().execute(new MyOperation(txDomain, "mylabel", this), null, null);
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
private static class MyOperation extends AbstractEMFOperation {
private NameSection nameSection;
public MyOperation(TransactionalEditingDomain domain, String label, NameSection nameSection) {
super(TransactionalEditingDomain.Registry.INSTANCE.getEditingDomain("org.bonitasoft.studio.diagram.EditingDomain"), label);
this.nameSection = nameSection;
}
@Override
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
this.nameSection.element.setName(this.nameSection.getText().getText());
return null;
}
}
Thanks
Charles