Making a Node not resizable [message #653644] |
Thu, 10 February 2011 14:19 |
|
Hi,
I have a GMF-based graphical editor in my RCP application, which displays some figures and connectors: for my needs, I have to forbid the resizing of figures...anybody knows how can I reach this goal?
Thanx,
Giovanni
|
|
|
Re: Making a Node not resizable [message #653671 is a reply to message #653644] |
Thu, 10 February 2011 16:13 |
|
I found a solution by myself: I installed a new ComponentEditPolicy in my editPart, with the following lines:
if (RequestConstants.REQ_RESIZE.equals(request.getType())) {
return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
Maybe this can help,
Regards
Giovanni
|
|
|
|
Re: Making a Node not resizable [message #654206 is a reply to message #654200] |
Mon, 14 February 2011 15:16 |
|
Hi Ralph,
the most rapid way to suite your needs is working at "Preference" level:
in your DiagramGeneralPreferencePage.class you add the following:
/**
* Override default values for popup and connection handles
* @param preferenceStore
*/
public static void overrideDefaultValues(IPreferenceStore preferenceStore) {
preferenceStore.setDefault(IPreferenceConstants.PREF_SHOW_CO NNECTION_HANDLES, false);
preferenceStore.setDefault(IPreferenceConstants.PREF_SHOW_PO PUP_BARS, false);
}
and, in your DiagramPreferenceInitializer.class, you call it:
/**
* @generated NOT
*/
public void initializeDefaultPreferences() {
IPreferenceStore store = getPreferenceStore();
DiagramGeneralPreferencePage.initDefaults(store);
/**
* Eliminate popup and connection handles
*/
DiagramGeneralPreferencePage.overrideDefaultValues(store);
DiagramAppearancePreferencePage.initDefaults(store);
DiagramConnectionsPreferencePage.initDefaults(store);
DiagramPrintingPreferencePage.initDefaults(store);
DiagramRulersAndGridPreferencePage.initDefaults(store);
}
Hope this helps, bye
Giovanni
|
|
|
|
|
Re: Making a Node not resizable [message #655392 is a reply to message #654215] |
Sun, 20 February 2011 14:12 |
Ralph Gerbig Messages: 702 Registered: November 2009 |
Senior Member |
|
|
Hi,
you might also try this.
Switch of resizing:
removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicyEx());
Switch on resizing:
removeEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableShapeEditPolicy());
Ralph
[Updated on: Sun, 20 February 2011 14:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04259 seconds