Skip to main content


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 07:15 Go to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
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 07:41 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
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 07:42]

Report message to a moderator

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


Current Time: Fri Apr 19 00:48:37 GMT 2024

Powered by FUDForum. Page generated in 0.01708 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top