Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2013-08-09 14:51:02 +0000
committerCamille Letavernier2013-08-09 14:51:02 +0000
commitc4fb8e980348c472d4f849187a1526d902c9ca89 (patch)
treeaf1b8d2198a8cd68f7d679f3a808e8420afcafdd /plugins/uml/diagram
parent97aac38470f7ab344bf31301181b861d8699f7cc (diff)
downloadorg.eclipse.papyrus-c4fb8e980348c472d4f849187a1526d902c9ca89.tar.gz
org.eclipse.papyrus-c4fb8e980348c472d4f849187a1526d902c9ca89.tar.xz
org.eclipse.papyrus-c4fb8e980348c472d4f849187a1526d902c9ca89.zip
414785: [General] Improve performances of common operations for
large-scale models https://bugs.eclipse.org/bugs/show_bug.cgi?id=414785
Diffstat (limited to 'plugins/uml/diagram')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromDiagramCommandHandler.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java60
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java140
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/LoadHandler.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/ParametricAndListeningHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/UnloadHandler.java35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/actions/ManageProvidedInterfacesHandler.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ManageProvidedInterfacesHandler.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/SwitchInteractionFormCommandHandler.java14
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/UpdateDiagramInSnapshotCommandHandler.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DistributionHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DropDownToolBarSameSizeHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/RoutingHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/SizeHandler.java24
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomAlignmentHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomSizeHandler.java35
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java2
21 files changed, 188 insertions, 168 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
index 1bc93c08601..4c4a62bb788 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/META-INF/MANIFEST.MF
@@ -84,7 +84,8 @@ Require-Bundle: org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1",
- org.eclipse.jface
+ org.eclipse.jface,
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="0.10.1"
Bundle-Vendor: %providerName
Ant-Version: Apache Ant 1.7.0
Bundle-Version: 0.10.1.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromDiagramCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromDiagramCommandHandler.java
index 3430432e685..aec76b56af1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromDiagramCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromDiagramCommandHandler.java
@@ -26,6 +26,7 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.diagram.ui.actions.internal.DeleteFromDiagramAction;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
@@ -50,7 +51,8 @@ public class DeleteFromDiagramCommandHandler extends GraphicalCommandHandler imp
* @return the deletion command
* @throws ExecutionException
*/
- protected Command getCommand() throws ExecutionException {
+ @Override
+ protected Command getCommand() {
// Retrieve currently selected IGraphicalEditPart(s)
List<IGraphicalEditPart> editParts = getSelectedElements();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java
index 2f58bd36f5d..5fec5833c85 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/DeleteFromModelCommandHandler.java
@@ -14,14 +14,16 @@
package org.eclipse.papyrus.uml.diagram.common.handlers;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.preferences.ConfigurationScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
@@ -31,24 +33,32 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.jface.dialogs.DialogSettings;
+import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.DialogCellEditor;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.swt.widgets.Display;
+import com.google.common.base.Optional;
+
/**
* Command handler for delete from diagram
*/
public class DeleteFromModelCommandHandler extends GraphicalCommandHandler implements IHandler {
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
- protected Command getCommand() throws ExecutionException {
+ if(editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
// Retrieve currently selected IGraphicalEditPart(s)
List<IGraphicalEditPart> editParts = getSelectedElements();
@@ -59,7 +69,7 @@ public class DeleteFromModelCommandHandler extends GraphicalCommandHandler imple
// Iterate over selection and retrieve the deletion command from each
// edit part
// Add each returned command to the composite command
- CompositeTransactionalCommand command = new CompositeTransactionalCommand(getEditingDomain(), "Delete From Model");
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Delete From Model");
Iterator<IGraphicalEditPart> it = editParts.iterator();
while(it.hasNext()) {
@@ -81,6 +91,35 @@ public class DeleteFromModelCommandHandler extends GraphicalCommandHandler imple
return new ICommandProxy(command);
}
+ @Override
+ protected boolean computeEnabled() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ IReadOnlyHandler readOnly = ReadOnlyManager.getReadOnlyHandler(editingDomain);
+
+ for(IGraphicalEditPart editPart : getSelectedElements()) {
+ EObject semantic = EMFHelper.getEObject(editPart);
+ View graphical = NotationHelper.findView(editPart);
+
+ if(readOnly != null) {
+ List<URI> uris = new LinkedList<URI>();
+ if(semantic != null) {
+ uris.add(EcoreUtil.getURI(semantic));
+ }
+
+ if(graphical != null) {
+ uris.add(EcoreUtil.getURI(graphical));
+ }
+
+ Optional<Boolean> result = readOnly.anyReadOnly(uris.toArray(new URI[uris.size()]));
+ if(result.isPresent() && result.get()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
/**
*
* @see org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler#execute(org.eclipse.core.commands.ExecutionEvent)
@@ -91,7 +130,7 @@ public class DeleteFromModelCommandHandler extends GraphicalCommandHandler imple
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- if(canDoAction()) {//the key binding for Delete and Hide action changed, so we display a message for the users
+ if(canDoAction()) {//the key binding for Delete and Hide action changed, so we display a message for the users. TODO: Remove for Luna
return super.execute(event);
}
return null;
@@ -104,6 +143,7 @@ public class DeleteFromModelCommandHandler extends GraphicalCommandHandler imple
* @return
* <code>true</code> if the action can be done
*/
+ //TODO: Remove for Luna
protected boolean canDoAction() {
final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
boolean contains = store.contains(DISPLAY_MESSAGE_FOR_DELETE_ACTION_PREFERENCE_KEY);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
index 616da2c6ef7..229325fd876 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
@@ -13,23 +13,25 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.handlers;
-import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
-import org.eclipse.papyrus.uml.diagram.common.Activator;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
+import org.eclipse.ui.handlers.HandlerUtil;
/**
* This abstract command handler: - calculates the current selection -
@@ -39,7 +41,7 @@ import org.eclipse.ui.PlatformUI;
*/
public abstract class GraphicalCommandHandler extends AbstractHandler {
- protected abstract Command getCommand() throws ExecutionException;
+ protected abstract Command getCommand();
/**
* Iterate over current selection and build a list of the {@link IGraphicalEditPart} contained in the selection.
@@ -47,33 +49,14 @@ public abstract class GraphicalCommandHandler extends AbstractHandler {
* @return the currently selected {@link IGraphicalEditPart}
*/
protected List<IGraphicalEditPart> getSelectedElements() {
- List<IGraphicalEditPart> editparts = new ArrayList<IGraphicalEditPart>();
-
- // Get current selection
- IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- Object selection = (activeWorkbenchWindow != null) ? activeWorkbenchWindow.getSelectionService().getSelection() : null;
-
- // Treat non-null selected object (try to adapt and return EObject)
- if(selection != null) {
-
- if(selection instanceof IStructuredSelection) {
-
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
-
- Iterator<?> it = structuredSelection.iterator();
- while(it.hasNext()) {
- Object object = it.next();
- if(object instanceof IGraphicalEditPart) {
- editparts.add((IGraphicalEditPart)object);
- }
- }
-
- } else if(selection instanceof IGraphicalEditPart) {
- editparts.add((IGraphicalEditPart)selection);
+ List<IGraphicalEditPart> result = new LinkedList<IGraphicalEditPart>();
+ for(Object element : getSelection()) {
+ if(element instanceof IGraphicalEditPart) {
+ result.add((IGraphicalEditPart)element);
}
}
- return editparts;
+ return result;
}
/**
@@ -85,37 +68,76 @@ public abstract class GraphicalCommandHandler extends AbstractHandler {
* @throws ExecutionException
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
+ try {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ this.selection = (selection instanceof IStructuredSelection) ? ((IStructuredSelection)selection).toList() : Collections.EMPTY_LIST;
- TransactionalEditingDomain editingDomain = getEditingDomain();
- Command command = getCommand();
- if(editingDomain != null && command != null) {
- editingDomain.getCommandStack().execute(new GEFtoEMFCommandWrapper(command));
+ getEditingDomain(event).getCommandStack().execute(new GEFtoEMFCommandWrapper(getCommand()));
+ } finally {
+ // clear the selection
+ this.selection = Collections.EMPTY_LIST;
}
return null;
}
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
- * @return true is the command can be executed
- */
- @Override
- public boolean isEnabled() {
-
+ protected TransactionalEditingDomain getEditingDomain(ExecutionEvent event) {
try {
- Command command = getCommand();
- if(command != null && command.canExecute()) {
- return true;
+ return ServiceUtilsForHandlers.getInstance().getTransactionalEditingDomain(event);
+ } catch (ServiceException ex) {
+ return null;
+ }
+ }
+
+ protected TransactionalEditingDomain getEditingDomain() {
+ TransactionalEditingDomain editingDomain = null;
+ for(IGraphicalEditPart editPart : getSelectedElements()) {
+ try {
+ editingDomain = ServiceUtilsForEditPart.getInstance().getTransactionalEditingDomain(editPart);
+ if(editingDomain != null) {
+ break;
+ }
+ } catch (ServiceException ex) {
+ //Keep searching
}
- } catch (ExecutionException e) {
- Activator.log.error(e);
}
- return false;
+ //TODO: From active editor?
+
+ return editingDomain;
}
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ if(evaluationContext instanceof IEvaluationContext) {
+ Object selection = ((IEvaluationContext)evaluationContext).getDefaultVariable();
+ if(selection instanceof Collection<?>) {
+ this.selection = (selection instanceof List<?>) ? (List<?>)selection : new java.util.ArrayList<Object>((Collection<?>)selection);
+ setBaseEnabled(computeEnabled());
+ this.selection = Collections.EMPTY_LIST;
+ }
+ }
+ super.setEnabled(evaluationContext);
+ }
+
+ protected boolean computeEnabled() {
+ boolean result = false;
+
+ Command command = getCommand();
+ if(command != null) {
+ result = getCommand().canExecute();
+ command.dispose();
+ }
+
+ return result;
+ }
+
+ protected List<?> getSelection() {
+ return selection;
+ }
+
+ private List<?> selection = Collections.EMPTY_LIST;
+
/**
*
* @return true if the command can be executed
@@ -123,22 +145,4 @@ public abstract class GraphicalCommandHandler extends AbstractHandler {
public boolean isVisible() {
return isEnabled();
}
-
- /**
- * Retrieves the TransactionalEditingDomain
- *
- * @return the editing domain (can be null)
- */
- protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
- TransactionalEditingDomain editingDomain = null;
- try {
- editingDomain = serviceUtils.getTransactionalEditingDomain();
-
- } catch (ServiceException e) {
- //Ignore and return null
- }
-
- return editingDomain;
- }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/LoadHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/LoadHandler.java
index 255164292e9..dd3832d880d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/LoadHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/LoadHandler.java
@@ -45,7 +45,8 @@ public class LoadHandler extends GraphicalCommandHandler {
* @return the load command
* @throws ExecutionException
*/
- protected Command getCommand() throws ExecutionException {
+ @Override
+ protected Command getCommand() {
TransactionalEditingDomain editingDomain = getEditingDomain();
List<IGraphicalEditPart> selection = getSelectedElements();
if(editingDomain != null && editingDomain.getResourceSet() instanceof ModelSet && selection.size() > 0) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/ParametricAndListeningHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/ParametricAndListeningHandler.java
index 191baf3aa2c..05b4d89b88b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/ParametricAndListeningHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/ParametricAndListeningHandler.java
@@ -82,7 +82,7 @@ public abstract class ParametricAndListeningHandler extends GraphicalCommandHand
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
addSelectionListener();
return UnexecutableCommand.INSTANCE;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/UnloadHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/UnloadHandler.java
index e266354b6d0..2f161f0031e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/UnloadHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/UnloadHandler.java
@@ -28,11 +28,6 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.services.resourceloading.util.LoadingUtils;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
/**
* Handler for the load resource action. This actions load a resource in the
@@ -91,34 +86,4 @@ public class UnloadHandler extends GraphicalCommandHandler {
return UnexecutableCommand.INSTANCE;
}
- /**
- * Get currently opened editor
- *
- * @return editor
- */
- protected IEditorPart getEditor() {
- IEditorPart editor = null;
- IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow();
- if(activeWorkbenchWindow != null) {
- IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if(activePage != null) {
- editor = activePage.getActiveEditor();
- }
- }
- return editor;
- }
-
- /**
- * Get the active workbench window
- *
- * @return window
- */
- protected IWorkbenchWindow getActiveWorkbenchWindow() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null) {
- return workbench.getActiveWorkbenchWindow();
- }
- return null;
- }
-
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/actions/ManageProvidedInterfacesHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/actions/ManageProvidedInterfacesHandler.java
index 9736dc974e6..4db78ba0efe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/actions/ManageProvidedInterfacesHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/actions/ManageProvidedInterfacesHandler.java
@@ -29,6 +29,7 @@ import org.eclipse.papyrus.uml.diagram.component.custom.messages.Messages;
import org.eclipse.papyrus.uml.diagram.component.custom.ui.InterfaceManagerDialog;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.PortEditPart;
import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Type;
@@ -40,13 +41,14 @@ public class ManageProvidedInterfacesHandler extends GraphicalCommandHandler {
/**
* Gets the command.
- *
+ *
* @return the command
- * @throws ExecutionException the execution exception
+ * @throws ExecutionException
+ * the execution exception
* @see org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler#getCommand()
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
List<IGraphicalEditPart> selection = getSelectedElements();
if(selection.size() != 1) {
return UnexecutableCommand.INSTANCE;
@@ -85,9 +87,9 @@ public class ManageProvidedInterfacesHandler extends GraphicalCommandHandler {
/**
* Returns the command to add/remove provided/required interfaces.
- *
+ *
* @return the command
- * the command to add/remove provided/required interfaces
+ * the command to add/remove provided/required interfaces
*/
public Command getCommand() {
if(type != null && !(type instanceof Classifier)) {
@@ -107,7 +109,7 @@ public class ManageProvidedInterfacesHandler extends GraphicalCommandHandler {
/**
* Checks if is enabled.
- *
+ *
* @return true, if is enabled
* @see org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler#isEnabled()
*/
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ManageProvidedInterfacesHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ManageProvidedInterfacesHandler.java
index 82773b4790c..5f0816a84af 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ManageProvidedInterfacesHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/actions/ManageProvidedInterfacesHandler.java
@@ -29,6 +29,7 @@ import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages;
import org.eclipse.papyrus.uml.diagram.composite.custom.ui.InterfaceManagerDialog;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortEditPart;
import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Type;
@@ -48,7 +49,7 @@ public class ManageProvidedInterfacesHandler extends GraphicalCommandHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
List<IGraphicalEditPart> selection = getSelectedElements();
if(selection.size() != 1) {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/SwitchInteractionFormCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/SwitchInteractionFormCommandHandler.java
index 7049c949d2c..721c65c472e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/SwitchInteractionFormCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/SwitchInteractionFormCommandHandler.java
@@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -29,14 +28,13 @@ import org.eclipse.papyrus.uml.diagram.interactionoverview.part.Messages;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForDo;
import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshCommandForUndo;
-public class SwitchInteractionFormCommandHandler extends
- GraphicalCommandHandler {
+public class SwitchInteractionFormCommandHandler extends GraphicalCommandHandler {
@Override
- protected Command getCommand() throws ExecutionException {
-
+ protected Command getCommand() {
+
List<IGraphicalEditPart> elements = getSelectedElements();
- if(elements.size() == 1 && elements.get(0) instanceof CustomInteractionUseEditPartCN){
+ if(elements.size() == 1 && elements.get(0) instanceof CustomInteractionUseEditPartCN) {
CustomInteractionUseEditPartCN callBehaviorActionEditPart = (CustomInteractionUseEditPartCN)elements.get(0);
View callBehaviorView = (View)callBehaviorActionEditPart.getModel();
CompoundCommand cc = new CompoundCommand(Messages.SwitchInteractionFormCommandHandler_InteractionUseToInteractionCommandTitle);
@@ -44,12 +42,12 @@ public class SwitchInteractionFormCommandHandler extends
cc.add(new RefreshCommandForUndo((GraphicalEditPart)callBehaviorActionEditPart.getParent()));
cc.add(new ICommandProxy(changeCommand));
cc.add(new ICommandProxy(new DestroyElementCommand(new DestroyElementRequest(callBehaviorView, true))));
- CreateSnapshotForInteractionFromViewDescriptorCommand snapshotCommand = new CreateSnapshotForInteractionFromViewDescriptorCommand(getEditingDomain(), changeCommand, (GraphicalEditPart)callBehaviorActionEditPart.getParent());
+ CreateSnapshotForInteractionFromViewDescriptorCommand snapshotCommand = new CreateSnapshotForInteractionFromViewDescriptorCommand(getEditingDomain(), changeCommand, (GraphicalEditPart)callBehaviorActionEditPart.getParent());
cc.add(new ICommandProxy(snapshotCommand));
cc.add(new ICommandProxy(new AddHyperlinkDiagram(changeCommand, snapshotCommand)));
cc.add(new RefreshCommandForDo((GraphicalEditPart)callBehaviorActionEditPart.getParent()));
return cc;
- }else if(elements.size() == 1 && elements.get(0) instanceof CallBehaviorActionAsInteractionEditPart){
+ } else if(elements.size() == 1 && elements.get(0) instanceof CallBehaviorActionAsInteractionEditPart) {
CallBehaviorActionAsInteractionEditPart callBehaviorActionEditPart = (CallBehaviorActionAsInteractionEditPart)elements.get(0);
View callBehaviorView = (View)callBehaviorActionEditPart.getModel();
CompoundCommand cc = new CompoundCommand(Messages.SwitchInteractionFormCommandHandler_InteractionToInteractionUseCommandTitle);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/UpdateDiagramInSnapshotCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/UpdateDiagramInSnapshotCommandHandler.java
index 89611c2be9e..e7e7a591a25 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/UpdateDiagramInSnapshotCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/commands/UpdateDiagramInSnapshotCommandHandler.java
@@ -12,7 +12,6 @@ package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands;
import java.util.List;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
@@ -27,7 +26,7 @@ import org.eclipse.papyrus.uml.diagram.timing.custom.edit.commands.RefreshComman
public class UpdateDiagramInSnapshotCommandHandler extends GraphicalCommandHandler {
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
final CompoundCommand cmd = new CompoundCommand(Messages.UpdateDiagramInSnapshotCommandHandler_updateDiagram);
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
for(final IGraphicalEditPart selectedElement : selectedElements) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
index a4b41955fb7..a33bfa3e5ba 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
@@ -49,7 +49,7 @@ public class AlignementHandler extends ParametricAndListeningHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
super.getCommand();
this.action = new CustomAlignAction(getAlignment(this.parameter), this.getSelectedElements());
Command cmd = action.getCommand();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DistributionHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DistributionHandler.java
index 219a995ee60..3b9481018b2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DistributionHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DistributionHandler.java
@@ -47,7 +47,7 @@ public class DistributionHandler extends ParametricAndListeningHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
super.getCommand();
this.action = new DistributeLinkNodeAction(this.parameter, getSelectedElements());
Command cmd = action.getCommand();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DropDownToolBarSameSizeHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DropDownToolBarSameSizeHandler.java
index d0b13bd8255..9913869f2bc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DropDownToolBarSameSizeHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/DropDownToolBarSameSizeHandler.java
@@ -34,7 +34,7 @@ public class DropDownToolBarSameSizeHandler extends GraphicalCommandHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
SizeAction action = new SizeAction(SizeAction.PARAMETER_BOTH, getSelectedElements());
return action.getCommand();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/RoutingHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/RoutingHandler.java
index 28c9260054d..90b9a702635 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/RoutingHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/RoutingHandler.java
@@ -41,7 +41,7 @@ public class RoutingHandler extends ParametricAndListeningHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
super.getCommand();
this.action = new RouteAction(this.parameter, this.getSelectedElements());
Command cmd = action.getCommand();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/SizeHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/SizeHandler.java
index ccea89d9d1c..bf0ab120ce1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/SizeHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/SizeHandler.java
@@ -50,41 +50,41 @@ public class SizeHandler extends ParametricAndListeningHandler {
// Overload the method (execute) to update the position of Scroll Bar
/**
* @see org.eclipse.papyrus.uml.diagram.common.handlers.GraphicalCommandHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
+ *
* @param event
* @return
* @throws ExecutionException
*/
-
+
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
List<IGraphicalEditPart> selem = getSelectedElements();
-
-
+
+
if(!selem.isEmpty()) {
Iterator<IGraphicalEditPart> editParts = selem.iterator();
-
-
+
+
while(editParts.hasNext()) {
EditPart editPart = editParts.next();
List<?> editPartChildS = editPart.getChildren();
-
+
for(int k = 0; k < editPartChildS.size(); k++) {
if(!editPartChildS.isEmpty()) {
EditPart ept = (EditPart)editPartChildS.get(k);
final GraphicalEditPart graphicalEditPart = (GraphicalEditPart)ept;
- final IFigure fig = graphicalEditPart.getFigure();
-
+ final IFigure fig = graphicalEditPart.getFigure();
+
if(fig instanceof ResizableCompartmentFigure) {
ScrollPane fScrollPane = ((ResizableCompartmentFigure)fig).getScrollPane();
if(fScrollPane != null) {
fScrollPane.scrollHorizontalTo(0);
- fScrollPane.scrollVerticalTo(0);
+ fScrollPane.scrollVerticalTo(0);
}
}
}
@@ -102,11 +102,11 @@ public class SizeHandler extends ParametricAndListeningHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
super.getCommand();
SizeAction action = new SizeAction(this.parameter, getSelectedElements());
Command cmd = action.getCommand();
-
+
return (cmd == null) ? UnexecutableCommand.INSTANCE : cmd;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomAlignmentHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomAlignmentHandler.java
index 8927d1b5c6a..2495fab8af2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomAlignmentHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomAlignmentHandler.java
@@ -36,7 +36,7 @@ public class CustomAlignmentHandler extends AlignementHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
return super.getCommand();
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomSizeHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomSizeHandler.java
index c223c18dc1a..fdfa473867d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomSizeHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/handlers/CustomSizeHandler.java
@@ -53,7 +53,7 @@ public class CustomSizeHandler extends SizeHandler {
* @throws ExecutionException
*/
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
super.getCommand();
CustomSizeAction action = new CustomSizeAction(this.parameter, getSelectedElements());
Command cmd = action.getCommand();
@@ -78,6 +78,7 @@ public class CustomSizeHandler extends SizeHandler {
* @return
* Return the command for the Same Height Action
*/
+ @Override
protected Command getHeightCommand() {
if(!(this.selectedElements.size() > 1)) {
return UnexecutableCommand.INSTANCE;
@@ -96,10 +97,11 @@ public class CustomSizeHandler extends SizeHandler {
Integer previousWidth = (Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Width());
Integer previousHeight = (Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Height());
Dimension previousSize;
- if(previousWidth.intValue() == -1 || previousHeight.intValue() == -1)
+ if(previousWidth.intValue() == -1 || previousHeight.intValue() == -1) {
previousSize = toResize.getFigure().getSize().getCopy();
- else
+ } else {
previousSize = new Dimension(previousWidth.intValue(), previousHeight.intValue());
+ }
// Calculate delta resize
Dimension delta = new Dimension(0, primarySize.height - previousSize.height);
if(isLifelines()) {
@@ -119,7 +121,7 @@ public class CustomSizeHandler extends SizeHandler {
// size.width = ((Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Width())).intValue();
// doResizeCmd.add(new ICommandProxy(new SetBoundsCommand(toResize.getEditingDomain(), "", new EObjectAdapter(resizeView), size))); //$NON-NLS-1$
//
- doResizeCmd.add(resizeCommand); //$NON-NLS-1$
+ doResizeCmd.add(resizeCommand);
}
return doResizeCmd.unwrap();
}
@@ -161,10 +163,11 @@ public class CustomSizeHandler extends SizeHandler {
Integer width = (Integer)ViewUtil.getStructuralFeatureValue(primaryView, NotationPackage.eINSTANCE.getSize_Width());
Integer height = (Integer)ViewUtil.getStructuralFeatureValue(primaryView, NotationPackage.eINSTANCE.getSize_Height());
Dimension primarySize;
- if(width.intValue() == -1 || height.intValue() == -1)
+ if(width.intValue() == -1 || height.intValue() == -1) {
primarySize = primaryChild.getFigure().getSize().getCopy();
- else
+ } else {
primarySize = new Dimension(width.intValue(), height.intValue());
+ }
return primarySize;
}
@@ -174,6 +177,7 @@ public class CustomSizeHandler extends SizeHandler {
* @return
* the command for the Same Width Action
*/
+ @Override
protected Command getWidthCommand() {
if(!(this.selectedElements.size() > 1)) {
return UnexecutableCommand.INSTANCE;
@@ -192,10 +196,11 @@ public class CustomSizeHandler extends SizeHandler {
Integer previousWidth = (Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Width());
Integer previousHeight = (Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Height());
Dimension previousSize;
- if(previousWidth.intValue() == -1 || previousHeight.intValue() == -1)
+ if(previousWidth.intValue() == -1 || previousHeight.intValue() == -1) {
previousSize = toResize.getFigure().getSize().getCopy();
- else
+ } else {
previousSize = new Dimension(previousWidth.intValue(), previousHeight.intValue());
+ }
// Calculate delta resize
Dimension delta = new Dimension(primarySize.width - previousSize.width, 0);
// Prepare setBoundRequest
@@ -209,7 +214,7 @@ public class CustomSizeHandler extends SizeHandler {
// size.height = ((Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Height())).intValue();
// doResizeCmd.add(new ICommandProxy(new SetBoundsCommand(toResize.getEditingDomain(), "", new EObjectAdapter(resizeView), size))); //$NON-NLS-1$
//
- doResizeCmd.add(resizeCommand); //$NON-NLS-1$
+ doResizeCmd.add(resizeCommand);
}
return doResizeCmd.unwrap();
}
@@ -239,10 +244,11 @@ public class CustomSizeHandler extends SizeHandler {
Integer height = (Integer)ViewUtil.getStructuralFeatureValue(primaryView, NotationPackage.eINSTANCE.getSize_Height());
Dimension primarySize;
- if(width.intValue() == -1 || height.intValue() == -1)
+ if(width.intValue() == -1 || height.intValue() == -1) {
primarySize = primary.getFigure().getSize().getCopy();
- else
+ } else {
primarySize = new Dimension(width.intValue(), height.intValue());
+ }
while(iter.hasNext()) {
@@ -255,10 +261,11 @@ public class CustomSizeHandler extends SizeHandler {
Integer previousHeight = (Integer)ViewUtil.getStructuralFeatureValue(resizeView, NotationPackage.eINSTANCE.getSize_Height());
Dimension previousSize;
- if(previousWidth.intValue() == -1 || previousHeight.intValue() == -1)
+ if(previousWidth.intValue() == -1 || previousHeight.intValue() == -1) {
previousSize = toResize.getFigure().getSize().getCopy();
- else
+ } else {
previousSize = new Dimension(previousWidth.intValue(), previousHeight.intValue());
+ }
// Calculate delta resize
Dimension delta = new Dimension(primarySize.width - previousSize.width, primarySize.height - previousSize.height);
@@ -281,7 +288,7 @@ public class CustomSizeHandler extends SizeHandler {
// doResizeCmd.add(new ICommandProxy(new SetBoundsCommand(toResize.getEditingDomain(), "", new EObjectAdapter(resizeView), primarySize))); //$NON-NLS-1$
//
- doResizeCmd.add(resizeCommand); //$NON-NLS-1$
+ doResizeCmd.add(resizeCommand);
}
return doResizeCmd.unwrap();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
index 638957b0d83..b8c89a5f5e5 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/CreateTickCommand.java
@@ -42,7 +42,7 @@ import org.eclipse.uml2.uml.OccurrenceSpecification;
public class CreateTickCommand extends GraphicalCommandHandler {
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
final CompoundCommand cmd = new CompoundCommand(Messages.CreateTickCommand_attachTick);
final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
if(!selection.isEmpty() && selection instanceof IStructuredSelection) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
index 885f22fc316..96d8a110cab 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/SwitchLifelineCommand.java
@@ -568,7 +568,7 @@ public class SwitchLifelineCommand extends GraphicalCommandHandler {
}
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
final CompoundCommand cmd = new CompoundCommand(Messages.SwitchLifelineCommand_switchLifeline);
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
for(final IGraphicalEditPart selectedElement : selectedElements) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
index edb24a1c7b3..176a66971e7 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/edit/commands/ToggleTimeRulerVisibility.java
@@ -37,7 +37,7 @@ import org.eclipse.papyrus.uml.diagram.timing.edit.parts.LifelineEditPart;
public class ToggleTimeRulerVisibility extends GraphicalCommandHandler {
@Override
- protected Command getCommand() throws ExecutionException {
+ protected Command getCommand() {
final CompoundCommand cmd = new CompoundCommand(Messages.ToggleTimeRulerVisibility_ToggleTimeRulerVisibility);
final List<IGraphicalEditPart> selectedElements = getSelectedElements();
boolean first = true;

Back to the top