Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2009-02-24 08:52:59 -0500
committeratikhomirov2009-02-24 08:52:59 -0500
commit2cffbd5057098d05f1e505418f6698b5f22a2b0f (patch)
tree2e819474161461c4a58605ba772398308c893e4f
parentea10dc24ce0bc48ea17ee9b1b60985743378a250 (diff)
downloadorg.eclipse.gmf-tooling-2cffbd5057098d05f1e505418f6698b5f22a2b0f.tar.gz
org.eclipse.gmf-tooling-2cffbd5057098d05f1e505418f6698b5f22a2b0f.tar.xz
org.eclipse.gmf-tooling-2cffbd5057098d05f1e505418f6698b5f22a2b0f.zip
if diagram is in pixel mm, no reason to pipe pixel values through identity mapmode
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt10
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto7
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt9
3 files changed, 17 insertions, 9 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt
index df9a5b3e9..8a9137524 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/impl/diagram/editparts/NodeEditPart.xpt
@@ -15,6 +15,8 @@
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«EXTENSION xpt::diagram::ViewmapAttributesUtils»
«EXTENSION xpt::diagram::editparts::Utils»
+«EXTENSION xpt::diagram::Utils»
+
«DEFINE extendsListContents FOR gmfgen::GenNode-»
«IF hasBorderItems(self)»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF-»
@@ -329,11 +331,11 @@ new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolic
«ENDIF-»
«ENDDEFINE»
+// FIXME don't call getMapMode unless Diagram.units is not Pixel
«DEFINE createNodePlate FOR gmfgen::GenNode-»
«EXPAND xpt::Common::generatedMemberComment»
protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result =
- new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»));
+ org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result = new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»);
«EXPAND setupNodePlate-»
return result;
}
@@ -408,7 +410,7 @@ new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolic
});
«ELSE-»
org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout layout =new org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout();
- layout.setSpacing(getMapMode().DPtoLP(5));
+ layout.setSpacing(«IF getDiagram().isPixelMapMode()»5«ELSE»getMapMode().DPtoLP(5)«ENDIF»);
nodeShape.setLayoutManager(layout);
«ENDIF-»
}
@@ -449,7 +451,7 @@ new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolic
«EXPAND xpt::Common::generatedMemberComment»
protected void setLineWidth(int width) {
if (primaryShape instanceof org.eclipse.draw2d.Shape) {
- ((org.eclipse.draw2d.Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ ((org.eclipse.draw2d.Shape) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»);
}
}
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
index 4d9bfe8ba..83ba9d40a 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
@@ -56,4 +56,9 @@ helper gmfgen::GenCommonBase::hasLineStyleInCustom() : Boolean {
helper gmfgen::GenCommonBase::hasFillStyleInCustom() : Boolean {
return self.styles->exists(s | s.ecoreClass.oclIsKindOf(notation::FillStyle));
-}
+}
+
+-- if diagram is in pixel map mode, no reason to use getMapMode()
+helper gmfgen::GenDiagram::isPixelMapMode() : Boolean {
+ return self.units = 'Pixel';
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt
index 9b1f3b256..cc501f88d 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt
@@ -15,6 +15,7 @@
«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::diagram::Utils»
// FIXME ColorAttributes class is deprecated
«DEFINE foregroundColour(viewVar : String) FOR gmfgen::Viewmap»«EXPAND foregroundColour(viewVar) FOREACH attributes[gmfgen::ColorAttributes]»«ENDDEFINE»
@@ -76,11 +77,11 @@
// viewVar must be already inserted into a diagram (view.getDiagram() should be meaningful)
«DEFINE offset(String viewVar, x : Integer, y : Integer) FOR gmfgen::GenLabel-»
org.eclipse.gmf.runtime.notation.Location location«visualID» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint();
-«IF self.getDiagram().units <> 'Pixel'-»
- location«visualID».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»));
- location«visualID».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»));
-«ELSE-»
+«IF self.isPixelMapMode()-»
location«visualID».setX(«x»);
location«visualID».setY(«y»);
+«ELSE-»
+ location«visualID».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»));
+ location«visualID».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»));
«ENDIF-»
«ENDDEFINE»

Back to the top