|
@@ -1,60 +1,60 @@
|
|
|
-/**
|
|
|
- * Copyright (c) 2011 itemis AG and others.
|
|
|
- * All rights reserved. This program and the accompanying materials
|
|
|
- * are made available under the terms of the Eclipse Public License v1.0
|
|
|
- * which accompanies this distribution, and is available at
|
|
|
- * http://www.eclipse.org/legal/epl-v10.html
|
|
|
- *
|
|
|
- * Contributors:
|
|
|
- * itemis AG - initial API and implementation
|
|
|
- *
|
|
|
- */
|
|
|
-package de.itemis.gmf.runtime.commons.editparts;
|
|
|
-
|
|
|
-import org.eclipse.draw2d.IFigure;
|
|
|
-import org.eclipse.draw2d.LayoutManager;
|
|
|
-import org.eclipse.draw2d.StackLayout;
|
|
|
-import org.eclipse.draw2d.geometry.Dimension;
|
|
|
-import org.eclipse.gef.EditPolicy;
|
|
|
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
|
|
|
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
|
|
|
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
|
|
|
-import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
|
|
|
-import org.eclipse.gmf.runtime.notation.View;
|
|
|
-
|
|
|
-/**
|
|
|
- * EditPart for Shapes that should not be resized.
|
|
|
- *
|
|
|
- * @author andreas muelder (andreas.muelder@itemis.de)
|
|
|
- *
|
|
|
- */
|
|
|
-public abstract class FixedSizeShapeNodeEditPart extends ShapeNodeEditPart {
|
|
|
-
|
|
|
- public FixedSizeShapeNodeEditPart(final View view) {
|
|
|
- super(view);
|
|
|
- }
|
|
|
-
|
|
|
- public abstract Dimension getDefaultSize();
|
|
|
-
|
|
|
- public abstract IFigure getPrimaryShape();
|
|
|
-
|
|
|
- @Override
|
|
|
- protected NodeFigure createNodeFigure() {
|
|
|
- final NodeFigure figure = new DefaultSizeNodeFigure(getDefaultSize());
|
|
|
- figure.setLayoutManager(getLayoutManager());
|
|
|
- figure.add(getPrimaryShape());
|
|
|
- return figure;
|
|
|
- }
|
|
|
-
|
|
|
- protected LayoutManager getLayoutManager() {
|
|
|
- return new StackLayout();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void createDefaultEditPolicies() {
|
|
|
- super.createDefaultEditPolicies();
|
|
|
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
|
|
|
- new NonResizableEditPolicyEx());
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+/**
|
|
|
+ * Copyright (c) 2011 itemis AG and others.
|
|
|
+ * All rights reserved. This program and the accompanying materials
|
|
|
+ * are made available under the terms of the Eclipse Public License v1.0
|
|
|
+ * which accompanies this distribution, and is available at
|
|
|
+ * http://www.eclipse.org/legal/epl-v10.html
|
|
|
+ *
|
|
|
+ * Contributors:
|
|
|
+ * itemis AG - initial API and implementation
|
|
|
+ *
|
|
|
+ */
|
|
|
+package de.itemis.gmf.runtime.commons.editparts;
|
|
|
+
|
|
|
+import org.eclipse.draw2d.IFigure;
|
|
|
+import org.eclipse.draw2d.LayoutManager;
|
|
|
+import org.eclipse.draw2d.StackLayout;
|
|
|
+import org.eclipse.draw2d.geometry.Dimension;
|
|
|
+import org.eclipse.gef.EditPolicy;
|
|
|
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
|
|
|
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
|
|
|
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
|
|
|
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
|
|
|
+import org.eclipse.gmf.runtime.notation.View;
|
|
|
+
|
|
|
+/**
|
|
|
+ * EditPart for Shapes that should not be resized.
|
|
|
+ *
|
|
|
+ * @author andreas muelder (andreas.muelder@itemis.de)
|
|
|
+ *
|
|
|
+ */
|
|
|
+public abstract class FixedSizeShapeNodeEditPart extends ShapeNodeEditPart {
|
|
|
+
|
|
|
+ public FixedSizeShapeNodeEditPart(final View view) {
|
|
|
+ super(view);
|
|
|
+ }
|
|
|
+
|
|
|
+ public abstract Dimension getDefaultSize();
|
|
|
+
|
|
|
+ public abstract IFigure createPrimaryShape();
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected NodeFigure createNodeFigure() {
|
|
|
+ final NodeFigure figure = new DefaultSizeNodeFigure(getDefaultSize());
|
|
|
+ figure.setLayoutManager(getLayoutManager());
|
|
|
+ figure.add(createPrimaryShape());
|
|
|
+ return figure;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected LayoutManager getLayoutManager() {
|
|
|
+ return new StackLayout();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void createDefaultEditPolicies() {
|
|
|
+ super.createDefaultEditPolicies();
|
|
|
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
|
|
|
+ new NonResizableEditPolicyEx());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|