mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 515296: Cosmetics.
Change-Id: I25996dc6fe1b4f3f01de4089e6322fd39009ab03
This commit is contained in:
parent
4a7088a1c1
commit
546a5a6c91
1 changed files with 103 additions and 99 deletions
|
@ -50,7 +50,8 @@ import org.eclipse.ui.ide.dialogs.EncodingFieldEditor;
|
||||||
import org.osgi.service.prefs.BackingStoreException;
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preference page for debug preferences that apply specifically to C/C++ Debugging.
|
* Preference page for debug preferences that apply specifically to C/C++
|
||||||
|
* Debugging.
|
||||||
*/
|
*/
|
||||||
public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
|
public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
|
||||||
|
|
||||||
|
@ -104,11 +105,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
setDescription(PreferenceMessages.getString("CDebugPreferencePage.3")); //$NON-NLS-1$
|
setDescription(PreferenceMessages.getString("CDebugPreferencePage.3")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Control createContents(Composite parent) {
|
protected Control createContents(Composite parent) {
|
||||||
getWorkbench().getHelpSystem().setHelp(getControl(), ICDebugHelpContextIds.C_DEBUG_PREFERENCE_PAGE);
|
getWorkbench().getHelpSystem().setHelp(getControl(), ICDebugHelpContextIds.C_DEBUG_PREFERENCE_PAGE);
|
||||||
|
@ -132,7 +128,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the values of the component widgets based on the values in the preference store
|
* Set the values of the component widgets based on the values in the
|
||||||
|
* preference store
|
||||||
*/
|
*/
|
||||||
private void setValues() {
|
private void setValues() {
|
||||||
// Set the charset editors.
|
// Set the charset editors.
|
||||||
|
@ -141,38 +138,47 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
PreferenceStore ps = new PreferenceStore();
|
PreferenceStore ps = new PreferenceStore();
|
||||||
|
|
||||||
// Get the default charset and the default wide charset.
|
// Get the default charset and the default wide charset.
|
||||||
String defaultCharset = DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).get(ICDebugConstants.PREF_DEBUG_CHARSET, null);
|
String defaultCharset = DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID)
|
||||||
|
.get(ICDebugConstants.PREF_DEBUG_CHARSET, null);
|
||||||
if (defaultCharset != null) {
|
if (defaultCharset != null) {
|
||||||
ps.setDefault(ICDebugConstants.PREF_DEBUG_CHARSET, defaultCharset);
|
ps.setDefault(ICDebugConstants.PREF_DEBUG_CHARSET, defaultCharset);
|
||||||
}
|
}
|
||||||
String defaultWideCharset = DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).get(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, null);
|
String defaultWideCharset = DefaultScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID)
|
||||||
|
.get(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, null);
|
||||||
if (defaultWideCharset != null) {
|
if (defaultWideCharset != null) {
|
||||||
ps.setDefault(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, defaultWideCharset);
|
ps.setDefault(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, defaultWideCharset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the charset and the wide charset. If they're unset, use the default instead.
|
/*
|
||||||
// Note that we have to call the setValue() function of the PreferenceStore even if we
|
* Get the charset and the wide charset. If they're unset, use the
|
||||||
// want to use the default. This is to ensure proper display of the encoding field editor.
|
* default instead. Note that we have to call the setValue() function of
|
||||||
String charset = InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).get(ICDebugConstants.PREF_DEBUG_CHARSET, null);
|
* the PreferenceStore even if we want to use the default. This is to
|
||||||
|
* ensure proper display of the encoding field editor.
|
||||||
|
*/
|
||||||
|
String charset = InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID)
|
||||||
|
.get(ICDebugConstants.PREF_DEBUG_CHARSET, null);
|
||||||
if (charset != null) {
|
if (charset != null) {
|
||||||
ps.setValue(ICDebugConstants.PREF_DEBUG_CHARSET, charset);
|
ps.setValue(ICDebugConstants.PREF_DEBUG_CHARSET, charset);
|
||||||
} else if (defaultCharset != null) {
|
} else if (defaultCharset != null) {
|
||||||
ps.setValue(ICDebugConstants.PREF_DEBUG_CHARSET, defaultCharset);
|
ps.setValue(ICDebugConstants.PREF_DEBUG_CHARSET, defaultCharset);
|
||||||
}
|
}
|
||||||
String wideCharset = InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).get(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, null);
|
String wideCharset = InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID)
|
||||||
|
.get(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, null);
|
||||||
if (wideCharset != null) {
|
if (wideCharset != null) {
|
||||||
ps.setValue(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, wideCharset);
|
ps.setValue(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, wideCharset);
|
||||||
} else if (defaultWideCharset != null) {
|
} else if (defaultWideCharset != null) {
|
||||||
ps.setValue(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, defaultWideCharset);
|
ps.setValue(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, defaultWideCharset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the encoding field editors with the values from the preference store.
|
// Initialize the encoding field editors with the values from the
|
||||||
|
// preference store.
|
||||||
fCharsetEditor.setPreferenceStore(ps);
|
fCharsetEditor.setPreferenceStore(ps);
|
||||||
fCharsetEditor.load();
|
fCharsetEditor.load();
|
||||||
fWideCharsetEditor.setPreferenceStore(ps);
|
fWideCharsetEditor.setPreferenceStore(ps);
|
||||||
fWideCharsetEditor.load();
|
fWideCharsetEditor.load();
|
||||||
|
|
||||||
// Tell the encoding field editors to check the "Default" option if we're currently using the default values.
|
// Tell the encoding field editors to check the "Default" option if
|
||||||
|
// we're currently using the default values.
|
||||||
if (charset == null) {
|
if (charset == null) {
|
||||||
fCharsetEditor.loadDefault();
|
fCharsetEditor.loadDefault();
|
||||||
}
|
}
|
||||||
|
@ -180,16 +186,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
fWideCharsetEditor.loadDefault();
|
fWideCharsetEditor.loadDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the values for the remaining preferences.
|
// Set the values for the remaining preferences.
|
||||||
fShowBinarySourceFilesButton.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID, CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true, null));
|
fShowBinarySourceFilesButton.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID,
|
||||||
|
CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void init(IWorkbench workbench) {
|
public void init(IWorkbench workbench) {
|
||||||
fWorkbench = workbench;
|
fWorkbench = workbench;
|
||||||
|
@ -209,9 +210,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
store.setDefault(ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false);
|
store.setDefault(ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
@ -226,21 +224,25 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
|
|
||||||
// Create charset editor
|
// Create charset editor
|
||||||
Composite charsetComposite = ControlFactory.createComposite(formatComposite, 1);
|
Composite charsetComposite = ControlFactory.createComposite(formatComposite, 1);
|
||||||
fCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_DEBUG_CHARSET, "", PreferenceMessages.getString( "CDebugPreferencePage.18" ), charsetComposite); //$NON-NLS-1$ //$NON-NLS-2$
|
fCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_DEBUG_CHARSET, "", //$NON-NLS-1$
|
||||||
|
PreferenceMessages.getString("CDebugPreferencePage.18"), charsetComposite); //$NON-NLS-1$
|
||||||
fCharsetEditor.setPropertyChangeListener(getPropertyChangeListener());
|
fCharsetEditor.setPropertyChangeListener(getPropertyChangeListener());
|
||||||
|
|
||||||
// Create wide charset editor
|
// Create wide charset editor
|
||||||
Composite wideCharsetComposite = ControlFactory.createComposite(formatComposite, 1);
|
Composite wideCharsetComposite = ControlFactory.createComposite(formatComposite, 1);
|
||||||
fWideCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, "", PreferenceMessages.getString( "CDebugPreferencePage.16" ), wideCharsetComposite); //$NON-NLS-1$ //$NON-NLS-2$
|
fWideCharsetEditor = new EncodingFieldEditor(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, "", //$NON-NLS-1$
|
||||||
|
PreferenceMessages.getString("CDebugPreferencePage.16"), wideCharsetComposite); //$NON-NLS-1$
|
||||||
fWideCharsetEditor.setPropertyChangeListener(getPropertyChangeListener());
|
fWideCharsetEditor.setPropertyChangeListener(getPropertyChangeListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createBinarySettings(Composite parent) {
|
private void createBinarySettings(Composite parent) {
|
||||||
fShowBinarySourceFilesButton = createCheckButton( parent, PreferenceMessages.getString("CDebugPreferencePage.15") ); //$NON-NLS-1$
|
fShowBinarySourceFilesButton = createCheckButton(parent,
|
||||||
|
PreferenceMessages.getString("CDebugPreferencePage.15")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a button with the given label and sets the default configuration data.
|
* Creates a button with the given label and sets the default configuration
|
||||||
|
* data.
|
||||||
*/
|
*/
|
||||||
private Button createCheckButton(Composite parent, String label) {
|
private Button createCheckButton(Composite parent, String label) {
|
||||||
Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
|
Button button = new Button(parent, SWT.CHECK | SWT.LEFT);
|
||||||
|
@ -258,9 +260,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
label.setLayoutData(gd);
|
label.setLayoutData(gd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
storeValues();
|
storeValues();
|
||||||
|
@ -278,7 +277,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the variables and expression views as changes have occurred that affects these views.
|
* Refresh the variables and expression views as changes have occurred that
|
||||||
|
* affects these views.
|
||||||
*/
|
*/
|
||||||
private void refreshViews() {
|
private void refreshViews() {
|
||||||
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
|
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
|
||||||
|
@ -325,7 +325,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_CHARSET);
|
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_CHARSET);
|
||||||
} else {
|
} else {
|
||||||
fCharsetEditor.store();
|
fCharsetEditor.store();
|
||||||
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_CHARSET, fCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_CHARSET));
|
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_CHARSET,
|
||||||
|
fCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_CHARSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the wide charset.
|
// Store the wide charset.
|
||||||
|
@ -333,11 +334,13 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET);
|
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET);
|
||||||
} else {
|
} else {
|
||||||
fWideCharsetEditor.store();
|
fWideCharsetEditor.store();
|
||||||
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, fWideCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET));
|
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET,
|
||||||
|
fWideCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the other preferences.
|
// Store the other preferences.
|
||||||
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection());
|
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean(
|
||||||
|
CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -354,7 +357,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
private void setDefaultValues() {
|
private void setDefaultValues() {
|
||||||
fCharsetEditor.loadDefault();
|
fCharsetEditor.loadDefault();
|
||||||
fWideCharsetEditor.loadDefault();
|
fWideCharsetEditor.loadDefault();
|
||||||
fShowBinarySourceFilesButton.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).getBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true));
|
fShowBinarySourceFilesButton.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID)
|
||||||
|
.getBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IWorkbench getWorkbench() {
|
private IWorkbench getWorkbench() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue