KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > debug > ui > launchConfigurations > JavaSourceLookupTab


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.jdt.debug.ui.launchConfigurations;
12
13
14 import java.util.List JavaDoc;
15
16 import org.eclipse.debug.core.ILaunchConfiguration;
17 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
18 import org.eclipse.jdt.debug.ui.JavaUISourceLocator;
19 import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds;
20 import org.eclipse.jdt.internal.debug.ui.launcher.LauncherMessages;
21 import org.eclipse.jdt.internal.debug.ui.launcher.SourceLookupBlock;
22 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
23 import org.eclipse.swt.SWT;
24 import org.eclipse.swt.graphics.Image;
25 import org.eclipse.swt.layout.GridData;
26 import org.eclipse.swt.layout.GridLayout;
27 import org.eclipse.swt.widgets.Composite;
28 import org.eclipse.ui.ISharedImages;
29 import org.eclipse.ui.PlatformUI;
30
31 /**
32  * A launch configuration tab that displays and edits source lookup
33  * path launch configuration attributes.
34  * <p>
35  * This class may be instantiated. This class is not intended to be subclassed.
36  * </p>
37  * @since 2.0
38  * @deprecated In 3.0, the debug platform provides source lookup facilities that
39  * should be used in place of the Java source lookup support provided in 2.0.
40  * The new facilities provide a source lookup director that coordinates source
41  * lookup among a set of participants, searching a set of source containers.
42  * See the following packages: <code>org.eclipse.debug.core.sourcelookup</code>
43  * and <code>org.eclipse.debug.core.sourcelookup.containers</code>. This class
44  * has been replaced by a source lookup tab in the debug platform -
45  * <code>org.eclipse.debug.ui.sourcelookup.SourceLookupTab</code>.
46  */

47
48 public class JavaSourceLookupTab extends JavaLaunchTab {
49
50     protected SourceLookupBlock fSourceLookupBlock;
51     
52     /**
53      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite)
54      */

55     public void createControl(Composite parent) {
56         Composite comp = new Composite(parent, SWT.NONE);
57         setControl(comp);
58         PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_SOURCE_TAB);
59         GridLayout topLayout = new GridLayout();
60         topLayout.numColumns = 1;
61         topLayout.marginHeight= 0;
62         topLayout.marginWidth= 0;
63         comp.setLayout(topLayout);
64         comp.setFont(parent.getFont());
65         
66         createVerticalSpacer(comp, 1);
67         
68         fSourceLookupBlock = new SourceLookupBlock();
69         fSourceLookupBlock.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
70         fSourceLookupBlock.createControl(comp);
71         GridData gd = (GridData)fSourceLookupBlock.getControl().getLayoutData();
72         gd.heightHint = 200;
73         gd.widthHint = 250;
74     }
75
76     /**
77      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
78      */

79     public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
80         // be default, use a prompting source locator
81
configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, JavaUISourceLocator.ID_PROMPTING_JAVA_SOURCE_LOCATOR);
82         configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_SOURCE_PATH, (String JavaDoc)null);
83         configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH, (List JavaDoc)null);
84     }
85
86     /**
87      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
88      */

89     public void initializeFrom(ILaunchConfiguration configuration) {
90         fSourceLookupBlock.initializeFrom(configuration);
91     }
92     
93     /**
94      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
95      */

96     public void performApply(ILaunchConfigurationWorkingCopy configuration) {
97         configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, JavaUISourceLocator.ID_PROMPTING_JAVA_SOURCE_LOCATOR);
98         fSourceLookupBlock.performApply(configuration);
99     }
100
101     /**
102      * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getId()
103      *
104      * @since 3.3
105      */

106     public String JavaDoc getId() {
107         return "org.eclipse.jdt.debug.ui.javaSourceLookupTab"; //$NON-NLS-1$
108
}
109     
110     /**
111      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
112      */

113     public String JavaDoc getName() {
114         return LauncherMessages.JavaSourceLookupTab_Source_1;
115     }
116     
117     /**
118      * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
119      */

120     public Image getImage() {
121         return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
122     }
123         
124 }
125
Popular Tags