diff options
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java | 142 |
1 files changed, 69 insertions, 73 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java index d5ef66d8334..4e3867d408a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/providers/UMLValidationDecoratorProvider.java @@ -1,73 +1,69 @@ -/** - * 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.gef.EditDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.editparts.AbstractConnectionEditPart; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider; -import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider; -import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart; -import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditor; -import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry; - -/** - * @generated - */ -public class UMLValidationDecoratorProvider - extends ValidationDecoratorProvider - implements IDecoratorProvider { - /** - * @generated - */ - public void createDecorators(IDecoratorTarget decoratorTarget) { - EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class); - if (editPart instanceof GraphicalEditPart || - editPart instanceof AbstractConnectionEditPart) { - Object model = editPart.getModel(); - if ((model instanceof View)) { - View view = (View) model; - if (!(view instanceof Edge) && !view.isSetElement()) { - return; - } - } - EditDomain ed = editPart.getViewer().getEditDomain(); - if (!(ed instanceof DiagramEditDomain)) { - return; - } - if (((DiagramEditDomain) ed).getEditorPart() instanceof UMLDiagramEditor) { - decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); - } - } - } - - /** - * @generated - */ - public boolean provides(IOperation operation) { - if (!(operation instanceof CreateDecoratorsOperation)) { - return false; - } - IDecoratorTarget decoratorTarget = - ((CreateDecoratorsOperation) operation).getDecoratorTarget(); - View view = (View) decoratorTarget.getAdapter( - View.class); - return view != null && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view)); - } -} +/**
+ * 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.gef.EditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider;
+import org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.PackageEditPart;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditor;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLVisualIDRegistry;
+
+/**
+ * @generated
+ */
+public class UMLValidationDecoratorProvider extends ValidationDecoratorProvider implements IDecoratorProvider {
+
+ /**
+ * @generated
+ */
+ public void createDecorators(IDecoratorTarget decoratorTarget) {
+ EditPart editPart = (EditPart)decoratorTarget.getAdapter(EditPart.class);
+ if(editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
+ Object model = editPart.getModel();
+ if((model instanceof View)) {
+ View view = (View)model;
+ if(!(view instanceof Edge) && !view.isSetElement()) {
+ return;
+ }
+ }
+ EditDomain ed = editPart.getViewer().getEditDomain();
+ if(!(ed instanceof DiagramEditDomain)) {
+ return;
+ }
+ if(((DiagramEditDomain)ed).getEditorPart() instanceof UMLDiagramEditor) {
+ decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if(!(operation instanceof CreateDecoratorsOperation)) {
+ return false;
+ }
+ IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation)operation).getDecoratorTarget();
+ View view = (View)decoratorTarget.getAdapter(View.class);
+ return view != null && PackageEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view));
+ }
+}
|