Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2008-12-29 07:41:38 -0500
committerashatalin2008-12-29 07:41:38 -0500
commitfc1dfb3b462e159eec1b6031bb41ab79c762474b (patch)
tree66acb7873f68640147106dcd919a5041ecbc918b /plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views
parent7f3bb1960b122d5d9c4edae8dc1c330032c9cf60 (diff)
downloadorg.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.tar.gz
org.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.tar.xz
org.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.zip
QVTO-based xpand implementation was merged to HEAD
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/CompartmentViewFactory.xpt91
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/DiagramViewFactory.xpt40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/FloatingLabelViewFactory.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelNodeViewFactory.xpt44
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelViewFactory.xpt34
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LinkViewFactory.xpt54
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/NodeViewFactory.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt111
8 files changed, 514 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/CompartmentViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/CompartmentViewFactory.xpt
new file mode 100644
index 000000000..fbae97bdf
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/CompartmentViewFactory.xpt
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE CompartmentViewFactory FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «IF canCollapse-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDrawerStyle());
+ «ENDIF-»
+ «IF needsTitle-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle());
+ «ENDIF-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
+ «IF isStoringChildPositions(node.getLayoutType())-»
+ «EXPAND xpt::diagram::views::Utils::addShapeStyle('styles') FOR viewmap-»
+ «ENDIF-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ «EXPAND xpt::diagram::views::Utils::foregroundColour('view') FOR viewmap-»
+ }
+ «IF isStoringChildPositions(node.getLayoutType())-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.LayoutConstraint createLayoutConstraint() {
+ return org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void initializeFromPreferences(org.eclipse.gmf.runtime.notation.View view) {
+ super.initializeFromPreferences(view);
+ org.eclipse.jface.preference.IPreferenceStore store =
+ (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore();
+ org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store,
+ org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FILL_COLOR);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view,
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(),
+ org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
+ }
+ «ENDIF-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setupCompartmentTitle(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.TitleStyle titleStyle = (org.eclipse.gmf.runtime.notation.TitleStyle) view.getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null){
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setupCompartmentCollapsed(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.DrawerStyle drawerStyle = (org.eclipse.gmf.runtime.notation.DrawerStyle) view.getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null){
+ drawerStyle.setCollapsed(false);
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCompartment»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/DiagramViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/DiagramViewFactory.xpt
new file mode 100644
index 000000000..863064c28
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/DiagramViewFactory.xpt
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE DiagramViewFactory FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+«IF units <> null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.MeasurementUnit getMeasurementUnit() {
+ return org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpper()»_LITERAL;
+ }
+«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/FloatingLabelViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/FloatingLabelViewFactory.xpt
new file mode 100644
index 000000000..f50da15e8
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/FloatingLabelViewFactory.xpt
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE FloatingLabelViewFactory FOR gmfgen::GenLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.notation.View createView(org.eclipse.core.runtime.IAdaptable semanticAdapter,
+ org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted,
+ org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ org.eclipse.gmf.runtime.notation.Node view = (org.eclipse.gmf.runtime.notation.Node) super.createView(
+ semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ «EXPAND offset-»
+ return view;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addTextStyle('styles') FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE offset FOR gmfgen::GenLabel-»
+«ENDDEFINE»
+
+«DEFINE offset FOR gmfgen::GenLinkLabel-»
+ «LET labelOffsetX(viewmap, 0) AS x-»
+ «LET labelOffsetY(viewmap, 0) AS y-»
+ «IF x <> 0 or y <> 0-»
+ «EXPAND offset(x, y)-»
+ «ENDIF-»
+ «ENDLET-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE offset FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND offset(0, 5)-»
+«ENDDEFINE»
+
+«DEFINE offset(x : Integer, y : Integer) FOR gmfgen::GenLabel-»
+ org.eclipse.gmf.runtime.notation.Location location = (org.eclipse.gmf.runtime.notation.Location) view.getLayoutConstraint();
+ org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode mapMode =
+ org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(«x»));
+ location.setY(mapMode.DPtoLP(«y»));
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLabel»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelNodeViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelNodeViewFactory.xpt
new file mode 100644
index 000000000..78336e585
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelNodeViewFactory.xpt
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE LabelNodeViewFactory FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle('styles')-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ «EXPAND xpt::diagram::views::Utils::foregroundColour('view') FOR viewmap-»
+ «EXPAND xpt::diagram::views::Utils::backgroundColour('view') FOR viewmap-»
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelViewFactory.xpt
new file mode 100644
index 000000000..df5f3943b
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LabelViewFactory.xpt
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE LabelViewFactory FOR gmfgen::GenNodeLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addTextStyle('styles') FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNodeLabel»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LinkViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LinkViewFactory.xpt
new file mode 100644
index 000000000..636555d30
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/LinkViewFactory.xpt
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE LinkViewFactory FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «IF not isFixedForeground(viewmap)-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnectorStyle());
+ «ELSE-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle());
+ «ENDIF-»
+ «IF not isFixedFont(viewmap)-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
+ «ENDIF-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ «EXPAND xpt::diagram::views::Utils::foregroundColour('view') FOR viewmap-»
+ «IF labels->size() > 0-»
+ org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
+ «EXPAND xpt::diagram::views::Utils::domainElementAdapter('eObjectAdapter') FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
+ «ENDIF-»
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/NodeViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/NodeViewFactory.xpt
new file mode 100644
index 000000000..5558f9a0f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/NodeViewFactory.xpt
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE NodeViewFactory FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory {
+
+ «EXPAND createStyles-»
+
+ «EXPAND decorateView-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createStyles FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addShapeStyle('styles') FOR viewmap-»
+ «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle('styles')-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles('styles')-»
+ return styles;
+ }
+«ENDDEFINE»
+
+«DEFINE decorateView FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ «EXPAND addShortcut-»
+ «EXPAND xpt::diagram::views::Utils::foregroundColour('view') FOR viewmap-»
+ «EXPAND xpt::diagram::views::Utils::backgroundColour('view') FOR viewmap-»
+ «IF labels->size() > 0 or compartments->size() > 0-»
+ org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
+ «EXPAND xpt::diagram::views::Utils::domainElementAdapter('eObjectAdapter') FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
+ «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH compartments-»
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE addShortcut FOR gmfgen::GenNode-»
+«ENDDEFINE»
+
+«DEFINE addShortcut FOR gmfgen::GenTopLevelNode-»
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(
+ «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(containerView))) {
+ «EXPAND xpt::Common::addShortcutAnnotation('view') FOR getDiagram()-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
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
new file mode 100644
index 000000000..33eba2ec3
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE updateSemanticHint FOR gmfgen::GenCommonBase-»
+ if (semanticHint == null) {
+ semanticHint = «getDiagram().getVisualIDRegistryQualifiedClassName()».getType(
+ «getEditPartQualifiedClassName()».VISUAL_ID);
+ view.setType(semanticHint);
+ }
+«ENDDEFINE»
+
+«DEFINE createChildNode FOR gmfgen::GenCommonBase-»
+ getViewService().createNode(eObjectAdapter, view,
+ «getDiagram().getVisualIDRegistryQualifiedClassName()».getType(«getEditPartQualifiedClassName()».VISUAL_ID),
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true, getPreferencesHint());
+«ENDDEFINE»
+
+«DEFINE domainElementAdapter(adapterVar : String) FOR gmfgen::ModelFacet-»
+«ENDDEFINE»
+
+«DEFINE domainElementAdapter(adapterVar : String) FOR gmfgen::TypeModelFacet-»
+ org.eclipse.emf.ecore.EObject eObject =
+ (org.eclipse.emf.ecore.EObject) semanticAdapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ if (eObject != null) {
+ «adapterVar» = new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(eObject);
+ }
+«ENDDEFINE»
+
+«DEFINE foregroundColour(viewVar : String) FOR gmfgen::Viewmap-»
+ «EXPAND foregroundColour(viewVar) FOREACH attributes-»
+«ENDDEFINE»
+
+«DEFINE foregroundColour(viewVar : String) FOR gmfgen::Attributes-»
+«ENDDEFINE»
+
+«DEFINE foregroundColour(viewVar : String) FOR gmfgen::ColorAttributes-»
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar»,
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(),
+ org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.colorToInteger(
+ org.eclipse.draw2d.ColorConstants.«foregroundColor»));
+«ENDDEFINE»
+
+«DEFINE backgroundColour(viewVar : String) FOR gmfgen::Viewmap-»
+ «EXPAND backgroundColour(viewVar) FOREACH attributes-»
+«ENDDEFINE»
+
+«DEFINE backgroundColour(viewVar : String) FOR gmfgen::Attributes-»
+«ENDDEFINE»
+
+«DEFINE backgroundColour(viewVar : String) FOR gmfgen::ColorAttributes-»
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar»,
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(),
+ org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.colorToInteger(
+ org.eclipse.draw2d.ColorConstants.«backgroundColor»));
+«ENDDEFINE»
+
+«DEFINE addShapeStyle(stylesVar : String) FOR gmfgen::Viewmap-»
+ «IF isFixedFont(self)-»
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFillStyle());
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLineStyle());
+ «ELSE-»
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle());
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addTextStyle(stylesVar : String) FOR gmfgen::LabelModelFacet-»
+«ENDDEFINE»
+
+«DEFINE addTextStyle(stylesVar : String) FOR gmfgen::DesignLabelModelFacet-»
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
+«ENDDEFINE»
+
+«DEFINE addLinkedDiagramStyle(stylesVar : String) FOR gmfgen::GenCommonBase-»
+ «EXPAND addLinkedDiagramStyle(stylesVar) FOREACH behaviour-»
+«ENDDEFINE»
+
+«DEFINE addLinkedDiagramStyle(stylesVar : String) FOR gmfgen::Behaviour-»
+«ENDDEFINE»
+
+«DEFINE addLinkedDiagramStyle(stylesVar : String) FOR gmfgen::OpenDiagramBehaviour-»
+ {
+ org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet =
+ org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ «IF diagramKind <> null-»
+ diagramFacet.setHint("«diagramKind»"); // $NON-NLS-1$
+ «ENDIF-»
+ «stylesVar».add(diagramFacet);
+ }
+«ENDDEFINE»
+
+«DEFINE addCustomStyles(stylesVar : String) FOR gmfgen::GenCommonBase-»
+ «FOREACH styles->asSequence() AS style-»
+ «stylesVar».add(«EXPAND MetaModel::NewInstance FOR style»);
+ «ENDFOREACH-»
+«ENDDEFINE»

Back to the top