Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MarkerNavigationProvider.xpt')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MarkerNavigationProvider.xpt86
1 files changed, 86 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MarkerNavigationProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MarkerNavigationProvider.xpt
new file mode 100644
index 000000000..4c99ec092
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MarkerNavigationProvider.xpt
@@ -0,0 +1,86 @@
+/*
+ * 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'»
+
+«DEFINE MarkerNavigationProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «markerNavigationProviderClassName»
+ extends org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String MARKER_TYPE =
+ «editorGen.plugin.getActivatorQualifiedClassName()».ID + ".«getValidationDiagnosticMarkerType()»"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void doGotoMarker(org.eclipse.core.resources.IMarker marker) {
+ String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
+ if (elementId == null || !(getEditor() instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor)) {
+ return;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor editor =
+ (org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) getEditor();
+ java.util.Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ org.eclipse.emf.ecore.EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
+ if (targetView == null) {
+ return;
+ }
+ org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart) editPartRegistry.get(targetView);
+ if (targetEditPart != null) {
+ «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram(
+ editor, java.util.Arrays.asList(new org.eclipse.gef.EditPart[] { targetEditPart }));
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void deleteMarkers(org.eclipse.core.resources.IResource resource) {
+ try {
+ resource.deleteMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_ZERO);
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Failed to delete validation markers", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static org.eclipse.core.resources.IMarker addMarker(org.eclipse.core.resources.IFile file,
+ String elementId, String location, String message, int statusSeverity) {
+ org.eclipse.core.resources.IMarker marker = null;
+ try {
+ marker = file.createMarker(MARKER_TYPE);
+ marker.setAttribute(org.eclipse.core.resources.IMarker.MESSAGE, message);
+ marker.setAttribute(org.eclipse.core.resources.IMarker.LOCATION, location);
+ marker.setAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
+ int markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
+ if (statusSeverity == org.eclipse.core.runtime.IStatus.WARNING) {
+ markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == org.eclipse.core.runtime.IStatus.ERROR ||
+ statusSeverity == org.eclipse.core.runtime.IStatus.CANCEL) {
+ markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(org.eclipse.core.resources.IMarker.SEVERITY, markerSeverity);
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Failed to create validation marker", e); «EXPAND xpt::Common::nonNLS»
+ }
+ return marker;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»

Back to the top