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 org.argeo.slc.client.ui.dist.DistPlugin;
19 import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
20 import org.argeo.slc.client.ui.dist.wizards.GenerateBinariesWizard;
21 import org.argeo.slc.repo.RepoService;
22 import org.eclipse.core.commands.AbstractHandler;
23 import org.eclipse.core.commands.ExecutionEvent;
24 import org.eclipse.core.commands.ExecutionException;
25 import org.eclipse.jface.dialogs.Dialog;
26 import org.eclipse.jface.resource.ImageDescriptor;
27 import org.eclipse.jface.wizard.WizardDialog;
28 import org.eclipse.ui.IWorkbenchPart;
29 import org.eclipse.ui.handlers.HandlerUtil;
30
31
32 public class OpenGenerateBinariesWizard extends AbstractHandler {
33
34
35 public final static String ID = DistPlugin.PLUGIN_ID
36 + ".openGenerateBinariesWizard";
37 public final static String DEFAULT_LABEL = "Generate Aether Index";
38 public final static ImageDescriptor DEFAULT_ICON = null;
39
40
41 private RepoService repoService;
42
43
44 public final static String PARAM_REPO_NODE_PATH = "param.repoNodePath";
45 public final static String PARAM_WORKSPACE_NAME = "param.workspaceName";
46 public final static String PARAM_MODULE_PATH = "param.modulePath";
47
48 public Object execute(ExecutionEvent event) throws ExecutionException {
49 IWorkbenchPart activePart = DistPlugin.getDefault().getWorkbench()
50 .getActiveWorkbenchWindow().getActivePage().getActivePart();
51
52 String repoNodePath = event.getParameter(PARAM_REPO_NODE_PATH);
53 String workspaceName = event.getParameter(PARAM_WORKSPACE_NAME);
54 String modulePath = event.getParameter(PARAM_MODULE_PATH);
55
56 GenerateBinariesWizard wizard = new GenerateBinariesWizard(repoService,
57 repoNodePath, workspaceName, modulePath);
58
59 WizardDialog dialog = new WizardDialog(
60 HandlerUtil.getActiveShell(event), wizard);
61 int result = dialog.open();
62
63 if (result == Dialog.OK
64 && (activePart instanceof RefreshDistributionsView))
65 CommandHelpers.callCommand(RefreshDistributionsView.ID);
66
67 return null;
68 }
69
70
71 public void setRepoService(RepoService repoService) {
72 this.repoService = repoService;
73 }
74 }