mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 281970: Needed a way to check if setDefaults() was called that was unique for each configuration.
This commit is contained in:
parent
ccb7b7ed22
commit
f2fab88813
3 changed files with 63 additions and 24 deletions
|
@ -34,7 +34,7 @@ public class LocalApplicationCDebuggerTab extends CDebuggerTab {
|
||||||
* default settings saved.
|
* default settings saved.
|
||||||
* Bug 281970
|
* 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() {
|
public LocalApplicationCDebuggerTab() {
|
||||||
super(SessionType.LOCAL, false);
|
super(SessionType.LOCAL, false);
|
||||||
|
@ -42,21 +42,21 @@ public class LocalApplicationCDebuggerTab extends CDebuggerTab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
||||||
fSetDefaultCalled = true;
|
config.setAttribute(DEFAULTS_SET, true);
|
||||||
|
|
||||||
super.setDefaults(config);
|
super.setDefaults(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeFrom(ILaunchConfiguration config) {
|
public void initializeFrom(ILaunchConfiguration config) {
|
||||||
if (fSetDefaultCalled == false) {
|
|
||||||
try {
|
try {
|
||||||
|
if (config.hasAttribute(DEFAULTS_SET) == false) {
|
||||||
ILaunchConfigurationWorkingCopy wc;
|
ILaunchConfigurationWorkingCopy wc;
|
||||||
wc = config.getWorkingCopy();
|
wc = config.getWorkingCopy();
|
||||||
setDefaults(wc);
|
setDefaults(wc);
|
||||||
wc.doSave();
|
wc.doSave();
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
super.initializeFrom(config);
|
super.initializeFrom(config);
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
package org.eclipse.cdt.dsf.gdb.internal.ui.launching;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.gdb.service.SessionType;
|
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.
|
* 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 {
|
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() {
|
public RemoteApplicationCDebuggerTab() {
|
||||||
super(SessionType.REMOTE, false);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class ApplicationCDebuggerTab extends CDebuggerTab {
|
||||||
* default settings saved.
|
* default settings saved.
|
||||||
* Bug 281970
|
* Bug 281970
|
||||||
*/
|
*/
|
||||||
private boolean fSetDefaultCalled;
|
private final static String DEFAULTS_SET = "org.eclipse.cdt.launch.ui.ApplicationCDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
|
||||||
|
|
||||||
public ApplicationCDebuggerTab() {
|
public ApplicationCDebuggerTab() {
|
||||||
super (false);
|
super (false);
|
||||||
|
@ -40,21 +40,21 @@ public class ApplicationCDebuggerTab extends CDebuggerTab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
|
||||||
fSetDefaultCalled = true;
|
config.setAttribute(DEFAULTS_SET, true);
|
||||||
|
|
||||||
super.setDefaults(config);
|
super.setDefaults(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeFrom(ILaunchConfiguration config) {
|
public void initializeFrom(ILaunchConfiguration config) {
|
||||||
if (fSetDefaultCalled == false) {
|
|
||||||
try {
|
try {
|
||||||
|
if (config.hasAttribute(DEFAULTS_SET) == false) {
|
||||||
ILaunchConfigurationWorkingCopy wc;
|
ILaunchConfigurationWorkingCopy wc;
|
||||||
wc = config.getWorkingCopy();
|
wc = config.getWorkingCopy();
|
||||||
setDefaults(wc);
|
setDefaults(wc);
|
||||||
wc.doSave();
|
wc.doSave();
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
super.initializeFrom(config);
|
super.initializeFrom(config);
|
||||||
|
|
Loading…
Add table
Reference in a new issue