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

Bug 281970: Needed a way to check if setDefaults() was called that was unique for each configuration.

This commit is contained in:
Marc Khouzam 2010-05-17 20:23:32 +00:00
parent ccb7b7ed22
commit f2fab88813
3 changed files with 63 additions and 24 deletions

View file

@ -34,7 +34,7 @@ public class LocalApplicationCDebuggerTab extends CDebuggerTab {
* default settings saved.
* Bug 281970
*/
private boolean fSetDefaultCalled;
private final static String DEFAULTS_SET = "org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
public LocalApplicationCDebuggerTab() {
super(SessionType.LOCAL, false);
@ -42,22 +42,22 @@ public class LocalApplicationCDebuggerTab extends CDebuggerTab {
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
fSetDefaultCalled = true;
config.setAttribute(DEFAULTS_SET, true);
super.setDefaults(config);
}
@Override
public void initializeFrom(ILaunchConfiguration config) {
if (fSetDefaultCalled == false) {
try {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
} catch (CoreException e) {
}
}
try {
if (config.hasAttribute(DEFAULTS_SET) == false) {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
}
} catch (CoreException e) {
}
super.initializeFrom(config);
}

View file

@ -11,6 +11,9 @@
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
/**
* Debugger tab to use for a remote application launch configuration.
@ -19,7 +22,43 @@ import org.eclipse.cdt.dsf.gdb.service.SessionType;
*/
public class RemoteApplicationCDebuggerTab extends CDebuggerTab {
/*
* When the launch configuration is created for Run mode,
* this Debugger tab is not created because it is not used
* for Run mode but only for Debug mode.
* When we then open the same configuration in Debug mode, the launch
* configuration already exists and initializeFrom() is called
* instead of setDefaults().
* We therefore call setDefaults() ourselves and update the configuration.
* If we don't then the user will be required to press Apply to get the
* default settings saved.
* Bug 281970
*/
private final static String DEFAULTS_SET = "org.eclipse.cdt.dsf.gdb.internal.ui.launching.RemoteApplicationCDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
public RemoteApplicationCDebuggerTab() {
super(SessionType.REMOTE, false);
}
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(DEFAULTS_SET, true);
super.setDefaults(config);
}
@Override
public void initializeFrom(ILaunchConfiguration config) {
try {
if (config.hasAttribute(DEFAULTS_SET) == false) {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
}
} catch (CoreException e) {
}
super.initializeFrom(config);
}
}

View file

@ -32,7 +32,7 @@ public class ApplicationCDebuggerTab extends CDebuggerTab {
* default settings saved.
* Bug 281970
*/
private boolean fSetDefaultCalled;
private final static String DEFAULTS_SET = "org.eclipse.cdt.launch.ui.ApplicationCDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
public ApplicationCDebuggerTab() {
super (false);
@ -40,22 +40,22 @@ public class ApplicationCDebuggerTab extends CDebuggerTab {
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
fSetDefaultCalled = true;
config.setAttribute(DEFAULTS_SET, true);
super.setDefaults(config);
}
@Override
public void initializeFrom(ILaunchConfiguration config) {
if (fSetDefaultCalled == false) {
try {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
} catch (CoreException e) {
}
}
try {
if (config.hasAttribute(DEFAULTS_SET) == false) {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
}
} catch (CoreException e) {
}
super.initializeFrom(config);
}