Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Use of Routing and JumpLinks For Connectors
Use of Routing and JumpLinks For Connectors [message #158477] Tue, 06 November 2007 11:35 Go to next message
Eclipse UserFriend
Originally posted by: Shwetha.V.in.bosch.com

Hi,

By default the Routing Style of a Connector is set to Oblique.How can I
change the default value to Rectilinear.Similarly Jump Links Status is
None by default how can I change it All and Jump Type to Chamfered.

I tried to override refereshRoutingStyle() in ConnectorEditPart,but it is
throwing an Exception.Please guide me where to change and which method to
change.

Instead of overriding the code can I change something in gmfgraph or
gmfgen to do the above mentioned changes.

Thanks in advance.

Regards,
Shwetha
Re: Use of Routing and JumpLinks For Connectors [message #159128 is a reply to message #158477] Fri, 09 November 2007 06:20 Go to previous messageGo to next message
Annamalai Chockalingam is currently offline Annamalai ChockalingamFriend
Messages: 49
Registered: July 2009
Member
Dear All

We are also stuck with a similar Problem .. Can anyone help us out .. Can
anyone tell us how to configure the Style Values through GmfGraph or
GmfGen Models. If not using the model where should the code be changed.

Any help in this direction would be highly appreciated.

regards
Malai
Re: Use of Routing and JumpLinks For Connectors [message #159173 is a reply to message #159128] Fri, 09 November 2007 09:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Shwetha.V.in.bosch.com

Hello,

I managed to find the solution for my query.

To change the style property of the connector I overrided
initializeFromPreferences() in ConnectorViewFactory class generated by GMF
inside factories package.

@Override
protected void initializeFromPreferences(View view) {
super.initializeFromPreferences(view);

IPreferenceStore store = (IPreferenceStore) getPreferencesHint()
.getPreferenceStore();

RoutingStyle routingStyle =
(RoutingStyle)view.getStyle(NotationPackage.Literals.ROUTING _STYLE);
if (routingStyle != null) {
// Routing.get(1) is for RECTILINEAR Routing style.
Routing routing = Routing.get(1);
if (routing != null) {
routingStyle.setRouting(routing);
routingStyle.setJumpLinkStatus(JumpLinkStatus.ALL_LITERAL);
routingStyle.setJumpLinkType(JumpLinkType.CHAMFERED_LITERAL) ;
}
}
}


It works for me,but would be happy to know is this the right place.

Thanks and Regards,
Shwetha
Re: Use of Routing and JumpLinks For Connectors [message #173756 is a reply to message #159173] Fri, 22 February 2008 15:08 Go to previous message
Johan Wannheden is currently offline Johan WannhedenFriend
Messages: 40
Registered: July 2009
Member
Shwetha wrote:
> Hello,
>
> I managed to find the solution for my query.
>
> To change the style property of the connector I overrided
> initializeFromPreferences() in ConnectorViewFactory class generated by
> GMF inside factories package.
>
> @Override
> protected void initializeFromPreferences(View view) {
> super.initializeFromPreferences(view);
>
> IPreferenceStore store = (IPreferenceStore) getPreferencesHint()
> .getPreferenceStore();
>
> RoutingStyle routingStyle =
> (RoutingStyle)view.getStyle(NotationPackage.Literals.ROUTING _STYLE);
> if (routingStyle != null) {
> // Routing.get(1) is for RECTILINEAR Routing style.
> Routing routing = Routing.get(1);
> if (routing != null) {
> routingStyle.setRouting(routing);
> routingStyle.setJumpLinkStatus(JumpLinkStatus.ALL_LITERAL);
>
> routingStyle.setJumpLinkType(JumpLinkType.CHAMFERED_LITERAL) ;
> }
> }
> }
>
>
> It works for me,but would be happy to know is this the right place.
>
> Thanks and Regards,
> Shwetha
>
>
>

Hello,

you can also change to the following code:

public class DiagramPreferenceInitializer extends
AbstractPreferenceInitializer {

/**
* @generated NOT
*/
public void initializeDefaultPreferences() {
IPreferenceStore store = getPreferenceStore();

DiagramPrintingPreferencePage.initDefaults(store);
DiagramGeneralPreferencePage.initDefaults(store);
DiagramAppearancePreferencePage.initDefaults(store);
DiagramConnectionsPreferencePage.initDefaults(store);
DiagramRulersAndGridPreferencePage.initDefaults(store);

// store.setDefault(IPreferenceConstants.PREF_LINE_STYLE,
// Routing.RECTILINEAR);
// store.setValue(IPreferenceConstants.PREF_LINE_STYLE,
// Routing.RECTILINEAR);
// store.setDefault(IPreferenceConstants.PREF_SHOW_CONNECTION_H ANDLES,
// false);

}

Hope this helps,
Johan
Previous Topic:Routing behavior
Next Topic:Ecore with subpackages
Goto Forum:
  


Current Time: Fri Apr 26 19:36:06 GMT 2024

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

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

Back to the top