Bladeren bron

Added CreationTool which allows to disable the direct editing behavior on element creation.

markus.muehlbrandt@itemis.de 14 jaren geleden
bovenliggende
commit
5005ebda1e

+ 8 - 0
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/EntryImpl.java

@@ -171,5 +171,13 @@ public class EntryImpl extends PseudostateImpl implements Entry {
 		result.append(')');
 		return result.toString();
 	}
+	/**
+	 * @generated NOT
+	 */
+	@Override
+	public String getName() {
+		String name = super.getName();
+		return name == null ? "" : name;
+	}
 
 } //EntryImpl

+ 9 - 0
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/ExitImpl.java

@@ -49,5 +49,14 @@ public class ExitImpl extends PseudostateImpl implements Exit {
 	protected EClass eStaticClass() {
 		return SGraphPackage.Literals.EXIT;
 	}
+	
+	/**
+	 * @generated NOT
+	 */
+	@Override
+	public String getName() {
+		String name = super.getName();
+		return name == null ? "" : name;
+	}
 
 } //ExitImpl

+ 13 - 5
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/editor/StatechartDiagramPaletteFactory.java

@@ -13,14 +13,16 @@ package org.yakindu.sct.ui.editor.editor;
 import org.eclipse.gef.Tool;
 import org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory;
 import org.eclipse.gmf.runtime.diagram.ui.tools.ConnectionCreationTool;
-import org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool;
 import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
 import org.eclipse.gmf.runtime.emf.type.core.IElementType;
 
+import de.itemis.gmf.runtime.commons.palette.CreationTool;
+
 /**
  * 
  * @author andreas muelder - Initial contribution and API
- *
+ * @author muehlbrandt
+ * 
  */
 public class StatechartDiagramPaletteFactory extends PaletteFactory.Adapter {
 
@@ -29,11 +31,17 @@ public class StatechartDiagramPaletteFactory extends PaletteFactory.Adapter {
 		IElementType elementType = ElementTypeRegistry.getInstance().getType(
 				toolId);
 		if (elementType == null)
-			throw new IllegalStateException("No Element Id for toolId " + toolId
-					+ " found!");
+			throw new IllegalStateException("No Element Id for toolId "
+					+ toolId + " found!");
 		if (toolId.equals(StatechartElementTypes.TRANSITION.getId())) {
 			return new ConnectionCreationTool(elementType);
+		}
+		if (toolId.equals(StatechartElementTypes.ENTRY.getId())
+				|| toolId.equals(StatechartElementTypes.DEEPHISTORY.getId())
+				|| toolId.equals(StatechartElementTypes.SHALLOWHISTORY.getId())
+				|| toolId.equals(StatechartElementTypes.EXIT.getId())) {
+			return new CreationTool(elementType, false);
 		} else
-			return new CreationTool(elementType);
+			return new CreationTool(elementType, true);
 	}
 }

+ 0 - 1
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/editparts/NamedElementLabelEditPart.java

@@ -27,5 +27,4 @@ public class NamedElementLabelEditPart extends TextAwareLabelEditPart {
 		super(view, SGraphPackage.Literals.NAMED_ELEMENT__NAME,
 				DiagramActivator.PLUGIN_ID);
 	}
-
 }