01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.ui.launcher;
11:
12: import org.eclipse.debug.core.ILaunchConfiguration;
13: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
14: import org.eclipse.jface.viewers.ISelection;
15: import org.eclipse.pde.internal.ui.PDEPlugin;
16: import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
17: import org.eclipse.ui.IEditorPart;
18:
19: /**
20: * A launch shortcut capable of launching an OSGi frameowrk
21: * <p>
22: * This class may be substantiated or subclassed by clients.
23: * </p>
24: * @since 3.3
25: */
26: public class OSGiLaunchShortcut extends AbstractLaunchShortcut {
27:
28: /*
29: * (non-Javadoc)
30: * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.jface.viewers.ISelection, java.lang.String)
31: */
32: public void launch(ISelection selection, String mode) {
33: launch(mode);
34: }
35:
36: /*
37: * (non-Javadoc)
38: * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.ui.IEditorPart, java.lang.String)
39: */
40: public void launch(IEditorPart editor, String mode) {
41: launch(mode);
42: }
43:
44: /*
45: * (non-Javadoc)
46: * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#getLaunchConfigurationTypeName()
47: */
48: protected String getLaunchConfigurationTypeName() {
49: return "org.eclipse.pde.ui.EquinoxLauncher"; //$NON-NLS-1$
50: }
51:
52: /**
53: * Delegates to the initializer associated with the selected OSGI framework
54: * to initialize the launch configuration
55: * <p>
56: * Refer to the <code>org.eclipse.pde.ui.osgiFrameworks</code> extension point.
57: * </p>
58: * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#initializeConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
59: */
60: protected void initializeConfiguration(
61: ILaunchConfigurationWorkingCopy configuration) {
62: OSGiFrameworkManager manager = PDEPlugin.getDefault()
63: .getOSGiFrameworkManager();
64: manager.getDefaultInitializer().initialize(configuration);
65: }
66:
67: /*
68: * (non-Javadoc)
69: * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#isGoodMatch(org.eclipse.debug.core.ILaunchConfiguration)
70: */
71: protected boolean isGoodMatch(ILaunchConfiguration configuration) {
72: return true;
73: }
74:
75: }
|