1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-05-25 22:04:52 +00:00
parent f5fb221fa2
commit 165d5a38af

View file

@ -6,10 +6,10 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894 * Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
* IBM Corporation * IBM Corporation
* Ericsson * Ericsson
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.dsf.gdb.internal.ui.launching; package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
@ -54,17 +54,17 @@ import org.eclipse.swt.widgets.Text;
public class CDebuggerTab extends CLaunchConfigurationTab { public class CDebuggerTab extends CLaunchConfigurationTab {
/** /**
* Tab identifier used for ordering of tabs added using the * Tab identifier used for ordering of tabs added using
* <code>org.eclipse.debug.ui.launchConfigurationTabs</code> * the <code>org.eclipse.debug.ui.launchConfigurationTabs</code>
* extension point. * extension point.
* *
* @since 2.0 * @since 2.0
*/ */
public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$ public static final String TAB_ID = "org.eclipse.cdt.dsf.gdb.launch.debuggerTab"; //$NON-NLS-1$
private final static String LOCAL_DEBUGGER_ID = "gdb";//$NON-NLS-1$ private final static String LOCAL_DEBUGGER_ID = "gdb";//$NON-NLS-1$
private final static String REMOTE_DEBUGGER_ID = "gdbserver";//$NON-NLS-1$ private final static String REMOTE_DEBUGGER_ID = "gdbserver";//$NON-NLS-1$
protected ILaunchConfiguration fLaunchConfiguration; protected ILaunchConfiguration fLaunchConfiguration;
protected ILaunchConfigurationWorkingCopy fWorkingCopy; protected ILaunchConfigurationWorkingCopy fWorkingCopy;
protected String fDebuggerId; protected String fDebuggerId;
@ -75,14 +75,14 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
private boolean fInitDefaults; private boolean fInitDefaults;
private Combo fDCombo; private Combo fDCombo;
private boolean fIsInitializing; private boolean fIsInitializing;
protected boolean fAttachMode; protected boolean fAttachMode;
protected boolean fRemoteMode; protected boolean fRemoteMode;
protected boolean fCoreMode; protected boolean fCoreMode;
protected Button fStopInMain; protected Button fStopInMain;
protected Text fStopInMainSymbol; protected Text fStopInMainSymbol;
private ScrolledComposite fContainer; private ScrolledComposite fContainer;
private Composite fContents; private Composite fContents;
@ -92,7 +92,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
contentsChanged(); contentsChanged();
} }
}; };
public CDebuggerTab(SessionType sessionType, boolean attach) { public CDebuggerTab(SessionType sessionType, boolean attach) {
if (sessionType == SessionType.REMOTE) { if (sessionType == SessionType.REMOTE) {
fRemoteMode = true; fRemoteMode = true;
@ -100,7 +100,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
fCoreMode = true; fCoreMode = true;
} }
fAttachMode = attach; fAttachMode = attach;
ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration(); ICDebugConfiguration dc = CDebugCorePlugin.getDefault().getDefaultDefaultDebugConfiguration();
if (dc == null) { if (dc == null) {
CDebugCorePlugin.getDefault().getPluginPreferences().setDefault(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE, CDebugCorePlugin.getDefault().getPluginPreferences().setDefault(ICDebugConstants.PREF_DEFAULT_DEBUGGER_TYPE,
@ -119,7 +119,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
fContainer.setLayout(new FillLayout()); fContainer.setLayout(new FillLayout());
fContainer.setExpandHorizontal(true); fContainer.setExpandHorizontal(true);
fContainer.setExpandVertical(true); fContainer.setExpandVertical(true);
fContents = new Composite(fContainer, SWT.NONE); fContents = new Composite(fContainer, SWT.NONE);
setControl(fContainer); setControl(fContainer);
GdbUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), GdbUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(),
@ -133,10 +133,10 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
if (fAttachMode) { if (fAttachMode) {
createDebuggerCombo(fContents); createDebuggerCombo(fContents);
} }
createOptionsComposite(fContents); createOptionsComposite(fContents);
createDebuggerGroup(fContents, 2); createDebuggerGroup(fContents, 2);
fContainer.setContent(fContents); fContainer.setContent(fContents);
} }
@ -166,7 +166,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
dynamicTab.setDefaults(config); dynamicTab.setDefaults(config);
setInitializeDefault(false); setInitializeDefault(false);
} }
if (fAttachMode && fRemoteMode) { if (fAttachMode && fRemoteMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH); IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH);
@ -188,7 +188,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN); ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, LOCAL_DEBUGGER_ID);
} }
if (!fAttachMode && !fCoreMode) { if (!fAttachMode && !fCoreMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT); ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT);
@ -218,12 +218,13 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebuggerId()); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_ID, getDebuggerId());
ICDebuggerPage dynamicTab = getDynamicTab(); ICDebuggerPage dynamicTab = getDynamicTab();
if (dynamicTab == null) { if (dynamicTab == null) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map<?,?>)null); config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP,
(Map<?, ?>) null);
} else { } else {
dynamicTab.performApply(config); dynamicTab.performApply(config);
} }
} }
if (fAttachMode && fRemoteMode) { if (fAttachMode && fRemoteMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH); IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE_ATTACH);
@ -243,7 +244,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
if (!fAttachMode && !fCoreMode) { if (!fAttachMode && !fCoreMode) {
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
fStopInMain.getSelection()); fStopInMain.getSelection());
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
fStopInMainSymbol.getText()); fStopInMainSymbol.getText());
} }
} }
@ -261,7 +262,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
return false; return false;
} }
} }
setErrorMessage(null); setErrorMessage(null);
setMessage(null); setMessage(null);
if (getDebuggerId() == null) { if (getDebuggerId() == null) {
@ -322,7 +323,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
} }
}); });
fStopInMainSymbol.getAccessible().addAccessibleListener( fStopInMainSymbol.getAccessible().addAccessibleListener(
new AccessibleAdapter() { new AccessibleAdapter() {
@Override @Override
public void getName(AccessibleEvent e) { public void getName(AccessibleEvent e) {
e.result = LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$ e.result = LaunchMessages.getString("CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$
@ -339,7 +340,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/ */
@Override @Override
@ -359,10 +360,9 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT)); ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT));
fStopInMainSymbol.setEnabled(fStopInMain.getSelection()); fStopInMainSymbol.setEnabled(fStopInMain.getSelection());
} else if (fAttachMode) { } else if (fAttachMode) {
// In attach mode, figure out if we are doing a remote connect based on the currently // In attach mode, figure out if we are doing a remote connect based on
// chosen debugger // the currently chosen debugger.
if (getDebuggerId().equals(REMOTE_DEBUGGER_ID)) fRemoteMode = true; fRemoteMode = getDebuggerId().equals(REMOTE_DEBUGGER_ID);
else fRemoteMode = false;
} }
} catch (CoreException e) { } catch (CoreException e) {
} }
@ -371,11 +371,11 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
protected void setInitializeDefault(boolean init) { protected void setInitializeDefault(boolean init) {
fInitDefaults = init; fInitDefaults = init;
} }
protected void contentsChanged() { protected void contentsChanged() {
fContainer.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT)); fContainer.setMinSize(fContents.computeSize(SWT.DEFAULT, SWT.DEFAULT));
} }
protected void loadDynamicDebugArea() { protected void loadDynamicDebugArea() {
Composite dynamicTabHolder = getDynamicTabHolder(); Composite dynamicTabHolder = getDynamicTabHolder();
// Dispose of any current child widgets in the tab holder area // Dispose of any current child widgets in the tab holder area
@ -413,7 +413,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
dynamicTabHolder.layout(true); dynamicTabHolder.layout(true);
contentsChanged(); contentsChanged();
} }
protected void setDebuggerId(String id) { protected void setDebuggerId(String id) {
fDebuggerId = id; fDebuggerId = id;
} }
@ -427,11 +427,11 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
} }
protected void setDynamicTab(ICDebuggerPage tab) { protected void setDynamicTab(ICDebuggerPage tab) {
if ( fDynamicTab instanceof ICDebuggerPageExtension ) if (fDynamicTab instanceof ICDebuggerPageExtension)
((ICDebuggerPageExtension)fDynamicTab).removeContentChangeListener( fContentListener ); ((ICDebuggerPageExtension) fDynamicTab).removeContentChangeListener(fContentListener);
fDynamicTab = tab; fDynamicTab = tab;
if ( fDynamicTab instanceof ICDebuggerPageExtension ) if (fDynamicTab instanceof ICDebuggerPageExtension)
((ICDebuggerPageExtension)fDynamicTab).addContentChangeListener( fContentListener ); ((ICDebuggerPageExtension) fDynamicTab).addContentChangeListener(fContentListener);
} }
protected Composite getDynamicTabHolder() { protected Composite getDynamicTabHolder() {
@ -462,13 +462,13 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
/** /**
* Overridden here so that any error message in the dynamic UI gets * Overridden here so that any error message in the dynamic UI gets
* returned. * returned.
* *
* @see ILaunchConfigurationTab#getErrorMessage() * @see ILaunchConfigurationTab#getErrorMessage()
*/ */
@Override @Override
public String getErrorMessage() { public String getErrorMessage() {
ICDebuggerPage tab = getDynamicTab(); ICDebuggerPage tab = getDynamicTab();
if ( (super.getErrorMessage() != null) || (tab == null)) { if (super.getErrorMessage() != null || tab == null) {
return super.getErrorMessage(); return super.getErrorMessage();
} }
return tab.getErrorMessage(); return tab.getErrorMessage();
@ -483,25 +483,25 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
// Always set the newly created area with defaults // Always set the newly created area with defaults
ILaunchConfigurationWorkingCopy wc = getLaunchConfigurationWorkingCopy(); ILaunchConfigurationWorkingCopy wc = getLaunchConfigurationWorkingCopy();
if (getDynamicTab() == null) { if (getDynamicTab() == null) {
// Remove any debug specific args from the config // Remove any debug-specific arguments from the configuration.
if (wc == null) { if (wc == null) {
if (getLaunchConfiguration().isWorkingCopy()) { if (getLaunchConfiguration().isWorkingCopy()) {
wc = (ILaunchConfigurationWorkingCopy)getLaunchConfiguration(); wc = (ILaunchConfigurationWorkingCopy) getLaunchConfiguration();
} }
} }
if (wc != null) { if (wc != null) {
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP, (Map<?,?>)null); wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_SPECIFIC_ATTRS_MAP,
(Map<?, ?>) null);
} }
} else { } else {
if (wc == null) { if (wc == null) {
try { try {
if (getLaunchConfiguration().isWorkingCopy()) { if (getLaunchConfiguration().isWorkingCopy()) {
setLaunchConfigurationWorkingCopy((ILaunchConfigurationWorkingCopy)getLaunchConfiguration()); setLaunchConfigurationWorkingCopy((ILaunchConfigurationWorkingCopy) getLaunchConfiguration());
} else { } else {
setLaunchConfigurationWorkingCopy(getLaunchConfiguration().getWorkingCopy()); setLaunchConfigurationWorkingCopy(getLaunchConfiguration().getWorkingCopy());
} }
wc = getLaunchConfigurationWorkingCopy(); wc = getLaunchConfigurationWorkingCopy();
} catch (CoreException e) { } catch (CoreException e) {
return; return;
} }
@ -562,7 +562,7 @@ public class CDebuggerTab extends CLaunchConfigurationTab {
if (fDCombo == null) { if (fDCombo == null) {
return; return;
} }
fDCombo.removeAll(); fDCombo.removeAll();
int select = -1; int select = -1;
for (int i = 0; i < names.length; i++) { for (int i = 0; i < names.length; i++) {