Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java')
-rw-r--r--deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java139
1 files changed, 0 insertions, 139 deletions
diff --git a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java b/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java
deleted file mode 100644
index 550739c32e3..00000000000
--- a/deprecated/deprecated-plugins/uml.deprecated/org.eclipse.papyrus.diagram.sequence/src/org/eclipse/papyrus/diagram/sequence/part/UMLCreateShortcutAction.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2007 Conselleria de Infraestructuras y Transporte,
- * Generalitat de la Comunitat Valenciana . 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: Gabriel Merin Cubero (Prodevelop) – Sequence Diagram implementation
- *
- ******************************************************************************/
-package org.eclipse.papyrus.diagram.sequence.part;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-import org.eclipse.papyrus.diagram.common.util.DiagramEditPartsUtil;
-import org.eclipse.papyrus.diagram.sequence.edit.commands.UMLCreateShortcutDecorationsCommand;
-import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartment2EditPart;
-import org.eclipse.papyrus.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
-import org.eclipse.papyrus.diagram.sequence.edit.parts.PackageEditPart;
-
-/**
- * @generated
- */
-public class UMLCreateShortcutAction implements IObjectActionDelegate {
-
- /**
- * @generated
- */
- private GraphicalEditPart mySelectedElement;
-
- /**
- * @generated
- */
- private Shell myShell;
-
- /**
- * @generated
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- myShell = targetPart.getSite().getShell();
- }
-
- /**
- * @generated
- */
- public void selectionChanged(IAction action, ISelection selection) {
- mySelectedElement = null;
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection.size() == 1) {
- if (structuredSelection.getFirstElement() instanceof PackageEditPart) {
- mySelectedElement = (PackageEditPart) structuredSelection
- .getFirstElement();
- }
- if (structuredSelection.getFirstElement() instanceof InteractionInteractionCompartmentEditPart) {
- mySelectedElement = (InteractionInteractionCompartmentEditPart) structuredSelection
- .getFirstElement();
- }
- if (structuredSelection.getFirstElement() instanceof InteractionInteractionCompartment2EditPart) {
- mySelectedElement = (InteractionInteractionCompartment2EditPart) structuredSelection
- .getFirstElement();
- }
- }
- }
- action.setEnabled(isEnabled());
- }
-
- /**
- * @generated
- */
- private boolean isEnabled() {
- return mySelectedElement != null;
- }
-
- /**
- * @generated
- */
- public void run(IAction action) {
- final View view = (View) mySelectedElement.getModel();
- UMLElementChooserDialog elementChooser = new UMLElementChooserDialog(
- myShell, view);
- int result = elementChooser.open();
- if (result != Window.OK) {
- return;
- }
- URI selectedModelElementURI = elementChooser
- .getSelectedModelElementURI();
- final EObject selectedElement;
- try {
- selectedElement = mySelectedElement.getEditingDomain()
- .getResourceSet().getEObject(selectedModelElementURI, true);
- } catch (WrappedException e) {
- UMLDiagramEditorPlugin
- .getInstance()
- .logError(
- "Exception while loading object: " + selectedModelElementURI.toString(), e); //$NON-NLS-1$
- return;
- }
-
- if (selectedElement == null) {
- return;
- }
- CreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(
- new EObjectAdapter(selectedElement), Node.class, null,
- UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- ICommand command = new CreateCommand(mySelectedElement
- .getEditingDomain(), viewDescriptor, view);
- command = command.compose(new UMLCreateShortcutDecorationsCommand(
- mySelectedElement.getEditingDomain(), view, viewDescriptor));
- try {
- OperationHistoryFactory.getOperationHistory().execute(command,
- new NullProgressMonitor(), null);
- DiagramEditPartsUtil.updateDiagram(mySelectedElement);
- } catch (ExecutionException e) {
- UMLDiagramEditorPlugin.getInstance().logError(
- "Unable to create shortcut", e); //$NON-NLS-1$
- }
- }
-
-}

Back to the top