Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/team.collaborative/org.eclipse.papyrus.team.collaborative.integration.papyrus.svn/src/org/eclipse/papyrus/team/collaborative/integration/papyrus/svn/commands/SaveCommand.java')
-rw-r--r--extraplugins/team.collaborative/org.eclipse.papyrus.team.collaborative.integration.papyrus.svn/src/org/eclipse/papyrus/team/collaborative/integration/papyrus/svn/commands/SaveCommand.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/extraplugins/team.collaborative/org.eclipse.papyrus.team.collaborative.integration.papyrus.svn/src/org/eclipse/papyrus/team/collaborative/integration/papyrus/svn/commands/SaveCommand.java b/extraplugins/team.collaborative/org.eclipse.papyrus.team.collaborative.integration.papyrus.svn/src/org/eclipse/papyrus/team/collaborative/integration/papyrus/svn/commands/SaveCommand.java
new file mode 100644
index 00000000000..9af1e6bfab5
--- /dev/null
+++ b/extraplugins/team.collaborative/org.eclipse.papyrus.team.collaborative.integration.papyrus.svn/src/org/eclipse/papyrus/team/collaborative/integration/papyrus/svn/commands/SaveCommand.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Atos
+ * 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:
+ * Arthur Daussy - initial implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.team.collaborative.integration.papyrus.svn.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.ui.ISaveablePart;
+
+
+/**
+ * The Class SaveCommand.
+ * Command to save an editor
+ */
+public class SaveCommand extends AbstractTransactionalCommand {
+
+ /** The editor. */
+ private ISaveablePart editor;
+
+ /**
+ * Instantiates a new save command.
+ *
+ * @param domain
+ * the domain
+ * @param editor
+ * the editor
+ */
+ public SaveCommand(TransactionalEditingDomain domain, ISaveablePart editor) {
+ //Set list command to null the save command is secure with read only
+ super(domain, "Save command", null);
+ this.editor = editor;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ try {
+ editor.doSave(monitor);
+ } catch (Exception e) {
+ return CommandResult.newErrorCommandResult(e);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+}

Back to the top