diff options
author | Pierre Sachot | 2017-04-21 14:13:16 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2017-04-28 16:09:18 +0000 |
commit | 10b1e6e4c7e7b55cdc46c9378f9b9f0b7d23d06e (patch) | |
tree | a957b2224e3c9a51f8fa301c22b55de2b546a851 /debug/org.eclipse.cdt.debug.ui/src/org/eclipse | |
parent | 9462c1db2421f05ab00e271da33a18d30bac7bbb (diff) | |
download | org.eclipse.cdt-10b1e6e4c7e7b55cdc46c9378f9b9f0b7d23d06e.tar.gz org.eclipse.cdt-10b1e6e4c7e7b55cdc46c9378f9b9f0b7d23d06e.tar.xz org.eclipse.cdt-10b1e6e4c7e7b55cdc46c9378f9b9f0b7d23d06e.zip |
Bug 515296: New Preferences for Source not found Editor
You now have more precise options for the Source not
Found Editor.
Change-Id: I7391e50c0a9bf7fc712a45d1946e5a24e91c4991
Signed-off-by: Pierre Sachot <sachot.pierre@laposte.net>
Signed-off-by: Yannick Mayeur <yannick.mayeur@gmail.com>
Also-by: Pierre Sachot <sachot.pierre@laposte.net>
Also-by: Yannick Mayeur <yannick.mayeur@gmail.com>
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org/eclipse')
5 files changed, 111 insertions, 41 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java index 2e0077c5783..ae0d6a87ce2 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/CDebugPreferencePage.java @@ -40,6 +40,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbench; @@ -64,8 +65,10 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr private PropertyChangeListener fPropertyChangeListener; private Button fShowBinarySourceFilesButton; - - private Button fShowSourceNotFoundEditor; + + private Button fShowSourceNotFoundAllTime; + private Button fShowSourceNotFoundOnlyCaseSourceNotFound; + private Button fShowSourceNotFoundNever; protected class PropertyChangeListener implements IPropertyChangeListener { @@ -124,8 +127,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr createSpacer(composite, 1); createCharsetSettingPreferences(composite); createSpacer(composite, 1); - createBinarySettings(composite); createShowSourceNotFoundEditor(composite); + createSpacer(composite, 1); + createBinarySettings(composite); setValues(); return composite; } @@ -193,8 +197,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr fShowBinarySourceFilesButton.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID, CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true, null)); - fShowSourceNotFoundEditor.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID, - CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true, null)); + // Set the values for show source not found editor + String showEditor = Platform.getPreferencesService().getString(CCorePlugin.PLUGIN_ID, + CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, + CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_DEFAULT, null); + setShowEditorButtons(showEditor); } @Override @@ -245,11 +252,27 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr fShowBinarySourceFilesButton = createCheckButton(parent, PreferenceMessages.getString("CDebugPreferencePage.15")); //$NON-NLS-1$ } - - private void createShowSourceNotFoundEditor(Composite parent) - { - fShowSourceNotFoundEditor = createCheckButton(parent, - PreferenceMessages.getString("CDebugPreferencePage.21")); //$NON-NLS-1$ + + private void createShowSourceNotFoundEditor(Composite composite) { + Group buttonGroupForSourceNotFound = new Group(composite, SWT.SHADOW_ETCHED_IN); + { + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 1; + buttonGroupForSourceNotFound.setLayout(gridLayout); + buttonGroupForSourceNotFound.setText(PreferenceMessages.getString("CDebugPreferencePage.24")); //$NON-NLS-1$ + Label preferenceText = new Label(buttonGroupForSourceNotFound, SWT.READ_ONLY | SWT.WRAP); + preferenceText.setText(PreferenceMessages.getString("CDebugPreferencePage.26")); //$NON-NLS-1$ + } + + { + fShowSourceNotFoundAllTime = createRadioButton(buttonGroupForSourceNotFound, + PreferenceMessages.getString("CDebugPreferencePage.22")); //$NON-NLS-1$ + fShowSourceNotFoundAllTime.setToolTipText(PreferenceMessages.getString("CDebugPreferencePage.25")); //$NON-NLS-1$ + fShowSourceNotFoundOnlyCaseSourceNotFound = createRadioButton(buttonGroupForSourceNotFound, + PreferenceMessages.getString("CDebugPreferencePage.23")); //$NON-NLS-1$ + fShowSourceNotFoundNever = createRadioButton(buttonGroupForSourceNotFound, + PreferenceMessages.getString("CDebugPreferencePage.21")); //$NON-NLS-1$ + } } /** @@ -265,6 +288,15 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr return button; } + private Button createRadioButton(Composite parent, String label) { + Button button = new Button(parent, SWT.RADIO | SWT.LEFT); + button.setText(label); + // FieldEditor GridData + GridData data = new GridData(); + button.setLayoutData(data); + return button; + } + protected void createSpacer(Composite composite, int columnSpan) { Label label = new Label(composite, SWT.NONE); GridData gd = new GridData(); @@ -354,8 +386,19 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr 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_NOT_FOUND_EDITOR, fShowSourceNotFoundEditor.getSelection()); + // Store the show source file editor + if (fShowSourceNotFoundAllTime.getSelection()) { + InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID) + .put(CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME); + } + if (fShowSourceNotFoundOnlyCaseSourceNotFound.getSelection()) { + InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID) + .put(CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_SOMETIMES); + } + if (fShowSourceNotFoundNever.getSelection()) { + InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID) + .put(CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_NEVER); + } } /** @@ -368,14 +411,32 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr setDefaultValues(); super.performDefaults(); } + + private void setShowEditorButtons(String value) + { + switch (value) { + case CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_SOMETIMES: + fShowSourceNotFoundOnlyCaseSourceNotFound.setSelection(true); + break; + case CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_NEVER: + fShowSourceNotFoundNever.setSelection(true); + break; + case CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME: + default: + fShowSourceNotFoundAllTime.setSelection(true); + break; + } + } private void setDefaultValues() { fCharsetEditor.loadDefault(); fWideCharsetEditor.loadDefault(); fShowBinarySourceFilesButton.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID) .getBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true)); - fShowSourceNotFoundEditor.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID) - .getBoolean(CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true)); + String defaultSourceShow = DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).get( + CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_DEFAULT, + CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME); + setShowEditorButtons(defaultSourceShow); } private IWorkbench getWorkbench() { diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties index ead7928f3ff..21a1f71f4e8 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/PreferenceMessages.properties @@ -24,7 +24,12 @@ CDebugPreferencePage.16=Wide character encoding CDebugPreferencePage.18=Character encoding CDebugPreferencePage.19=The selected character encoding is not supported. CDebugPreferencePage.20=The selected wide character encoding is not supported. -CDebugPreferencePage.21=Show the Source Not Found editor when debugger stops at an address with no debug information, or if the associated source file cannot be found. +CDebugPreferencePage.21=Never +CDebugPreferencePage.22=All the time +CDebugPreferencePage.23=Only if source file name is known but not found +CDebugPreferencePage.24=Source Not Found +CDebugPreferencePage.25=If source file name is known but not found or the debugger doesn't know the source name but knows the function name or address. +CDebugPreferencePage.26=Show the Source Not Found Editor : SourcePreferencePage.0=Default S&ource Lookup Path: DebuggerTypesPage.0=Select All DebuggerTypesPage.1=Deselect All diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditor.java index b5f23e80e25..59349d19989 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditor.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditor.java @@ -15,8 +15,6 @@ package org.eclipse.cdt.debug.internal.ui.sourcelookup; import java.util.ArrayList; import java.util.Arrays; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.CCorePreferenceConstants; import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; @@ -29,13 +27,13 @@ import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; import org.eclipse.cdt.internal.core.model.ExternalTranslationUnit; import org.eclipse.cdt.internal.ui.util.EditorUtility; import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.core.filesystem.URIUtil; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; @@ -61,19 +59,22 @@ import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.PreferencesUtil; /** * Editor that lets you select a replacement for the missing source file and * modifies the source locator accordingly. */ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor { + private static final String SOURCE_NOT_FOUND_PATH = "org.eclipse.cdt.debug.ui.CDebugPreferencePage" //$NON-NLS-1$ +; public final String foundMappingsContainerName = "Found Mappings"; //$NON-NLS-1$ private static final String UID_KEY = ".uid"; //$NON-NLS-1$ private static final String UID_CLASS_NAME = CSourceNotFoundEditor.class.getName(); public static final String UID_DISASSEMBLY_BUTTON = UID_CLASS_NAME + "disassemblyButton"; //$NON-NLS-1$ public static final String UID_LOCATE_FILE_BUTTON = UID_CLASS_NAME + "locateFileButton"; //$NON-NLS-1$ public static final String UID_EDIT_LOOKUP_BUTTON = UID_CLASS_NAME + "editLookupButton"; //$NON-NLS-1$ - public static final String UID_SHOW_SOURCE_NOT_FOUND_EDITOR_CHECKBOX = UID_CLASS_NAME + "dontShowSourceEditorButton"; //$NON-NLS-1$ + public static final String UID_OPEN_PREFERENCE_BUTTON = UID_CLASS_NAME + "preferenceButton"; //$NON-NLS-1$ private String missingFile = ""; //$NON-NLS-1$ private ILaunchConfiguration launch; @@ -88,7 +89,9 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor { private boolean isDebugElement; private boolean isTranslationUnit; private Text fText; - private Button dontShowSourceEditorButton; + + private Text preferenceText; + private Button preferenceButton; public CSourceNotFoundEditor() { super(); @@ -184,26 +187,6 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor { @Override protected void createButtons(Composite parent) { - { - GridData data; - dontShowSourceEditorButton = new Button(parent, SWT.CHECK); - data = new GridData(); - data.grabExcessHorizontalSpace = false; - data.grabExcessVerticalSpace = false; - dontShowSourceEditorButton.setLayoutData(data); - dontShowSourceEditorButton.setSelection(true); - dontShowSourceEditorButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_6); - dontShowSourceEditorButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( - CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, - dontShowSourceEditorButton.getSelection()); - - }; - }); - dontShowSourceEditorButton.setData(UID_KEY, UID_SHOW_SOURCE_NOT_FOUND_EDITOR_CHECKBOX); - } if (isDebugElement) { GridData data; @@ -255,6 +238,24 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor { }); editLookupButton.setData(UID_KEY, UID_EDIT_LOOKUP_BUTTON); } + + { + Composite data = ControlFactory.createComposite(parent, 2); + ((GridLayout) data.getLayout()).marginWidth = 0; + ((GridLayout) data.getLayout()).marginHeight = 0; + preferenceText = new Text(data, SWT.READ_ONLY | SWT.WRAP); + preferenceButton = new Button(data, SWT.PUSH); + preferenceText.setText(SourceLookupUIMessages.CSourceNotFoundEditor_6); + preferenceButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_7); + preferenceButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + PreferencesUtil.createPreferenceDialogOn(parent.getShell(), SOURCE_NOT_FOUND_PATH, null, null) + .open(); + } + }); + } + syncButtons(); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java index 90e3eaec0ef..cfeb206e879 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.java @@ -56,6 +56,8 @@ public class SourceLookupUIMessages extends NLS { public static String CSourceNotFoundEditor_4; public static String CSourceNotFoundEditor_5; public static String CSourceNotFoundEditor_6; + public static String CSourceNotFoundEditor_7; + public static String CSourceNotFoundEditor_8; public static String CompilationDirectorySourceContainerDialog_0; public static String CompilationDirectorySourceContainerDialog_1; public static String CompilationDirectorySourceContainerDialog_2; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties index d4bdde4a2e4..0cf258584e5 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/SourceLookupUIMessages.properties @@ -52,7 +52,8 @@ CSourceNotFoundEditor_2=Missing Source File CSourceNotFoundEditor_3=No source available for \"{0}\" \n CSourceNotFoundEditor_4=View Disassembly... CSourceNotFoundEditor_5=Edit Source Lookup Path... -CSourceNotFoundEditor_6=Show the Source Not Found editor when debugger stops at an address with no debug information, or if the associated source file cannot be found. +CSourceNotFoundEditor_6=Configure when this editor is shown +CSourceNotFoundEditor_7=Preferences... CompilationDirectorySourceContainerDialog_0=Directory Selection CompilationDirectorySourceContainerDialog_1=Choose directory to add: CompilationDirectorySourceContainerDialog_2=Compilation directory |