Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt112
1 files changed, 112 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt
new file mode 100644
index 000000000..b2b938e16
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt
@@ -0,0 +1,112 @@
+/*
+ * 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/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE className FOR gmfgen::GenDiagram»ValidationMarker«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ValidationMarker FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final String KEY = "validation_marker"; //$NON-NLS-1$
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final «EXPAND className»[] EMPTY_ARRAY = new «EXPAND className»[0];
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final String location;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final String message;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final int statusSeverity;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(String location, String message, int statusSeverity) {
+ this.location = location;
+ this.message = message;
+ this.statusSeverity = statusSeverity;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getLocation() {
+ return location;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getMessage() {
+ return message;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int getStatusSeverity() {
+ return statusSeverity;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Map getMarkers(org.eclipse.gef.EditPartViewer viewer) {
+ java.util.Map markers = (java.util.Map) viewer.getProperty(KEY);
+ if (markers == null) {
+ markers = new java.util.HashMap();
+ viewer.setProperty(KEY, markers);
+ }
+ return markers;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Set getMarkers(org.eclipse.gef.EditPartViewer viewer, String viewId, boolean create) {
+ java.util.Set markers = (java.util.Set) getMarkers(viewer).get(viewId);
+ if (markers == null) {
+ if (!create) {
+ return java.util.Collections.EMPTY_SET;
+ }
+ markers = new java.util.HashSet();
+ getMarkers(viewer).put(viewId, markers);
+ }
+ return markers;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «EXPAND className»[] getMarkers(org.eclipse.gef.EditPartViewer viewer, String viewId) {
+ java.util.Set markers = getMarkers(viewer, viewId, false);
+ if (markers.isEmpty()) {
+ return EMPTY_ARRAY;
+ }
+ return («EXPAND className»[]) markers.toArray(new «EXPAND className»[markers.size()]);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void removeAllMarkers(org.eclipse.gef.EditPartViewer viewer) {
+ getMarkers(viewer).clear();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void add(org.eclipse.gef.EditPartViewer viewer, String viewId) {
+ getMarkers(viewer, viewId, true).add(this);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»

Back to the top