From: Mathieu Baudier Date: Wed, 20 Feb 2013 15:27:28 +0000 (+0000) Subject: Add RepoSyncCommand but do not link it X-Git-Tag: argeo-slc-2.1.7~460 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=ea38a0fb11dcbbf094046dbf09222d4e8d5b0eac;p=gpl%2Fargeo-slc.git Add RepoSyncCommand but do not link it git-svn-id: https://svn.argeo.org/slc/trunk@6079 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- 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 index 000000000..c9ff452a3 --- /dev/null +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RepoSyncCommand.java @@ -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 index 000000000..c5b53af5c --- /dev/null +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/package.html @@ -0,0 +1 @@ +Eclipse commands wrapping Runnable objects define in non-ui specific code. \ No newline at end of file