1 11 package org.eclipse.jdt.debug.ui.launchConfigurations; 12 13 14 import java.util.List ; 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 47 48 public class JavaSourceLookupTab extends JavaLaunchTab { 49 50 protected SourceLookupBlock fSourceLookupBlock; 51 52 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 79 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { 80 configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, JavaUISourceLocator.ID_PROMPTING_JAVA_SOURCE_LOCATOR); 82 configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_SOURCE_PATH, (String )null); 83 configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH, (List )null); 84 } 85 86 89 public void initializeFrom(ILaunchConfiguration configuration) { 90 fSourceLookupBlock.initializeFrom(configuration); 91 } 92 93 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 106 public String getId() { 107 return "org.eclipse.jdt.debug.ui.javaSourceLookupTab"; } 109 110 113 public String getName() { 114 return LauncherMessages.JavaSourceLookupTab_Source_1; 115 } 116 117 120 public Image getImage() { 121 return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE); 122 } 123 124 } 125 | Popular Tags |