Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Problem with setting routing example from wiki
Problem with setting routing example from wiki [message #689680] Tue, 28 June 2011 03:15 Go to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi all,

I found this example: http://wiki.eclipse.org/Graphical_Modeling_Framework/Tips#Setting_default_Routing_for_connections

This code causes a the following Exception:

IllegalStateException: Cannot activate read/write transaction in readonly transaction context.

Is there a way to fix this example?

Ralph
Re: Problem with setting routing example from wiki [message #689688 is a reply to message #689680] Tue, 28 June 2011 03:41 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

I have this code as fix:

xxxFigure figure = new xxxFigure();
		
RoutingStyle style = (RoutingStyle)((View)getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE);
if (! (style.getRouting() == Routing.RECTILINEAR_LITERAL)){
  AbstractEMFOperation emfOp = new AbstractEMFOperation(getEditingDomain(), "routing") {
				
    @Override
    protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {				
    
      RoutingStyle style = (RoutingStyle)((View)getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE);
					style.setRouting(Routing.RECTILINEAR_LITERAL);
					return Status.OK_STATUS;
      }
    };
    try{
      OperationHistoryFactory.getOperationHistory().execute(emfOp, null, null);
    }catch(ExecutionException ex){
      ex.printStackTrace();
    }
}
		
return figure;


What do you think?

Ralph

[Updated on: Tue, 28 June 2011 03:42]

Report message to a moderator

Previous Topic:Implementing views
Next Topic:Creating a view
Goto Forum:
  


Current Time: Sat Aug 23 07:35:09 EDT 2014

Powered by FUDForum. Page generated in 0.02924 seconds