diff options
Diffstat (limited to 'extraplugins/revision/org.eclipse.papyrus.revisiontool/src/org/eclipse/papyrus/revision/tool/handlers/ReviewCreateHandler.java')
-rw-r--r-- | extraplugins/revision/org.eclipse.papyrus.revisiontool/src/org/eclipse/papyrus/revision/tool/handlers/ReviewCreateHandler.java | 77 |
1 files changed, 16 insertions, 61 deletions
diff --git a/extraplugins/revision/org.eclipse.papyrus.revisiontool/src/org/eclipse/papyrus/revision/tool/handlers/ReviewCreateHandler.java b/extraplugins/revision/org.eclipse.papyrus.revisiontool/src/org/eclipse/papyrus/revision/tool/handlers/ReviewCreateHandler.java index 11063119545..b8e01f69897 100644 --- a/extraplugins/revision/org.eclipse.papyrus.revisiontool/src/org/eclipse/papyrus/revision/tool/handlers/ReviewCreateHandler.java +++ b/extraplugins/revision/org.eclipse.papyrus.revisiontool/src/org/eclipse/papyrus/revision/tool/handlers/ReviewCreateHandler.java @@ -1,31 +1,29 @@ +/***************************************************************************** + * 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: + * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr - Initial API and implementation + * + *****************************************************************************/ package org.eclipse.papyrus.revision.tool.handlers; -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.revision.tool.ui.ReviewsEditor; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.uml2.uml.Element; /** - * Our sample handler extends AbstractHandler, an IHandler base class. - * @see org.eclipse.core.commands.IHandler - * @see org.eclipse.core.commands.AbstractHandler + * This handler is used to create a review in the review editor */ -public class ReviewCreateHandler extends AbstractHandler { +public class ReviewCreateHandler extends RevisionAbstractHandler { /** * The constructor. */ @@ -46,48 +44,5 @@ public class ReviewCreateHandler extends AbstractHandler { return null; } - /** - * getSelected element in the diagram or in hte model explorer - * @return Element or null - */ - protected Element getSelection(){ - org.eclipse.uml2.uml.Element selectedElement =null; - ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); - ISelection selection = selectionService.getSelection(); - - if(selection instanceof IStructuredSelection) { - Object selectedobject = ((IStructuredSelection)selection).getFirstElement(); - if (selectedobject instanceof org.eclipse.uml2.uml.Element){ - selectedElement=(Element)selectedobject; - } - - return selectedElement; - } - return null; - } - /** - * getSelected element in the diagram or in hte model explorer - * @return Element or null - */ - protected ArrayList<Element> getSelectionSet(){ - ArrayList<Element> selectedSet =new ArrayList<Element>(); - ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); - ISelection selection = selectionService.getSelection(); - - //look for papyrus - - if(selection instanceof IStructuredSelection) { - @SuppressWarnings("rawtypes") - Iterator selectedobjectIteractor = ((IStructuredSelection)selection).iterator(); - while (selectedobjectIteractor.hasNext()) { - Object currentSelection = selectedobjectIteractor.next(); - if (currentSelection instanceof org.eclipse.uml2.uml.Element){ - selectedSet.add((Element)currentSelection); - } - } - - - } - return selectedSet; - } + } |