Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/command/RenameRepresentationCommand.java')
-rw-r--r--plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/command/RenameRepresentationCommand.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/command/RenameRepresentationCommand.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/command/RenameRepresentationCommand.java
new file mode 100644
index 0000000000..ec5bcc8f1f
--- /dev/null
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/command/RenameRepresentationCommand.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.business.api.dialect.command;
+
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+import org.eclipse.sirius.DRepresentation;
+
+/**
+ * Specific command to rename the given representation.
+ *
+ * @author mporhel
+ *
+ */
+public class RenameRepresentationCommand extends RecordingCommand {
+
+ private DRepresentation representation;
+
+ private String newName;
+
+ /**
+ * Specific command to rename the given representation.
+ *
+ * @param transDomain
+ * the editing domain.
+ * @param selection
+ * the representation to rename.
+ * @param name
+ * the new name.
+ */
+ public RenameRepresentationCommand(TransactionalEditingDomain transDomain, DRepresentation selection, String name) {
+ super(transDomain, "Rename representation");
+ this.representation = selection;
+ this.newName = name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void doExecute() {
+ if (representation != null) {
+ representation.setName(newName);
+ }
+ }
+
+}

Back to the top