org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/JavaAppletLaunchShortcut.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.24 - (view) (download)

1 : droberts 1.5 /*******************************************************************************
2 : darin 1.24 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 : krbarnes 1.17 * All rights reserved. This program and the accompanying materials
4 : darins 1.18 * are made available under the terms of the Eclipse Public License v1.0
5 : droberts 1.5 * which accompanies this distribution, and is available at
6 : darins 1.18 * http://www.eclipse.org/legal/epl-v10.html
7 : darin 1.24 *
8 : droberts 1.5 * Contributors:
9 :     * IBM Corporation - initial API and implementation
10 :     *******************************************************************************/
11 : jszursze 1.1 package org.eclipse.jdt.internal.debug.ui.launcher;
12 :    
13 :     import java.lang.reflect.InvocationTargetException;
14 : darin 1.22
15 : darin 1.23 import org.eclipse.core.resources.IResource;
16 : jszursze 1.1 import org.eclipse.core.runtime.CoreException;
17 :     import org.eclipse.debug.core.DebugPlugin;
18 :     import org.eclipse.debug.core.ILaunchConfiguration;
19 :     import org.eclipse.debug.core.ILaunchConfigurationType;
20 :     import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
21 :     import org.eclipse.debug.core.ILaunchManager;
22 :     import org.eclipse.jdt.core.IType;
23 : jszursze 1.4 import org.eclipse.jdt.debug.ui.launchConfigurations.AppletParametersTab;
24 : jszursze 1.1 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
25 : darin 1.22 import org.eclipse.jface.operation.IRunnableContext;
26 : jszursze 1.1
27 : darin 1.22 public class JavaAppletLaunchShortcut extends JavaLaunchShortcut {
28 : jszursze 1.1
29 : darin 1.22 /* (non-Javadoc)
30 :     * @see org.eclipse.jdt.internal.debug.ui.launcher.JavaLaunchShortcut#createConfiguration(org.eclipse.jdt.core.IType)
31 : jszursze 1.1 */
32 :     protected ILaunchConfiguration createConfiguration(IType type) {
33 :     ILaunchConfiguration config = null;
34 :     try {
35 : darin 1.22 ILaunchConfigurationType configType = getConfigurationType();
36 : jszursze 1.1 ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateUniqueLaunchConfigurationNameFrom(type.getElementName()));
37 :     wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, type.getFullyQualifiedName());
38 :     wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, type.getJavaProject().getElementName());
39 : jszursze 1.4 wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_WIDTH, AppletParametersTab.DEFAULT_APPLET_WIDTH);
40 :     wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_HEIGHT, AppletParametersTab.DEFAULT_APPLET_HEIGHT);
41 : darin 1.22 wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_APPLET_NAME, ""); //$NON-NLS-1$
42 : darin 1.23 wc.setMappedResources(new IResource[] {type.getJavaProject().getProject()});
43 : jszursze 1.1 config = wc.doSave();
44 :     } catch (CoreException ce) {
45 : darin 1.22 reportErorr(ce);
46 : jszursze 1.1 }
47 :     return config;
48 :     }
49 :    
50 : darin 1.22 /* (non-Javadoc)
51 :     * @see org.eclipse.jdt.internal.debug.ui.launcher.JavaLaunchShortcut#getConfigurationType()
52 : jszursze 1.1 */
53 : darin 1.22 protected ILaunchConfigurationType getConfigurationType() {
54 : jszursze 1.1 ILaunchManager lm= DebugPlugin.getDefault().getLaunchManager();
55 :     return lm.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLET);
56 : darin 1.22 }
57 :    
58 :     /* (non-Javadoc)
59 :     * @see org.eclipse.jdt.internal.debug.ui.launcher.JavaLaunchShortcut#findTypes(java.lang.Object[])
60 :     */
61 :     protected IType[] findTypes(Object[] elements, IRunnableContext context) throws InterruptedException, CoreException {
62 :     try {
63 :     return AppletLaunchConfigurationUtils.findApplets(context, elements);
64 :     } catch (InvocationTargetException e) {
65 :     throw (CoreException)e.getTargetException();
66 :     }
67 : jszursze 1.1 }
68 : darin 1.22
69 :     /* (non-Javadoc)
70 :     * @see org.eclipse.jdt.internal.debug.ui.launcher.JavaLaunchShortcut#getTypeSelectionTitle()
71 : jszursze 1.1 */
72 : darin 1.22 protected String getTypeSelectionTitle() {
73 :     return LauncherMessages.JavaAppletLaunchShortcut_0;
74 : jszursze 1.1 }
75 : darin 1.22
76 :     /* (non-Javadoc)
77 :     * @see org.eclipse.jdt.internal.debug.ui.launcher.JavaLaunchShortcut#getEditorEmptyMessage()
78 :     */
79 :     protected String getEditorEmptyMessage() {
80 :     return LauncherMessages.JavaAppletLaunchShortcut_1;
81 : jszursze 1.1 }
82 : darins 1.13
83 : darin 1.22 /* (non-Javadoc)
84 :     * @see org.eclipse.jdt.internal.debug.ui.launcher.JavaLaunchShortcut#getSelectionEmptyMessage()
85 :     */
86 :     protected String getSelectionEmptyMessage() {
87 :     return LauncherMessages.JavaAppletLaunchShortcut_2;
88 :     }
89 : droberts 1.5 }