]> git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/OpenGenerateBinariesWizard.java
Fix single sourcing issue on file download
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / commands / OpenGenerateBinariesWizard.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
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 * Open a {@code GenerateBinariesWizard} wizard for the selected node
33 */
34 public class OpenGenerateBinariesWizard extends AbstractHandler {
35 // private static final Log log = LogFactory.getLog(DeleteWorkspace.class);
36
37 public final static String ID = DistPlugin.ID
38 + ".openGenerateBinariesWizard";
39 public final static String DEFAULT_LABEL = "Generate Aether Index";
40 public final static ImageDescriptor DEFAULT_ICON = null;
41
42 /* DEPENDENCY INJECTION */
43 private RepoService repoService;
44
45 // Absolute Coordinates of the current group node
46 public final static String PARAM_REPO_NODE_PATH = "param.repoNodePath";
47 public final static String PARAM_WORKSPACE_NAME = "param.workspaceName";
48 public final static String PARAM_MODULE_PATH = "param.modulePath";
49
50 public Object execute(ExecutionEvent event) throws ExecutionException {
51 IWorkbenchPart activePart = DistPlugin.getDefault().getWorkbench()
52 .getActiveWorkbenchWindow().getActivePage().getActivePart();
53
54 String repoNodePath = event.getParameter(PARAM_REPO_NODE_PATH);
55 String workspaceName = event.getParameter(PARAM_WORKSPACE_NAME);
56 String modulePath = event.getParameter(PARAM_MODULE_PATH);
57
58 GenerateBinariesWizard wizard = new GenerateBinariesWizard(repoService,
59 repoNodePath, workspaceName, modulePath);
60
61 WizardDialog dialog = new WizardDialog(
62 HandlerUtil.getActiveShell(event), wizard);
63 int result = dialog.open();
64
65 if (result == Dialog.OK
66 && (activePart instanceof RefreshDistributionsView))
67 CommandHelpers.callCommand(RefreshDistributionsView.ID);
68
69 return null;
70 }
71
72 /* DEPENDENCY INJECTION */
73 public void setRepoService(RepoService repoService) {
74 this.repoService = repoService;
75 }
76 }