2 * Copyright (C) 2007-2012 Argeo GmbH
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org
.argeo
.slc
.client
.ui
.dist
.commands
;
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
;
32 * Open a {@code GenerateBinariesWizard} wizard for the selected node
34 public class OpenGenerateBinariesWizard
extends AbstractHandler
{
35 // private static final Log log = LogFactory.getLog(DeleteWorkspace.class);
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;
42 /* DEPENDENCY INJECTION */
43 private RepoService repoService
;
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";
50 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
51 IWorkbenchPart activePart
= DistPlugin
.getDefault().getWorkbench()
52 .getActiveWorkbenchWindow().getActivePage().getActivePart();
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
);
58 GenerateBinariesWizard wizard
= new GenerateBinariesWizard(repoService
,
59 repoNodePath
, workspaceName
, modulePath
);
61 WizardDialog dialog
= new WizardDialog(
62 HandlerUtil
.getActiveShell(event
), wizard
);
63 int result
= dialog
.open();
65 if (result
== Dialog
.OK
66 && (activePart
instanceof RefreshDistributionsView
))
67 CommandHelpers
.callCommand(RefreshDistributionsView
.ID
);
72 /* DEPENDENCY INJECTION */
73 public void setRepoService(RepoService repoService
) {
74 this.repoService
= repoService
;