Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt84
1 files changed, 84 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt
new file mode 100644
index 000000000..844e8eeb2
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.xpt
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2006 Borland Software Corporation
+ *
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2005/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE figureAttrs(EString figureVarName) FOR gmfgraph::Figure-»
+«EXPAND foregroundColor(this, figureVarName) FOR foregroundColor-»
+«EXPAND backgroundColor(this, figureVarName) FOR backgroundColor-»
+«EXPAND font(this, figureVarName) FOR font-»
+«EXPAND preferredSize(figureVarName) FOR preferredSize-»
+«EXPAND maximumSize(figureVarName) FOR maximumSize-»
+«EXPAND minimumSize(figureVarName) FOR minimumSize-»
+«EXPAND size(figureVarName) FOR size-»
+«EXPAND insets(figureVarName) FOR insets-»
+«EXPAND Border::Init(figureVarName) FOR border-»
+«ENDDEFINE»
+
+«DEFINE foregroundColor(gmfgraph::Figure figure, String figureVarName) FOR gmfgraph::Color-»
+ «figureVarName».setForegroundColor(«EXPAND color(figure.name.toUpperCase() + "_FORE")»);
+«ENDDEFINE»
+«DEFINE backgroundColor(gmfgraph::Figure figure, String figureVarName) FOR gmfgraph::Color-»
+ «figureVarName».setBackgroundColor(«EXPAND color(figure.name.toUpperCase() + "_BACK")»);
+«ENDDEFINE»
+
+«DEFINE preferredSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setPreferredSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE maximumSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE minimumSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE size(EString figureVarName) FOR gmfgraph::Point-»
+«figureVarName».setSize(«EXPAND MapMode::map»);
+«ENDDEFINE»
+
+«DEFINE insets(EString figureVarName) FOR gmfgraph::Insets-»
+«REM»using MarginBorder for insets is not good idea«ENDREM»
+«figureVarName».setBorder(new org.eclipse.draw2d.MarginBorder(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE font(Figure figure, EString figureVarName) FOR gmfgraph::Font»
+«ERROR "This is abstact definition, just to overcome some xpand polymorphism limitations"»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::Color»
+«ERROR "This is abstact definition, just to overcome some xpand polymorphism limitations"»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::RGBColor-»
+«variableName-»
+«FILE "" staticFields»
+static final org.eclipse.swt.graphics.Color «variableName» = new org.eclipse.swt.graphics.Color(null, «red», «green», «blue»);
+«ENDFILE»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::ConstantColor-»
+org.eclipse.draw2d.ColorConstants.«value.literal-»
+«ENDDEFINE»
+
+«DEFINE font(Figure figure, EString figureVarName) FOR gmfgraph::BasicFont-»
+«LET figure.name + "_FONT" AS variableName»
+«figureVarName».setFont(«variableName»);
+«FILE "" staticFields»
+static final org.eclipse.swt.graphics.Font «variableName» = new org.eclipse.swt.graphics.Font(org.eclipse.swt.widgets.Display.getCurrent(), «IF null == faceName || faceName.trim().length() == 0»org.eclipse.swt.widgets.Display.getDefault().getSystemFont().getFontData()[0].getName()«ELSE»"«faceName»"«ENDIF», «height», org.eclipse.swt.SWT.«style.literal»);
+«ENDFILE»
+«ENDLET»
+«ENDDEFINE»
+

Back to the top