Prechádzať zdrojové kódy

The fonts of transition labels and text compartments are now changeable with the appearance property view.

markus.muehlbrandt@itemis.de 14 rokov pred
rodič
commit
9bbd1b5e64

+ 8 - 1
de.itemis.xtext.utils/plugins/de.itemis.xtext.utils.gmf/src/de/itemis/xtext/utils/gmf/directedit/ExternalXtextLabelEditPart.java

@@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
 import org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate;
 import org.eclipse.gmf.runtime.diagram.ui.label.LabelExDelegate;
 import org.eclipse.gmf.runtime.draw2d.ui.figures.LabelEx;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
 import org.eclipse.gmf.runtime.notation.ShapeStyle;
 import org.eclipse.gmf.runtime.notation.View;
 import org.eclipse.swt.graphics.Color;
@@ -81,10 +82,16 @@ public abstract class ExternalXtextLabelEditPart extends LabelEditPart
 
 	@Override
 	protected void handleNotificationEvent(final Notification notification) {
+		Object feature = notification.getFeature();
 		if (notification.getNotifier() instanceof ShapeStyle) {
 			refreshVisuals();
 		}
-		super.handleNotificationEvent(notification);
+		else if (NotationPackage.eINSTANCE.getFontStyle().getEAllAttributes().contains(feature)) {
+			refreshFont();
+		}
+		else {
+			super.handleNotificationEvent(notification);
+		}
 	}
 
 	@Override

+ 9 - 3
de.itemis.xtext.utils/plugins/de.itemis.xtext.utils.gmf/src/de/itemis/xtext/utils/gmf/directedit/XtextLabelEditPart.java

@@ -20,6 +20,7 @@ import org.eclipse.gef.Request;
 import org.eclipse.gef.tools.DirectEditManager;
 import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
 import org.eclipse.gmf.runtime.draw2d.ui.figures.LabelEx;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
 import org.eclipse.gmf.runtime.notation.ShapeStyle;
 import org.eclipse.gmf.runtime.notation.View;
 import org.eclipse.swt.graphics.Color;
@@ -81,11 +82,15 @@ public abstract class XtextLabelEditPart extends CompartmentEditPart implements
 	protected void handleNotificationEvent(final Notification notification) {
 		if (notification.getNotifier() instanceof ShapeStyle) {
 			refreshVisuals();
+		} else if (NotationPackage.eINSTANCE.getFontStyle().getEAllAttributes()
+				.contains(notification.getFeature())) {
+			refreshFont();
+		}
+		else {
+			super.handleNotificationEvent(notification);
 		}
-		super.handleNotificationEvent(notification);
 	}
 
-
 	@Override
 	protected void performDirectEditRequest(final Request request) {
 		if (manager == null) {
@@ -104,7 +109,8 @@ public abstract class XtextLabelEditPart extends CompartmentEditPart implements
 									.getExtendedData()
 									.get(REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
 
-							((XtextDirectEditManager) manager).show(initialChar);
+							((XtextDirectEditManager) manager)
+									.show(initialChar);
 
 						} else {
 							manager.show();