Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 863e656a81d6033cbac6c6529fca4fdad5fe52b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*******************************************************************************
 *  Copyright (c) 2017 Red Hat Inc. and others.
 *
 *  This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License 2.0
 *  which accompanies this distribution, and is available at
 *  https://www.eclipse.org/legal/epl-2.0/
 *
 *  SPDX-License-Identifier: EPL-2.0
 *
 *  Contributors:
 *     IBM Corporation - initial API and implementation
 *     Ian Pun & Lucas Bullen - Export Functionality based off of AbstractLaunchConfigurationAction
 *******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;

import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.importexport.launchconfigurations.ExportLaunchConfigurationsWizard;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.wizard.WizardDialog;

public class ExportLaunchConfigurationAction extends AbstractLaunchConfigurationAction {
	/**
	 * Action identifier for IDebugView#getAction(String)
	 */
	public static final String ID_EXPORT_ACTION = DebugUIPlugin.getUniqueIdentifier() + ".ID_EXPORT_ACTION"; //$NON-NLS-1$

	/**
	 * Constructs an action to export launch configuration(s)
	 */
	public ExportLaunchConfigurationAction(Viewer viewer, String mode) {
		super(LaunchConfigurationsMessages.ExportLaunchConfigurationAction_Export_1, viewer, mode);
	}

	@Override
	protected void performAction() {
		IStructuredSelection selection = getStructuredSelection();
		ExportLaunchConfigurationsWizard wizard;
		if (selection == null) {
			wizard = new ExportLaunchConfigurationsWizard();
		} else {
			wizard = new ExportLaunchConfigurationsWizard(selection);
		}
		wizard.init(DebugUIPlugin.getDefault().getWorkbench(), null);
		WizardDialog dialog = new WizardDialog(DebugUIPlugin.getShell(), wizard);
		dialog.open();
	}

	@Override
	protected boolean updateSelection(IStructuredSelection selection) {
		return selection.size() > 0;
	}

	@Override
	public ImageDescriptor getDisabledImageDescriptor() {
		return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_DLCL_EXPORT_CONFIG);
	}

	@Override
	public ImageDescriptor getImageDescriptor() {
		return DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_ELCL_EXPORT_CONFIG);
	}

	@Override
	public String getToolTipText() {
		return LaunchConfigurationsMessages.LaunchConfigurationsDialog_6;
	}

}

Back to the top