diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java | 177 |
1 files changed, 90 insertions, 87 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java index 4c6558bf73b..4966e502599 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationProvider.java @@ -1,87 +1,90 @@ -/** - * Copyright (c) 2014 CEA LIST. - * - * 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: - * CEA LIST - Initial API and implementation - */ -package org.eclipse.papyrus.uml.diagram.statemachine.providers; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.validation.model.IClientSelector; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart; -import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin; -import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLValidationProvider { - /** - * @generated - */ - private static boolean constraintsActive = false; - - /** - * @generated - */ - public static boolean shouldConstraintsBePrivate() { - return false; - } - - /** - * @generated - */ - public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) { - final Runnable op = operation; - Runnable task = new Runnable() { - public void run() { - try { - constraintsActive = true; - op.run(); - } finally { - constraintsActive = false; - } - } - }; - if (editingDomain != null) { - try { - editingDomain.runExclusive(task); - } catch (Exception e) { - UMLDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$ - } - } else { - task.run(); - } - } - - /** - * @generated - */ - static boolean isInDefaultEditorContext(Object object) { - if (shouldConstraintsBePrivate() && !constraintsActive) { - return false; - } - if (object instanceof View) { - return constraintsActive && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View) object)); - } - return true; - } - - /** - * @generated - */ - public static class DefaultCtx implements IClientSelector { - /** - * @generated - */ - public boolean selects(Object object) { - return isInDefaultEditorContext(object); - } - } -} +/**
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ */
+package org.eclipse.papyrus.uml.diagram.statemachine.providers;
+
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.validation.model.IClientSelector;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLValidationProvider {
+
+ /**
+ * @generated
+ */
+ private static boolean constraintsActive = false;
+
+ /**
+ * @generated
+ */
+ public static boolean shouldConstraintsBePrivate() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
+ final Runnable op = operation;
+ Runnable task = new Runnable() {
+
+ public void run() {
+ try {
+ constraintsActive = true;
+ op.run();
+ } finally {
+ constraintsActive = false;
+ }
+ }
+ };
+ if(editingDomain != null) {
+ try {
+ editingDomain.runExclusive(task);
+ } catch (Exception e) {
+ UMLDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$
+ }
+ } else {
+ task.run();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static boolean isInDefaultEditorContext(Object object) {
+ if(shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
+ }
+ if(object instanceof View) {
+ return constraintsActive && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID((View)object));
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static class DefaultCtx implements IClientSelector {
+
+ /**
+ * @generated
+ */
+ public boolean selects(Object object) {
+ return isInDefaultEditorContext(object);
+ }
+ }
+}
|