1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.slc.client.ui.dist.commands;
17
18 import javax.jcr.Repository;
19 import javax.jcr.RepositoryFactory;
20
21 import org.argeo.cms.ArgeoNames;
22 import org.argeo.node.security.Keyring;
23 import org.argeo.slc.SlcNames;
24 import org.argeo.slc.client.ui.dist.DistPlugin;
25 import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
26 import org.argeo.slc.client.ui.dist.wizards.RegisterRepoWizard;
27 import org.eclipse.core.commands.AbstractHandler;
28 import org.eclipse.core.commands.ExecutionEvent;
29 import org.eclipse.core.commands.ExecutionException;
30 import org.eclipse.jface.dialogs.Dialog;
31 import org.eclipse.jface.resource.ImageDescriptor;
32 import org.eclipse.jface.wizard.WizardDialog;
33 import org.eclipse.ui.handlers.HandlerUtil;
34
35
36 public class RegisterRepository extends AbstractHandler implements ArgeoNames,
37 SlcNames {
38
39 public final static String ID = DistPlugin.PLUGIN_ID
40 + ".registerRepository";
41 public final static String DEFAULT_LABEL = "Register a repository...";
42 public final static ImageDescriptor DEFAULT_ICON = DistPlugin
43 .getImageDescriptor("icons/addRepo.gif");
44
45
46 private RepositoryFactory repositoryFactory;
47 private Repository nodeRepository;
48 private Keyring keyring;
49
50 public Object execute(ExecutionEvent event) throws ExecutionException {
51 RegisterRepoWizard wizard = new RegisterRepoWizard(keyring,
52 repositoryFactory, nodeRepository);
53 WizardDialog dialog = new WizardDialog(
54 HandlerUtil.getActiveShell(event), wizard);
55 int result = dialog.open();
56 if (result == Dialog.OK)
57 CommandHelpers.callCommand(RefreshDistributionsView.ID);
58 return null;
59 }
60
61 public void setRepositoryFactory(RepositoryFactory repositoryFactory) {
62 this.repositoryFactory = repositoryFactory;
63 }
64
65 public void setKeyring(Keyring keyring) {
66 this.keyring = keyring;
67 }
68
69 public void setNodeRepository(Repository nodeRepository) {
70 this.nodeRepository = nodeRepository;
71 }
72 }