mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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>
This commit is contained in:
parent
9462c1db24
commit
10b1e6e4c7
7 changed files with 193 additions and 56 deletions
|
@ -154,11 +154,39 @@ 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.
|
* Attempt to (not) show c source not found editor in debug. String value,
|
||||||
|
* one of {@link #SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME},
|
||||||
|
* {@link #SHOW_SOURCE_NOT_FOUND_EDITOR_SOMETIMES},
|
||||||
|
* {@link #SHOW_SOURCE_NOT_FOUND_EDITOR_NEVER}
|
||||||
|
*
|
||||||
* @since 6.3
|
* @since 6.3
|
||||||
*/
|
*/
|
||||||
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR = CCorePlugin.PLUGIN_ID + ".showSourceNotFoundEditor"; //$NON-NLS-1$
|
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR = CCorePlugin.PLUGIN_ID + ".showSourceNotFoundEditor"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to display all the time the source not found editor
|
||||||
|
* @since 6.3
|
||||||
|
*/
|
||||||
|
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME = "all_time"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to display sometimes the source not found editor
|
||||||
|
* @since 6.3
|
||||||
|
*/
|
||||||
|
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR_SOMETIMES = "sometimes"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to don't display the source not found editor
|
||||||
|
* @since 6.3
|
||||||
|
*/
|
||||||
|
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR_NEVER = "never"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use to display by default the source not found editor
|
||||||
|
* @since 6.3
|
||||||
|
*/
|
||||||
|
public static final String SHOW_SOURCE_NOT_FOUND_EDITOR_DEFAULT = SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show source roots at the top level of projects.
|
* Show source roots at the top level of projects.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.ui.IViewPart;
|
import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IWorkbench;
|
import org.eclipse.ui.IWorkbench;
|
||||||
|
@ -65,7 +66,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
|
|
||||||
private Button fShowBinarySourceFilesButton;
|
private Button fShowBinarySourceFilesButton;
|
||||||
|
|
||||||
private Button fShowSourceNotFoundEditor;
|
private Button fShowSourceNotFoundAllTime;
|
||||||
|
private Button fShowSourceNotFoundOnlyCaseSourceNotFound;
|
||||||
|
private Button fShowSourceNotFoundNever;
|
||||||
|
|
||||||
protected class PropertyChangeListener implements IPropertyChangeListener {
|
protected class PropertyChangeListener implements IPropertyChangeListener {
|
||||||
|
|
||||||
|
@ -124,8 +127,9 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
createSpacer(composite, 1);
|
createSpacer(composite, 1);
|
||||||
createCharsetSettingPreferences(composite);
|
createCharsetSettingPreferences(composite);
|
||||||
createSpacer(composite, 1);
|
createSpacer(composite, 1);
|
||||||
createBinarySettings(composite);
|
|
||||||
createShowSourceNotFoundEditor(composite);
|
createShowSourceNotFoundEditor(composite);
|
||||||
|
createSpacer(composite, 1);
|
||||||
|
createBinarySettings(composite);
|
||||||
setValues();
|
setValues();
|
||||||
return composite;
|
return composite;
|
||||||
}
|
}
|
||||||
|
@ -193,8 +197,11 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
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,
|
// Set the values for show source not found editor
|
||||||
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true, null));
|
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
|
@Override
|
||||||
|
@ -246,10 +253,26 @@ 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)
|
private void createShowSourceNotFoundEditor(Composite composite) {
|
||||||
{
|
Group buttonGroupForSourceNotFound = new Group(composite, SWT.SHADOW_ETCHED_IN);
|
||||||
fShowSourceNotFoundEditor = createCheckButton(parent,
|
{
|
||||||
PreferenceMessages.getString("CDebugPreferencePage.21")); //$NON-NLS-1$
|
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;
|
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) {
|
protected void createSpacer(Composite composite, int columnSpan) {
|
||||||
Label label = new Label(composite, SWT.NONE);
|
Label label = new Label(composite, SWT.NONE);
|
||||||
GridData gd = new GridData();
|
GridData gd = new GridData();
|
||||||
|
@ -354,8 +386,19 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
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(
|
// Store the show source file editor
|
||||||
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, fShowSourceNotFoundEditor.getSelection());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -369,13 +412,31 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
super.performDefaults();
|
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() {
|
private void setDefaultValues() {
|
||||||
fCharsetEditor.loadDefault();
|
fCharsetEditor.loadDefault();
|
||||||
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)
|
String defaultSourceShow = DefaultScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).get(
|
||||||
.getBoolean(CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true));
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_DEFAULT,
|
||||||
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME);
|
||||||
|
setShowEditorButtons(defaultSourceShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IWorkbench getWorkbench() {
|
private IWorkbench getWorkbench() {
|
||||||
|
|
|
@ -24,7 +24,12 @@ 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.
|
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:
|
SourcePreferencePage.0=Default S&ource Lookup Path:
|
||||||
DebuggerTypesPage.0=Select All
|
DebuggerTypesPage.0=Select All
|
||||||
DebuggerTypesPage.1=Deselect All
|
DebuggerTypesPage.1=Deselect All
|
||||||
|
|
|
@ -15,8 +15,6 @@ 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;
|
||||||
|
@ -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.core.model.ExternalTranslationUnit;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
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;
|
||||||
|
@ -61,19 +59,22 @@ import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.dialogs.PreferencesUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editor that lets you select a replacement for the missing source file and
|
* Editor that lets you select a replacement for the missing source file and
|
||||||
* modifies the source locator accordingly.
|
* modifies the source locator accordingly.
|
||||||
*/
|
*/
|
||||||
public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
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$
|
public final String foundMappingsContainerName = "Found Mappings"; //$NON-NLS-1$
|
||||||
private static final String UID_KEY = ".uid"; //$NON-NLS-1$
|
private static final String UID_KEY = ".uid"; //$NON-NLS-1$
|
||||||
private static final String UID_CLASS_NAME = CSourceNotFoundEditor.class.getName();
|
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_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$
|
public static final String UID_OPEN_PREFERENCE_BUTTON = UID_CLASS_NAME + "preferenceButton"; //$NON-NLS-1$
|
||||||
|
|
||||||
private String missingFile = ""; //$NON-NLS-1$
|
private String missingFile = ""; //$NON-NLS-1$
|
||||||
private ILaunchConfiguration launch;
|
private ILaunchConfiguration launch;
|
||||||
|
@ -88,7 +89,9 @@ 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;
|
|
||||||
|
private Text preferenceText;
|
||||||
|
private Button preferenceButton;
|
||||||
|
|
||||||
public CSourceNotFoundEditor() {
|
public CSourceNotFoundEditor() {
|
||||||
super();
|
super();
|
||||||
|
@ -184,26 +187,6 @@ 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;
|
||||||
|
@ -255,6 +238,24 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
});
|
});
|
||||||
editLookupButton.setData(UID_KEY, UID_EDIT_LOOKUP_BUTTON);
|
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();
|
syncButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ public class SourceLookupUIMessages extends NLS {
|
||||||
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 CSourceNotFoundEditor_6;
|
||||||
|
public static String CSourceNotFoundEditor_7;
|
||||||
|
public static String CSourceNotFoundEditor_8;
|
||||||
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,7 +52,8 @@ 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.
|
CSourceNotFoundEditor_6=Configure when this editor is shown
|
||||||
|
CSourceNotFoundEditor_7=Preferences...
|
||||||
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
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.eclipse.core.filesystem.EFS;
|
||||||
import org.eclipse.core.filesystem.IFileStore;
|
import org.eclipse.core.filesystem.IFileStore;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
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.Platform;
|
||||||
|
@ -419,20 +420,24 @@ 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,
|
CSourceNotFoundEditorInput cSourceInput = ((CSourceNotFoundEditorInput) input);
|
||||||
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true, null)) {
|
String showEditor = Platform.getPreferencesService().getString(CCorePlugin.PLUGIN_ID,
|
||||||
editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID);
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR,
|
||||||
/*
|
CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_DEFAULT, null);
|
||||||
* Don't open additional source not found
|
switch (showEditor) {
|
||||||
* editors if there is one to reuse.
|
case CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_SOMETIMES:
|
||||||
*/
|
if (isSourceFileNameKnown(cSourceInput)) {
|
||||||
editor[0] = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID);
|
editor[0] = openCSourceNotFoundEditor(input, id);
|
||||||
if (editor[0] instanceof IReusableEditor) {
|
|
||||||
IReusableEditor re = (IReusableEditor) editor[0];
|
|
||||||
if (!input.equals(re.getEditorInput())) {
|
|
||||||
re.setInput(input);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_NEVER:
|
||||||
|
// does nothing because we don't want to
|
||||||
|
// display the source not found editor
|
||||||
|
break;
|
||||||
|
case CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_THE_TIME:
|
||||||
|
default:
|
||||||
|
editor[0] = openCSourceNotFoundEditor(input, id);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
editor[0] = page.openEditor(input, id, false);
|
editor[0] = page.openEditor(input, id, false);
|
||||||
|
@ -441,6 +446,40 @@ public class DsfSourceDisplayAdapter implements ISourceDisplay, ISteppingControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSourceFileNameKnown(CSourceNotFoundEditorInput input) {
|
||||||
|
Object artifact = input.getArtifact();
|
||||||
|
String missingFile = null;
|
||||||
|
if (artifact instanceof CSourceNotFoundElement) {
|
||||||
|
CSourceNotFoundElement element = (CSourceNotFoundElement) artifact;
|
||||||
|
missingFile = element.getFile();
|
||||||
|
} else if (artifact instanceof ITranslationUnit) {
|
||||||
|
ITranslationUnit tunit = (ITranslationUnit) artifact;
|
||||||
|
IPath tuPath = tunit.getLocation();
|
||||||
|
if (tuPath != null)
|
||||||
|
missingFile = tuPath.toOSString();
|
||||||
|
} else {
|
||||||
|
missingFile = ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (missingFile != null && missingFile.length() > 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEditorPart openCSourceNotFoundEditor(IEditorInput input, String id) throws PartInitException {
|
||||||
|
IEditorPart editor = page.openEditor(input, id, false, IWorkbenchPage.MATCH_ID);
|
||||||
|
/*
|
||||||
|
* Don't open additional source not found editors if there
|
||||||
|
* is one to reuse.
|
||||||
|
*/
|
||||||
|
if (editor instanceof IReusableEditor) {
|
||||||
|
IReusableEditor re = (IReusableEditor) editor;
|
||||||
|
if (!input.equals(re.getEditorInput())) {
|
||||||
|
re.setInput(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
BusyIndicator.showWhile(Display.getDefault(), r);
|
BusyIndicator.showWhile(Display.getDefault(), r);
|
||||||
return editor[0];
|
return editor[0];
|
||||||
|
|
Loading…
Add table
Reference in a new issue