]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Add RepoSyncCommand but do not link it
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 20 Feb 2013 15:27:28 +0000 (15:27 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 20 Feb 2013 15:27:28 +0000 (15:27 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@6079 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RepoSyncCommand.java [new file with mode: 0644]
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/package.html [new file with mode: 0644]

diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RepoSyncCommand.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RepoSyncCommand.java
new file mode 100644 (file)
index 0000000..c9ff452
--- /dev/null
@@ -0,0 +1,34 @@
+package org.argeo.slc.client.ui.dist.commands;
+
+import javax.jcr.RepositoryFactory;
+
+import org.argeo.slc.client.ui.dist.DistPlugin;
+import org.argeo.slc.repo.RepoSync;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/** Wraps a {@link RepoSync} as an Eclipse command. */
+public class RepoSyncCommand extends AbstractHandler {
+       public final static String ID = DistPlugin.ID + ".repoSync";
+       public final static String PARAM_SOURCE_REPO = "sourceRepo";
+       public final static String PARAM_TARGET_REPO = "targetRepo";
+       public final static String DEFAULT_LABEL = "Repo sync";
+       public final static String DEFAULT_ICON_PATH = "icons/addItem.gif";
+       
+       private RepositoryFactory repositoryFactory;
+
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               RepoSync repoSync = new RepoSync();
+               repoSync.setRepositoryFactory(repositoryFactory);
+               repoSync.setSourceRepo(event.getParameter(PARAM_SOURCE_REPO));
+               repoSync.setTargetRepo(event.getParameter(PARAM_TARGET_REPO));
+               repoSync.run();
+               return null;
+       }
+
+       public void setRepositoryFactory(RepositoryFactory repositoryFactory) {
+               this.repositoryFactory = repositoryFactory;
+       }
+
+}
diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/package.html b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/package.html
new file mode 100644 (file)
index 0000000..c5b53af
--- /dev/null
@@ -0,0 +1 @@
+Eclipse commands wrapping Runnable objects define in non-ui specific code.
\ No newline at end of file