KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > ui > launcher > OSGiLaunchShortcut


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.ui.launcher;
12
13 import org.eclipse.debug.core.ILaunchConfiguration;
14 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.pde.internal.ui.PDEPlugin;
17 import org.eclipse.pde.internal.ui.launcher.OSGiFrameworkManager;
18 import org.eclipse.ui.IEditorPart;
19
20 /**
21  * A launch shortcut capable of launching an OSGi frameowrk
22  * <p>
23  * This class may be substantiated or subclassed by clients.
24  * </p>
25  * @since 3.3
26  */

27 public class OSGiLaunchShortcut extends AbstractLaunchShortcut {
28     
29     /*
30      * (non-Javadoc)
31      * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.jface.viewers.ISelection, java.lang.String)
32      */

33     public void launch(ISelection selection, String JavaDoc mode) {
34         launch(mode);
35     }
36     
37     /*
38      * (non-Javadoc)
39      * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.ui.IEditorPart, java.lang.String)
40      */

41     public void launch(IEditorPart editor, String JavaDoc mode) {
42         launch(mode);
43     }
44
45     /*
46      * (non-Javadoc)
47      * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#getLaunchConfigurationTypeName()
48      */

49     protected String JavaDoc getLaunchConfigurationTypeName() {
50         return "org.eclipse.pde.ui.EquinoxLauncher"; //$NON-NLS-1$
51
}
52     
53     /**
54      * Delegates to the initializer associated with the selected OSGI framework
55      * to initialize the launch configuration
56      * <p>
57      * Refer to the <code>org.eclipse.pde.ui.osgiFrameworks</code> extension point.
58      * </p>
59      * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#initializeConfiguration(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
60      */

61     protected void initializeConfiguration(ILaunchConfigurationWorkingCopy configuration) {
62         OSGiFrameworkManager manager = PDEPlugin.getDefault().getOSGiFrameworkManager();
63         manager.getDefaultInitializer().initialize(configuration);
64     }
65
66     /*
67      * (non-Javadoc)
68      * @see org.eclipse.pde.ui.launcher.AbstractLaunchShortcut#isGoodMatch(org.eclipse.debug.core.ILaunchConfiguration)
69      */

70     protected boolean isGoodMatch(ILaunchConfiguration configuration) {
71         return true;
72     }
73     
74 }
75
Popular Tags