summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-05-12 11:47:02 (EDT)
committerCamille Letavernier2014-06-03 08:29:42 (EDT)
commit409470bff9506071ebd070bb51f333136a708b4a (patch)
tree996d18671d4b28187a61e5b347fd47c8bcb7303b
parent0bebe4750e7bc769d984ce3a8dd5dab24b2db274 (diff)
downloadorg.eclipse.papyrus-409470bff9506071ebd070bb51f333136a708b4a.zip
org.eclipse.papyrus-409470bff9506071ebd070bb51f333136a708b4a.tar.gz
org.eclipse.papyrus-409470bff9506071ebd070bb51f333136a708b4a.tar.bz2
Clean - Patch a warning on an unused variable inside a catch conditionrefs/changes/83/26383/4
Change-Id: I617abc3f75177c1c6c6cc862161758497cef06fe Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/AddToResourceCommand.java200
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/RemoveFromResourcecommand.java264
2 files changed, 232 insertions, 232 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/AddToResourceCommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/AddToResourceCommand.java
index 52ee15b..39d6397 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/AddToResourceCommand.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/AddToResourceCommand.java
@@ -1,100 +1,100 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.commands;
-
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-
-/**
- *
- * This command allows to add an EObject to a resource
- *
- */
-public class AddToResourceCommand extends AbstractCommand {
-
- /**
- * the resource
- */
- private final Resource resource;
-
- /**
- * the object to add to the resource
- */
- private final EObject toAdd;
-
- /**
- *
- * Constructor.
- *
- * @param resource
- * the resource
- * @param toAdd
- * the objectto add to the resource
- */
- public AddToResourceCommand(final Resource resource, final EObject toAdd) {
- this.resource = resource;
- this.toAdd = toAdd;
- setLabel("Add an object to a resource");
- }
-
- /**
- *
- * @see org.eclipse.emf.common.command.Command#execute()
- *
- */
- public void execute() {
- this.resource.getContents().add(this.toAdd);
- }
-
- /**
- *
- * @see org.eclipse.emf.common.command.Command#redo()
- *
- */
- public void redo() {
- execute();
- }
-
- /**
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
- *
- */
- @Override
- protected boolean prepare() {
- return true;
- }
-
-
- /**
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#undo()
- *
- */
- @Override
- public void undo() {
- this.resource.getContents().remove(this.toAdd);
- }
-
- /**
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
- *
- */
- @Override
- public boolean canExecute() {
- return super.canExecute() && this.resource != null;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.commands;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ *
+ * This command allows to add an EObject to a resource
+ *
+ */
+public class AddToResourceCommand extends AbstractCommand {
+
+ /**
+ * the resource
+ */
+ private final Resource resource;
+
+ /**
+ * the object to add to the resource
+ */
+ private final EObject toAdd;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param resource
+ * the resource
+ * @param toAdd
+ * the object to add to the resource
+ */
+ public AddToResourceCommand(final Resource resource, final EObject toAdd) {
+ this.resource = resource;
+ this.toAdd = toAdd;
+ setLabel("Add an object to a resource");
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ *
+ */
+ public void execute() {
+ this.resource.getContents().add(this.toAdd);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ *
+ */
+ public void redo() {
+ execute();
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ *
+ */
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ *
+ */
+ @Override
+ public void undo() {
+ this.resource.getContents().remove(this.toAdd);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
+ *
+ */
+ @Override
+ public boolean canExecute() {
+ return super.canExecute() && this.resource != null;
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/RemoveFromResourcecommand.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/RemoveFromResourcecommand.java
index 1d87e22..9079b89 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/RemoveFromResourcecommand.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/commands/RemoveFromResourcecommand.java
@@ -1,132 +1,132 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.commands;
-
-import java.util.Collection;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-/**
- *
- * This command allows to remove elements from a resource
- *
- */
-public class RemoveFromResourcecommand extends RecordingCommand {
-
- /**
- * the managed resource
- */
- final private Resource resource;
-
- /**
- * the element to remove from the resource
- */
- final private EObject toRemove;
-
- /**
- * the list of the elements to remove from the resource
- */
- final private Collection<EObject> elementsToRemove;
-
- /**
- *
- * Constructor.
- *
- * @param domain
- * the editing domain
- * @param resource
- * the resource
- * @param toRemove
- * the element to remove
- */
- public RemoveFromResourcecommand(final TransactionalEditingDomain domain, final Resource resource, final EObject toRemove) {
- this(domain, resource, toRemove, null);
- }
-
- /**
- *
- * Constructor.
- *
- * @param domain
- * the editing domain
- * @param resource
- * the resource
- * @param elementsToRemove
- * the list of the elements to remove
- */
- public RemoveFromResourcecommand(final TransactionalEditingDomain domain, final Resource resource, final Collection<EObject> elementsToRemove) {
- this(domain, resource, null, elementsToRemove);
- }
-
- /**
- *
- * Constructor.
- *
- * @param domain
- * the editing domain
- * @param resource
- * the resource
- * @param toRemove
- * the element to remove
- * @param elementsToRemove
- * the list of the elements to remove
- */
- protected RemoveFromResourcecommand(final TransactionalEditingDomain domain, final Resource resource, final EObject toRemove, final Collection<EObject> elementsToRemove) {
- super(domain, "Remove an EObject from a resource");
- this.resource = resource;
- this.toRemove = toRemove;
- this.elementsToRemove = elementsToRemove;
- }
-
- /**
- *
- * remove the element(s) of the resource
- *
- */
- @Override
- protected void doExecute() {
- try {
- if(this.toRemove != null) {
- this.resource.getContents().remove(toRemove);
- }
-
- if(this.elementsToRemove != null) {
- this.resource.getContents().removeAll(elementsToRemove);
- }
- } catch (Exception e) {
- int i = 0;
- i++;
- }
- }
-
-
- /**
- *
- * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
- *
- * @return
- */
- @Override
- public boolean canExecute() {
- boolean result = super.canExecute();
- if(toRemove == null && elementsToRemove == null) {
- return false;
- }
- return result;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.commands;
+
+import java.util.Collection;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.Activator;
+
+/**
+ *
+ * This command allows to remove elements from a resource
+ *
+ */
+public class RemoveFromResourcecommand extends RecordingCommand {
+
+ /**
+ * the managed resource
+ */
+ final private Resource resource;
+
+ /**
+ * the element to remove from the resource
+ */
+ final private EObject toRemove;
+
+ /**
+ * the list of the elements to remove from the resource
+ */
+ final private Collection<EObject> elementsToRemove;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * the editing domain
+ * @param resource
+ * the resource
+ * @param toRemove
+ * the element to remove
+ */
+ public RemoveFromResourcecommand(final TransactionalEditingDomain domain, final Resource resource, final EObject toRemove) {
+ this(domain, resource, toRemove, null);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * the editing domain
+ * @param resource
+ * the resource
+ * @param elementsToRemove
+ * the list of the elements to remove
+ */
+ public RemoveFromResourcecommand(final TransactionalEditingDomain domain, final Resource resource, final Collection<EObject> elementsToRemove) {
+ this(domain, resource, null, elementsToRemove);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * the editing domain
+ * @param resource
+ * the resource
+ * @param toRemove
+ * the element to remove
+ * @param elementsToRemove
+ * the list of the elements to remove
+ */
+ protected RemoveFromResourcecommand(final TransactionalEditingDomain domain, final Resource resource, final EObject toRemove, final Collection<EObject> elementsToRemove) {
+ super(domain, "Remove an EObject from a resource");
+ this.resource = resource;
+ this.toRemove = toRemove;
+ this.elementsToRemove = elementsToRemove;
+ }
+
+ /**
+ *
+ * remove the element(s) of the resource
+ *
+ */
+ @Override
+ protected void doExecute() {
+ try {
+ if(this.toRemove != null) {
+ this.resource.getContents().remove(toRemove);
+ }
+
+ if(this.elementsToRemove != null) {
+ this.resource.getContents().removeAll(elementsToRemove);
+ }
+ } catch (Exception e) {
+ Activator.log.error(e);
+ }
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#canExecute()
+ *
+ * @return
+ */
+ @Override
+ public boolean canExecute() {
+ boolean result = super.canExecute();
+ if(toRemove == null && elementsToRemove == null) {
+ return false;
+ }
+ return result;
+ }
+
+}