Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/CompartmentViewFactory.xpt')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/CompartmentViewFactory.xpt91
1 files changed, 91 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»

Back to the top