mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Bug 316987: Show full paths preference under C/C++->Debug is not really necessary
This commit is contained in:
parent
af62fdaef7
commit
d36946d206
5 changed files with 10 additions and 48 deletions
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.internal.ui.actions;
|
|||
|
||||
import org.eclipse.cdt.debug.core.CDIDebugModel;
|
||||
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
|
||||
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
|
@ -22,7 +21,6 @@ import org.eclipse.debug.internal.ui.views.launch.LaunchView;
|
|||
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||
import org.eclipse.debug.ui.IDebugView;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.StructuredViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
@ -36,11 +34,13 @@ import org.eclipse.swt.custom.BusyIndicator;
|
|||
*/
|
||||
public class ShowFullPathsAction extends ViewFilterAction {
|
||||
|
||||
public static final String PREF_KEY = "org.eclipse.cdt.debug.ui.cDebug.show_full_paths"; //$NON-NLS-1$
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.ViewFilterAction#getPreferenceKey()
|
||||
*/
|
||||
protected String getPreferenceKey() {
|
||||
return ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS;
|
||||
return PREF_KEY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -64,14 +64,8 @@ public class ShowFullPathsAction extends ViewFilterAction {
|
|||
BusyIndicator.showWhile( viewer.getControl().getDisplay(),
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
|
||||
// We must first set a special key, to be able to tell that our preference is really set
|
||||
// This is because when we set a boolean preference to false, the key is automatically
|
||||
// removed, because the default value is 'false'
|
||||
String isSetKey = key + IS_SET_SUFFIX;
|
||||
store.setValue( isSetKey, true );
|
||||
store.setValue( key, getValue() );
|
||||
getPreferenceStore().setValue( key, getValue() );
|
||||
CDebugUIPlugin.getDefault().savePluginPreferences();
|
||||
|
||||
// Refresh the viewer after we've set the preference because
|
||||
|
@ -100,7 +94,7 @@ public class ShowFullPathsAction extends ViewFilterAction {
|
|||
ILaunchManager launchmgr = DebugPlugin.getDefault().getLaunchManager();
|
||||
ILaunch[] launches = launchmgr.getLaunches();
|
||||
for (ILaunch launch : launches) {
|
||||
if (launch.getAttribute(ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS) != null &&
|
||||
if (launch.getAttribute(getPreferenceKey()) != null &&
|
||||
launch.isTerminated() == false) {
|
||||
setEnabled(true);
|
||||
return;
|
||||
|
|
|
@ -38,8 +38,6 @@ import org.eclipse.ui.IViewPart;
|
|||
*/
|
||||
public abstract class ViewFilterAction extends ViewerFilter implements IViewActionDelegate, IActionDelegate2 {
|
||||
|
||||
protected final static String IS_SET_SUFFIX = ".isSet"; //$NON-NLS-1$
|
||||
|
||||
private IViewPart fView;
|
||||
private IAction fAction;
|
||||
|
||||
|
@ -95,11 +93,6 @@ public abstract class ViewFilterAction extends ViewerFilter implements IViewActi
|
|||
viewer.refresh();
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
|
||||
// We must first set a special key, to be able to tell that our preference is really set
|
||||
// This is because when we set a boolean preference to false, the key is automatically
|
||||
// removed, because the default value is 'false'
|
||||
String isSetKey = key + IS_SET_SUFFIX;
|
||||
store.setValue(isSetKey, true);
|
||||
store.setValue(key, action.isChecked());
|
||||
CDebugUIPlugin.getDefault().savePluginPreferences();
|
||||
}
|
||||
|
@ -168,18 +161,8 @@ public abstract class ViewFilterAction extends ViewerFilter implements IViewActi
|
|||
* @return boolean
|
||||
*/
|
||||
protected boolean getPreferenceValue(IViewPart part) {
|
||||
String baseKey = getPreferenceKey();
|
||||
String viewKey = part.getSite().getId();
|
||||
String compositeKey = viewKey + "." + baseKey; //$NON-NLS-1$
|
||||
String isSetCompositeKey = compositeKey + IS_SET_SUFFIX;
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
boolean value = false;
|
||||
if (store.contains(isSetCompositeKey)) {
|
||||
value = store.getBoolean(compositeKey);
|
||||
} else {
|
||||
value = store.getBoolean(baseKey);
|
||||
}
|
||||
return value;
|
||||
String key = part.getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
|
||||
return getPreferenceStore().getBoolean(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,9 +56,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
|
||||
private IWorkbench fWorkbench;
|
||||
|
||||
// View setting widgets
|
||||
private Button fPathsButton;
|
||||
|
||||
private Combo fVariableFormatCombo;
|
||||
|
||||
private Combo fExpressionFormatCombo;
|
||||
|
@ -67,8 +64,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
|
||||
private Combo fCharsetCombo;
|
||||
|
||||
private static final int NUMBER_OF_DIGITS = 3;
|
||||
|
||||
// Format constants
|
||||
private static int[] fFormatIds = new int[]{ ICDIFormat.NATURAL, ICDIFormat.HEXADECIMAL, ICDIFormat.DECIMAL, ICDIFormat.BINARY };
|
||||
|
||||
|
@ -152,7 +147,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
*/
|
||||
private void setValues() {
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
fPathsButton.setSelection( store.getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
|
||||
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
|
||||
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
||||
fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
|
||||
|
@ -181,7 +175,7 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
*/
|
||||
public static void initDefaults( IPreferenceStore store ) {
|
||||
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_HEX_VALUES, false );
|
||||
store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true );
|
||||
// store.setDefault( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, true );
|
||||
PreferenceConverter.setDefault( store, IInternalCDebugUIConstants.DISASSEMBLY_SOURCE_LINE_COLOR, IInternalCDebugUIConstants.DEFAULT_DISASSEMBLY_SOURCE_LINE_RGB );
|
||||
}
|
||||
|
||||
|
@ -198,7 +192,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
*/
|
||||
private void createViewSettingPreferences( Composite parent ) {
|
||||
Composite comp = createGroupComposite( parent, 1, PreferenceMessages.getString( "CDebugPreferencePage.4" ) ); //$NON-NLS-1$
|
||||
fPathsButton = createCheckButton( comp, PreferenceMessages.getString( "CDebugPreferencePage.5" ) ); //$NON-NLS-1$
|
||||
Composite formatComposite = ControlFactory.createCompositeEx( comp, 2, 0 );
|
||||
((GridLayout)formatComposite.getLayout()).makeColumnsEqualWidth = true;
|
||||
fVariableFormatCombo = createComboBox( formatComposite, PreferenceMessages.getString( "CDebugPreferencePage.8" ), fFormatLabels, fFormatLabels[0] ); //$NON-NLS-1$
|
||||
|
@ -308,7 +301,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
*/
|
||||
private void storeValues() {
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
store.setValue( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS, fPathsButton.getSelection() );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, getFormatId( fVariableFormatCombo.getSelectionIndex() ) );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId( fExpressionFormatCombo.getSelectionIndex() ) );
|
||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, getFormatId( fRegisterFormatCombo.getSelectionIndex() ) );
|
||||
|
@ -328,7 +320,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
|||
|
||||
private void setDefaultValues() {
|
||||
IPreferenceStore store = getPreferenceStore();
|
||||
fPathsButton.setSelection( store.getDefaultBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
|
||||
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
|
||||
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
||||
fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
|
||||
|
|
|
@ -21,11 +21,6 @@ import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
|||
*/
|
||||
public interface ICDebugPreferenceConstants {
|
||||
|
||||
/**
|
||||
* Boolean preference controlling whether the debugger shows full paths. When <code>true</code> the debugger will show full paths in newly opened views.
|
||||
*/
|
||||
public static final String PREF_SHOW_FULL_PATHS = ICDebugUIConstants.PLUGIN_ID + ".cDebug.show_full_paths"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Boolean preference controlling whether primitive types display hexadecimal values.
|
||||
*/
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.ui;
|
||||
|
||||
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
|
||||
import org.eclipse.cdt.debug.internal.ui.actions.ShowFullPathsAction;
|
||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||
|
||||
|
@ -94,6 +94,5 @@ public interface IDsfDebugUIConstants {
|
|||
* The value of this id must match what is being used as a full key in ShowFullPathsAction.run()
|
||||
*
|
||||
* @since 2.1 */
|
||||
public static final String DEBUG_VIEW_SHOW_FULL_PATH_PROPERTY = IDebugUIConstants.ID_DEBUG_VIEW + "." + ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS; //$NON-NLS-1$
|
||||
|
||||
public static final String DEBUG_VIEW_SHOW_FULL_PATH_PROPERTY = IDebugUIConstants.ID_DEBUG_VIEW + "." + ShowFullPathsAction.PREF_KEY; //$NON-NLS-1$
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue