mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +02:00
Bug 515296: Adding choice to not show editor again
We added a checkbox to disable the source not found editor and an option in preferences for adding it again. Change-Id: Icc7a21cd14ea81e53517d0b3c420de0927335ed4 Also-by: Yannick Mayeur <yannick.mayeur@gmail.com> Signed-off-by: Pierre Sachot <sachot.pierre@laposte.net>
This commit is contained in:
parent
765960cec6
commit
8be69a5985
7 changed files with 68 additions and 9 deletions
|
@ -153,6 +153,12 @@ public class CCorePreferenceConstants {
|
||||||
*/
|
*/
|
||||||
public static final String SHOW_SOURCE_FILES_IN_BINARIES = CCorePlugin.PLUGIN_ID + ".showSourceFilesInBinaries"; //$NON-NLS-1$
|
public static final String SHOW_SOURCE_FILES_IN_BINARIES = CCorePlugin.PLUGIN_ID + ".showSourceFilesInBinaries"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to (not) show c source not found editor in debug.
|
||||||
|
* @since 6.3
|
||||||
|
*/
|
||||||
|
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR = CCorePlugin.PLUGIN_ID + ".showSourceNotFoundEditor"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show source roots at the top level of projects.
|
* Show source roots at the top level of projects.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
|
@ -65,6 +65,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
|
|
||||||
private Button fShowBinarySourceFilesButton;
|
private Button fShowBinarySourceFilesButton;
|
||||||
|
|
||||||
|
private Button fShowSourceNotFoundEditor;
|
||||||
|
|
||||||
protected class PropertyChangeListener implements IPropertyChangeListener {
|
protected class PropertyChangeListener implements IPropertyChangeListener {
|
||||||
|
|
||||||
private boolean fHasStateChanged = false;
|
private boolean fHasStateChanged = false;
|
||||||
|
@ -123,6 +125,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
createCharsetSettingPreferences(composite);
|
createCharsetSettingPreferences(composite);
|
||||||
createSpacer(composite, 1);
|
createSpacer(composite, 1);
|
||||||
createBinarySettings(composite);
|
createBinarySettings(composite);
|
||||||
|
createShowSourceNotFoundEditor(composite);
|
||||||
setValues();
|
setValues();
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
@ -189,6 +192,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
// Set the values for the remaining preferences.
|
// Set the values for the remaining preferences.
|
||||||
fShowBinarySourceFilesButton.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID,
|
fShowBinarySourceFilesButton.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID,
|
||||||
CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true, null));
|
CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true, null));
|
||||||
|
|
||||||
|
fShowSourceNotFoundEditor.setSelection(Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID,
|
||||||
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -240,6 +246,12 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
PreferenceMessages.getString("CDebugPreferencePage.15")); //$NON-NLS-1$
|
PreferenceMessages.getString("CDebugPreferencePage.15")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createShowSourceNotFoundEditor(Composite parent)
|
||||||
|
{
|
||||||
|
fShowSourceNotFoundEditor = createCheckButton(parent,
|
||||||
|
PreferenceMessages.getString("CDebugPreferencePage.21")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a button with the given label and sets the default configuration
|
* Creates a button with the given label and sets the default configuration
|
||||||
* data.
|
* data.
|
||||||
|
@ -341,6 +353,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
// Store the other preferences.
|
// Store the other preferences.
|
||||||
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean(
|
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean(
|
||||||
CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection());
|
CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection());
|
||||||
|
|
||||||
|
InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean(
|
||||||
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, fShowSourceNotFoundEditor.getSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,6 +374,8 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
fWideCharsetEditor.loadDefault();
|
fWideCharsetEditor.loadDefault();
|
||||||
fShowBinarySourceFilesButton.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID)
|
fShowBinarySourceFilesButton.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID)
|
||||||
.getBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true));
|
.getBoolean(CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, true));
|
||||||
|
fShowSourceNotFoundEditor.setSelection(DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID)
|
||||||
|
.getBoolean(CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IWorkbench getWorkbench() {
|
private IWorkbench getWorkbench() {
|
||||||
|
|
|
@ -24,6 +24,7 @@ CDebugPreferencePage.16=Wide character encoding
|
||||||
CDebugPreferencePage.18=Character encoding
|
CDebugPreferencePage.18=Character encoding
|
||||||
CDebugPreferencePage.19=The selected character encoding is not supported.
|
CDebugPreferencePage.19=The selected character encoding is not supported.
|
||||||
CDebugPreferencePage.20=The selected wide 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.
|
||||||
SourcePreferencePage.0=Default S&ource Lookup Path:
|
SourcePreferencePage.0=Default S&ource Lookup Path:
|
||||||
DebuggerTypesPage.0=Select All
|
DebuggerTypesPage.0=Select All
|
||||||
DebuggerTypesPage.1=Deselect All
|
DebuggerTypesPage.1=Deselect All
|
||||||
|
|
|
@ -15,6 +15,8 @@ package org.eclipse.cdt.debug.internal.ui.sourcelookup;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
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.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||||
|
@ -33,6 +35,7 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
|
@ -70,6 +73,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
public static final String UID_DISASSEMBLY_BUTTON = UID_CLASS_NAME + "disassemblyButton"; //$NON-NLS-1$
|
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_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_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$
|
||||||
|
|
||||||
private String missingFile = ""; //$NON-NLS-1$
|
private String missingFile = ""; //$NON-NLS-1$
|
||||||
private ILaunchConfiguration launch;
|
private ILaunchConfiguration launch;
|
||||||
|
@ -84,6 +88,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
private boolean isDebugElement;
|
private boolean isDebugElement;
|
||||||
private boolean isTranslationUnit;
|
private boolean isTranslationUnit;
|
||||||
private Text fText;
|
private Text fText;
|
||||||
|
private Button dontShowSourceEditorButton;
|
||||||
|
|
||||||
public CSourceNotFoundEditor() {
|
public CSourceNotFoundEditor() {
|
||||||
super();
|
super();
|
||||||
|
@ -179,6 +184,27 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createButtons(Composite parent) {
|
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) {
|
if (isDebugElement) {
|
||||||
GridData data;
|
GridData data;
|
||||||
disassemblyButton = new Button(parent, SWT.PUSH);
|
disassemblyButton = new Button(parent, SWT.PUSH);
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class SourceLookupUIMessages extends NLS {
|
||||||
public static String CSourceNotFoundEditor_3;
|
public static String CSourceNotFoundEditor_3;
|
||||||
public static String CSourceNotFoundEditor_4;
|
public static String CSourceNotFoundEditor_4;
|
||||||
public static String CSourceNotFoundEditor_5;
|
public static String CSourceNotFoundEditor_5;
|
||||||
|
public static String CSourceNotFoundEditor_6;
|
||||||
public static String CompilationDirectorySourceContainerDialog_0;
|
public static String CompilationDirectorySourceContainerDialog_0;
|
||||||
public static String CompilationDirectorySourceContainerDialog_1;
|
public static String CompilationDirectorySourceContainerDialog_1;
|
||||||
public static String CompilationDirectorySourceContainerDialog_2;
|
public static String CompilationDirectorySourceContainerDialog_2;
|
||||||
|
|
|
@ -52,6 +52,7 @@ CSourceNotFoundEditor_2=Missing Source File
|
||||||
CSourceNotFoundEditor_3=No source available for \"{0}\" \n
|
CSourceNotFoundEditor_3=No source available for \"{0}\" \n
|
||||||
CSourceNotFoundEditor_4=View Disassembly...
|
CSourceNotFoundEditor_4=View Disassembly...
|
||||||
CSourceNotFoundEditor_5=Edit Source Lookup Path...
|
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.
|
||||||
CompilationDirectorySourceContainerDialog_0=Directory Selection
|
CompilationDirectorySourceContainerDialog_0=Directory Selection
|
||||||
CompilationDirectorySourceContainerDialog_1=Choose directory to add:
|
CompilationDirectorySourceContainerDialog_1=Choose directory to add:
|
||||||
CompilationDirectorySourceContainerDialog_2=Compilation directory
|
CompilationDirectorySourceContainerDialog_2=Compilation directory
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
|
||||||
import org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditorInput;
|
import org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditorInput;
|
||||||
|
@ -53,6 +55,7 @@ import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
|
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
|
||||||
|
@ -416,15 +419,19 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
||||||
if (!page.getWorkbenchWindow().getWorkbench().isClosing()) {
|
if (!page.getWorkbenchWindow().getWorkbench().isClosing()) {
|
||||||
try {
|
try {
|
||||||
if (input instanceof CSourceNotFoundEditorInput) {
|
if (input instanceof CSourceNotFoundEditorInput) {
|
||||||
/*
|
if (Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID,
|
||||||
* Don't open additional source not found
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true, null)) {
|
||||||
* editors if there is one to reuse.
|
editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID);
|
||||||
*/
|
/*
|
||||||
editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID);
|
* Don't open additional source not found
|
||||||
if (editor[0] instanceof IReusableEditor) {
|
* editors if there is one to reuse.
|
||||||
IReusableEditor re = (IReusableEditor) editor[0];
|
*/
|
||||||
if (!input.equals(re.getEditorInput())) {
|
editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID);
|
||||||
re.setInput(input);
|
if (editor[0] instanceof IReusableEditor) {
|
||||||
|
IReusableEditor re = (IReusableEditor) editor[0];
|
||||||
|
if (!input.equals(re.getEditorInput())) {
|
||||||
|
re.setInput(input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue