1 11 package org.eclipse.debug.ui.sourcelookup; 12 13 import org.eclipse.debug.core.ILaunchConfiguration; 14 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; 15 import org.eclipse.debug.internal.ui.DebugPluginImages; 16 import org.eclipse.debug.internal.ui.IDebugHelpContextIds; 17 import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; 18 import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupPanel; 19 import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages; 20 import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; 21 import org.eclipse.jface.dialogs.Dialog; 22 import org.eclipse.swt.SWT; 23 import org.eclipse.swt.graphics.Image; 24 import org.eclipse.swt.layout.GridData; 25 import org.eclipse.swt.layout.GridLayout; 26 import org.eclipse.swt.widgets.Composite; 27 import org.eclipse.ui.PlatformUI; 28 29 39 40 public class SourceLookupTab extends AbstractLaunchConfigurationTab { 41 private SourceLookupPanel fSourceLookupPanel; 43 44 47 public void createControl(Composite parent) { 48 Composite comp = new Composite(parent, SWT.NONE); 49 setControl(comp); 50 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.SOURCELOOKUP_TAB); 51 GridLayout topLayout = new GridLayout(); 52 topLayout.marginWidth = 0; 53 topLayout.marginHeight = 0; 54 topLayout.numColumns = 1; 55 comp.setLayout(topLayout); 56 comp.setFont(parent.getFont()); 57 58 fSourceLookupPanel = new SourceLookupPanel(); 59 fSourceLookupPanel.setLaunchConfigurationDialog( 60 getLaunchConfigurationDialog()); 61 fSourceLookupPanel.createControl(comp); 62 GridData gd = (GridData) fSourceLookupPanel.getControl().getLayoutData(); 63 gd.heightHint = 200; 64 gd.widthHint = 250; 65 Dialog.applyDialogFont(comp); 66 } 67 68 71 public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { 72 73 } 74 75 78 public void initializeFrom(ILaunchConfiguration configuration) { 79 fSourceLookupPanel.initializeFrom(configuration); 80 } 81 82 85 public void performApply(ILaunchConfigurationWorkingCopy configuration) { 86 fSourceLookupPanel.performApply(configuration); 87 } 88 89 92 public String getName() { 93 return SourceLookupUIMessages.sourceTab_tabTitle; 94 } 95 96 99 public Image getImage() { 100 return DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_SRC_LOOKUP_TAB); 101 } 102 103 106 public void activated(ILaunchConfigurationWorkingCopy workingCopy) { 107 fSourceLookupPanel.activated(workingCopy); 108 } 109 110 113 public void dispose() { 114 if (fSourceLookupPanel != null) { 115 if (fSourceLookupPanel.getDirector() != null) { 116 fSourceLookupPanel.getDirector().dispose(); 117 } 118 fSourceLookupPanel.dispose(); 119 } 120 fSourceLookupPanel = null; 121 super.dispose(); 122 } 123 124 127 public String getErrorMessage() { 128 if (fSourceLookupPanel != null) { 129 return fSourceLookupPanel.getErrorMessage(); 130 } 131 return super.getErrorMessage(); 132 } 133 136 public String getMessage() { 137 if (fSourceLookupPanel != null) { 138 return fSourceLookupPanel.getMessage(); 139 } 140 return super.getMessage(); 141 } 142 } 143 | Popular Tags |