Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » again: how to make an editPart non-resizable ?
again: how to make an editPart non-resizable ? [message #53347] Fri, 22 September 2006 08:16 Go to next message
Eclipse UserFriend
Originally posted by: tivadar.szemethy.netvisor.hu

Hello,

I am trying to disable resizing of my editParts.
I followed the advices in the GMF Developer's Guide - Diagram Services
Layer - How-to Guide to override getPrimaryDragEditPolicy().

However, the object can still be resized through the properties view.
How can I prevent that ?

thanks,
Tivadar
Re: again: how to make an editPart non-resizable ? [message #54357 is a reply to message #53347] Fri, 22 September 2006 19:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vcciubot.uwaterloo.ca

Override the method below in ShapeEditPart to ignore notifications about
the size of the view.

vlad

protected void handleNotificationEvent(Notification notification) {
Object feature = notification.getFeature();
if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
|| NotationPackage.eINSTANCE.getSize_Height().equals(feature)
|| NotationPackage.eINSTANCE.getLocation_X().equals(feature)
|| NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
refreshBounds();
}
else if (NotationPackage.eINSTANCE.getFillStyle_FillColor().equals(f eature)) {
Integer c = (Integer) notification.getNewValue();
setBackgroundColor(DiagramColorRegistry.getInstance().getCol or(c));
}
else if (NotationPackage.eINSTANCE.getLineStyle_LineColor().equals(f eature)) {
Integer c = (Integer) notification.getNewValue();
setForegroundColor(DiagramColorRegistry.getInstance().getCol or(c));
}
else if (NotationPackage.eINSTANCE.getFontStyle().isInstance(notific ation.getNotifier()))
refreshFont();
else if (notification.getFeature() == NotationPackage.eINSTANCE.getView_Element()
&& ((EObject)notification.getNotifier())== getNotationView())
handleMajorSemanticChange();
else if (notification.getEventType() == EventType.UNRESOLVE
&& notification.getNotifier() == ((View)getModel()).getElement())
handleMajorSemanticChange();

else
super.handleNotificationEvent(notification);
}


On Fri, 22 Sep 2006 10:16:12 +0200, Tivadar Szemethy wrote:

> Hello,
>
> I am trying to disable resizing of my editParts.
> I followed the advices in the GMF Developer's Guide - Diagram Services
> Layer - How-to Guide to override getPrimaryDragEditPolicy().
>
> However, the object can still be resized through the properties view.
> How can I prevent that ?
>
> thanks,
> Tivadar
Re: again: how to make an editPart non-resizable ? [message #54724 is a reply to message #54357] Mon, 25 September 2006 09:11 Go to previous message
Eclipse UserFriend
Originally posted by: tivadar.szemethy.netvisor.hu

Vlad Ciubotariu wrote:
> Override the method below in ShapeEditPart to ignore notifications about
> the size of the view.

This will make the model and the view inconsistent. The data (e.g. X
coord in the model -- more precisely in the _diagram file -- ) will
change, but not updated on the screen. If the user saves the model and
loads in the next edit session, he/she will see the updated parameter,
exactly the situation I want to prevent.

Tiv


>
> vlad
>
> protected void handleNotificationEvent(Notification notification) {
> Object feature = notification.getFeature();
> if (NotationPackage.eINSTANCE.getSize_Width().equals(feature)
> || NotationPackage.eINSTANCE.getSize_Height().equals(feature)
> || NotationPackage.eINSTANCE.getLocation_X().equals(feature)
> || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
> refreshBounds();
> }
> else if (NotationPackage.eINSTANCE.getFillStyle_FillColor().equals(f eature)) {
> Integer c = (Integer) notification.getNewValue();
> setBackgroundColor(DiagramColorRegistry.getInstance().getCol or(c));
> }
> else if (NotationPackage.eINSTANCE.getLineStyle_LineColor().equals(f eature)) {
> Integer c = (Integer) notification.getNewValue();
> setForegroundColor(DiagramColorRegistry.getInstance().getCol or(c));
> }
> else if (NotationPackage.eINSTANCE.getFontStyle().isInstance(notific ation.getNotifier()))
> refreshFont();
> else if (notification.getFeature() == NotationPackage.eINSTANCE.getView_Element()
> && ((EObject)notification.getNotifier())== getNotationView())
> handleMajorSemanticChange();
> else if (notification.getEventType() == EventType.UNRESOLVE
> && notification.getNotifier() == ((View)getModel()).getElement())
> handleMajorSemanticChange();
>
> else
> super.handleNotificationEvent(notification);
> }
>
>
> On Fri, 22 Sep 2006 10:16:12 +0200, Tivadar Szemethy wrote:
>
>> Hello,
>>
>> I am trying to disable resizing of my editParts.
>> I followed the advices in the GMF Developer's Guide - Diagram Services
>> Layer - How-to Guide to override getPrimaryDragEditPolicy().
>>
>> However, the object can still be resized through the properties view.
>> How can I prevent that ?
>>
>> thanks,
>> Tivadar
>
Previous Topic:Ask for eclipseUML
Next Topic:Two instances of same diagram type for one model file
Goto Forum:
  


Current Time: Sun Oct 06 14:15:34 GMT 2024

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

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

Back to the top