Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Rectilinear Routing as Default in GMF 2.1.1 +
Rectilinear Routing as Default in GMF 2.1.1 + [message #485571] Sun, 13 September 2009 18:54 Go to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
Hello all,
I used a custom decorateView method at <Connection>ViewFactory to have
Rectilinear Routing as default, but after an update I cannot.

How should I proceed?

Thanks in advance
Re: Rectilinear Routing as Default in GMF 2.1.1 + [message #485621 is a reply to message #485571] Mon, 14 September 2009 08:15 Go to previous messageGo to next message
Olivier Marot is currently offline Olivier MarotFriend
Messages: 14
Registered: September 2009
Junior Member
Hi Ugo,
You can modify the routing style directly in your connection's EditPart.
Here is an example :

/**
* @generated NOT
*/
protected Connection createConnectionFigure() {
	ConnectionFigure figure = new ConnectionFigure();
	RoutingStyle style = (RoutingStyle) ((View) getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE);
	style.setRouting(Routing.RECTILINEAR_LITERAL);
	return figure;
}
Re: Rectilinear Routing as Default in GMF 2.1.1 + [message #502108 is a reply to message #485621] Sat, 05 December 2009 19:18 Go to previous messageGo to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
Thank you Olivier, but now im getting an IllegalStateException, is there
another way of doing this?

the exception:
java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:280)
at
org.eclipse.gmf.runtime.notation.impl.RoutingStyleImpl.setRo uting(RoutingStyleImpl.java:361)
at
br.puc.molic.diagram.edit.parts.UtteranceEditPart.createConn ectionFigure(UtteranceEditPart.java:104)

Olivier Marot escreveu:
> Hi Ugo,
> You can modify the routing style directly in your connection's EditPart.
> Here is an example :
>
> /**
> * @generated NOT
> */
> protected Connection createConnectionFigure() {
> ConnectionFigure figure = new ConnectionFigure();
> RoutingStyle style = (RoutingStyle) ((View)
> getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE) ;
> style.setRouting(Routing.RECTILINEAR_LITERAL);
> return figure;
> }
Re: Rectilinear Routing as Default in GMF 2.1.1 + [message #502113 is a reply to message #502108] Sat, 05 December 2009 21:08 Go to previous messageGo to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
i'd finally came across a solution, here is how i did:

protected Connection createConnectionFigure() {
ConnectionFigure figure = new ConnectionFigure();

AbstractEMFOperation emfOp = new AbstractEMFOperation(getEditingDomain(), "line routing setting") {
@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 e) {}

return figure;
}

Enjoy!

Ugo Sangiorgi escreveu:
> Thank you Olivier, but now im getting an IllegalStateException, is there
> another way of doing this?
>
> the exception:
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:280)
>
> at
> org.eclipse.gmf.runtime.notation.impl.RoutingStyleImpl.setRo uting(RoutingStyleImpl.java:361)
>
> at
> br.puc.molic.diagram.edit.parts.UtteranceEditPart.createConn ectionFigure(UtteranceEditPart.java:104)
>
>
> Olivier Marot escreveu:
>> Hi Ugo,
>> You can modify the routing style directly in your connection's EditPart.
>> Here is an example :
>>
>> /**
>> * @generated NOT
>> */
>> protected Connection createConnectionFigure() {
>> ConnectionFigure figure = new ConnectionFigure();
>> RoutingStyle style = (RoutingStyle) ((View)
>> getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE) ;
>> style.setRouting(Routing.RECTILINEAR_LITERAL);
>> return figure;
>> }
Re: Rectilinear Routing as Default in GMF 2.1.1 + [message #534327 is a reply to message #502113] Tue, 18 May 2010 16:48 Go to previous message
Erik Englund is currently offline Erik EnglundFriend
Messages: 49
Registered: July 2009
Member
I tried the proposed "final" solution but I still get an Illegal State exception. Mine however is that "Can not activate read/write transaction in read-only transaction context"

Any ideas?
Previous Topic:Multiple top-level classes
Next Topic:DND from view to editor
Goto Forum:
  


Current Time: Fri Apr 19 07:42:31 GMT 2024

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

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

Back to the top