Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2004-04-01 20:16:55 +0000
committerMikhail Khodjaiants2004-04-01 20:16:55 +0000
commite9f35af8d7bebde74ee8e71f4ed40713bea2f9ff (patch)
tree03a003182faaf96582fb47906191a576dd076f2c /debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug
parent884e67b57e55334d234b1599af4e4af76143d8a2 (diff)
downloadorg.eclipse.cdt-e9f35af8d7bebde74ee8e71f4ed40713bea2f9ff.tar.gz
org.eclipse.cdt-e9f35af8d7bebde74ee8e71f4ed40713bea2f9ff.tar.xz
org.eclipse.cdt-e9f35af8d7bebde74ee8e71f4ed40713bea2f9ff.zip
Moved the "Show Full Paths" action from toolbars to view's menus.
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java205
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.java34
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties1
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.java34
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties6
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java72
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java152
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java59
8 files changed, 494 insertions, 69 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java
new file mode 100644
index 00000000000..aba6bf6bd0a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java
@@ -0,0 +1,205 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+
+package org.eclipse.cdt.debug.internal.ui;
+
+import java.util.HashMap;
+
+import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
+import org.eclipse.cdt.debug.core.model.ICSignal;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IRegisterGroup;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IValueDetailListener;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+
+/**
+ * Enter type comment.
+ *
+ * @since: Feb 4, 2004
+ */
+public class CDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
+
+ public final static String DISPLAY_FULL_PATHS = "DISPLAY_FULL_PATHS"; //$NON-NLS-1$
+
+ protected HashMap fAttributes = new HashMap( 3 );
+
+ protected CDebugImageDescriptorRegistry fDebugImageRegistry = CDebugUIPlugin.getImageDescriptorRegistry();
+
+ private OverlayImageCache fImageCache = new OverlayImageCache();
+
+ private static CDebugModelPresentation gfInstance = null;
+
+ public static CDebugModelPresentation getDefault() {
+ if ( gfInstance == null )
+ gfInstance = new CDebugModelPresentation();
+ return gfInstance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDebugModelPresentation#setAttribute(java.lang.String, java.lang.Object)
+ */
+ public void setAttribute( String attribute, Object value ) {
+ if ( value == null )
+ return;
+ getAttributes().put( attribute, value );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.IDebugModelPresentation#computeDetail(org.eclipse.debug.core.model.IValue, org.eclipse.debug.ui.IValueDetailListener)
+ */
+ public void computeDetail( IValue value, IValueDetailListener listener ) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ISourcePresentation#getEditorInput(java.lang.Object)
+ */
+ public IEditorInput getEditorInput( Object element ) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ISourcePresentation#getEditorId(org.eclipse.ui.IEditorInput, java.lang.Object)
+ */
+ public String getEditorId( IEditorInput input, Object element ) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Image getImage( Object element ) {
+ Image baseImage = getBaseImage( element );
+ if ( baseImage != null ) {
+ ImageDescriptor[] overlays = new ImageDescriptor[] { null, null, null, null };
+
+ return getImageCache().getImageFor( new OverlayImageDescriptor( baseImage, overlays ) );
+ }
+ return getDefaultImage( element );
+ }
+
+ private Image getBaseImage( Object element ) {
+ if ( element instanceof ICSharedLibrary )
+ return getSharedLibraryImage( (ICSharedLibrary)element );
+ if ( element instanceof IRegisterGroup )
+ return getRegisterGroupImage( (IRegisterGroup)element );
+ if ( element instanceof ICSignal )
+ return getSignalImage( (ICSignal)element );
+ return super.getImage( element );
+ }
+
+ protected Image getSharedLibraryImage( ICSharedLibrary element ) {
+ if ( element.areSymbolsLoaded() ) {
+ return getImageCache().getImageFor(
+ new OverlayImageDescriptor( getDebugImageRegistry().get( CDebugImages.DESC_OBJS_LOADED_SHARED_LIBRARY ),
+ new ImageDescriptor[] { null, CDebugImages.DESC_OVRS_SYMBOLS, null, null } ) );
+ }
+ return CDebugUIPlugin.getImageDescriptorRegistry().get( CDebugImages.DESC_OBJS_SHARED_LIBRARY );
+ }
+
+ protected Image getSignalImage( ICSignal signal ) {
+ return CDebugUIPlugin.getImageDescriptorRegistry().get( CDebugImages.DESC_OBJS_SIGNAL );
+ }
+
+ protected Image getRegisterGroupImage( IRegisterGroup element ) {
+ return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP );
+ }
+
+ public String getText( Object element ) {
+ StringBuffer baseText = new StringBuffer( getBaseText( element ) );
+ return baseText.toString();
+ }
+
+ private String getBaseText( Object element ) {
+ boolean showQualified = isShowQualifiedNames();
+ StringBuffer label = new StringBuffer();
+
+ if ( element instanceof ICSharedLibrary ) {
+ label.append( getSharedLibraryText( (ICSharedLibrary)element, showQualified ) );
+ return label.toString();
+ }
+ if ( element instanceof IRegisterGroup ) {
+ label.append( getRegisterGroupText( (IRegisterGroup)element ) );
+ return label.toString();
+ }
+
+ if ( label.length() > 0 ) {
+ return label.toString();
+ }
+
+ return getDefaultText( element );
+ }
+
+ protected String getSharedLibraryText( ICSharedLibrary library, boolean qualified ) {
+ String label = new String();
+ String name = library.getFileName();
+ if ( !isEmpty( name ) ) {
+ IPath path = new Path( library.getFileName() );
+ if ( !path.isEmpty() )
+ label += ( qualified ? path.toOSString() : path.lastSegment() );
+ }
+ else {
+ label += "unknown";
+ }
+ return label;
+ }
+
+ protected String getRegisterGroupText( IRegisterGroup group ) {
+ String name = "<not available>";
+ try {
+ name = group.getName();
+ }
+ catch( DebugException e ) {
+ CDebugUIPlugin.log( e.getStatus() );
+ }
+ return name;
+ }
+
+ protected boolean isShowQualifiedNames() {
+ Boolean showQualified = (Boolean)getAttributes().get( DISPLAY_FULL_PATHS );
+ showQualified = showQualified == null ? Boolean.FALSE : showQualified;
+ return showQualified.booleanValue();
+ }
+
+ private HashMap getAttributes() {
+ return this.fAttributes;
+ }
+
+ private OverlayImageCache getImageCache() {
+ return this.fImageCache;
+ }
+
+ private CDebugImageDescriptorRegistry getDebugImageRegistry() {
+ return this.fDebugImageRegistry;
+ }
+
+ private boolean isEmpty( String string ) {
+ return ( string == null || string.trim().length() == 0 );
+ }
+
+ /**
+ * Returns a default text label for the debug element
+ */
+ protected String getDefaultText(Object element) {
+ return DebugUIPlugin.getDefaultLabelProvider().getText( element );
+ }
+
+ /**
+ * Returns a default image for the debug element
+ */
+ protected Image getDefaultImage(Object element) {
+ return DebugUIPlugin.getDefaultLabelProvider().getImage( element );
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.java
new file mode 100644
index 00000000000..50f3fb74a96
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.java
@@ -0,0 +1,34 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+
+package org.eclipse.cdt.debug.internal.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Enter type comment.
+ *
+ * @since: Feb 23, 2004
+ */
+public class CDebugUIMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.CDebugUIMessages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+ private CDebugUIMessages() {
+ }
+
+ public static String getString( String key ) {
+ try {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch( MissingResourceException e ) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties
new file mode 100644
index 00000000000..468ca87d39e
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties
@@ -0,0 +1 @@
+CDebugUIPlugin.Error_1=Error
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.java
new file mode 100644
index 00000000000..955c998509c
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.java
@@ -0,0 +1,34 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Enter type comment.
+ *
+ * @since: Feb 23, 2004
+ */
+public class ActionMessages {
+
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.actions.ActionMessages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
+
+ private ActionMessages() {
+ }
+
+ public static String getString( String key ) {
+ try {
+ return RESOURCE_BUNDLE.getString( key );
+ }
+ catch( MissingResourceException e ) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
new file mode 100644
index 00000000000..d4ea66a8891
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties
@@ -0,0 +1,6 @@
+LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library_1=Unable to load symbols of shared library.
+LoadSymbolsActionDelegate.Operation_failed_1=Operation failed.
+LoadSymbolsForAllAction.Load_Symbols_For_All_1=Load Symbols For All
+LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for all shared libraries.
+LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
+LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols.
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java
index 8cfcdb1c81a..a3d5b8638eb 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ShowFullPathsAction.java
@@ -3,61 +3,63 @@
* All Rights Reserved.
*
*/
+
package org.eclipse.cdt.debug.internal.ui.actions;
-import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
+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.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.BusyIndicator;
/**
- *
- * Enter type comment.
- *
- * @since Oct 4, 2002
+ * An action delegate that toggles the state of its viewer to show/hide full paths.
+ *
+ * @since: Feb 23, 2004
*/
-public class ShowFullPathsAction extends ToggleDelegateAction
-{
+public class ShowFullPathsAction extends ViewFilterAction {
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.ToggleDelegateAction#initActionId()
+ * @see org.eclipse.cdt.debug.internal.ui.actions.ViewFilterAction#getPreferenceKey()
*/
- protected void initActionId()
- {
- fId = CDebugUIPlugin.getUniqueIdentifier() + getView().getSite().getId() + ".ShowFullPathsAction"; //$NON-NLS-1$
+ protected String getPreferenceKey() {
+ return ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS;
}
- protected void setAction( IAction action )
- {
- super.setAction( action );
- action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_SHOW_FULL_PATHS ) );
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public boolean select( Viewer viewer, Object parentElement, Object element ) {
+ return true;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.debug.internal.ui.actions.ToggleDelegateAction#valueChanged(boolean)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
- protected void valueChanged( boolean on )
- {
- if ( getViewer().getControl().isDisposed() )
- {
- return;
- }
- ILabelProvider labelProvider = (ILabelProvider)getViewer().getLabelProvider();
- if ( labelProvider instanceof IDebugModelPresentation )
- {
- IDebugModelPresentation debugLabelProvider = (IDebugModelPresentation)labelProvider;
- debugLabelProvider.setAttribute( CDTDebugModelPresentation.DISPLAY_FULL_PATHS, ( on ? Boolean.TRUE : Boolean.FALSE ) );
- BusyIndicator.showWhile( getViewer().getControl().getDisplay(),
- new Runnable()
- {
- public void run()
- {
- getViewer().refresh();
+ public void run( IAction action ) {
+ final StructuredViewer viewer = getStructuredViewer();
+ IDebugView view = (IDebugView)getView().getAdapter( IDebugView.class );
+ if (view != null) {
+ IDebugModelPresentation pres = view.getPresentation( CDIDebugModel.getPluginIdentifier() );
+ if ( pres != null ) {
+ pres.setAttribute( CDebugModelPresentation.DISPLAY_FULL_PATHS, ( getValue() ? Boolean.TRUE : Boolean.FALSE ) );
+ BusyIndicator.showWhile( viewer.getControl().getDisplay(),
+ new Runnable() {
+ public void run() {
+ viewer.refresh();
+ IPreferenceStore store = getPreferenceStore();
+ String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
+ store.setValue( key, getValue() );
+ CDebugUIPlugin.getDefault().savePluginPreferences();
}
} );
- }
+ }
+ }
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java
new file mode 100644
index 00000000000..97b27420cf3
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ViewFilterAction.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.debug.internal.ui.actions;
+
+
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+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;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+
+/**
+ *
+ */
+public abstract class ViewFilterAction extends ViewerFilter implements IViewActionDelegate, IActionDelegate2 {
+
+ private IViewPart fView;
+ private IAction fAction;
+
+ public ViewFilterAction() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ public void init(IViewPart view) {
+ fView = view;
+ fAction.setChecked(getPreferenceValue(view));
+ run(fAction);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
+ */
+ public void init(IAction action) {
+ fAction = action;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
+ */
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ StructuredViewer viewer = getStructuredViewer();
+ ViewerFilter[] filters = viewer.getFilters();
+ ViewerFilter filter = null;
+ for (int i = 0; i < filters.length; i++) {
+ if (filters[i] == this) {
+ filter = filters[i];
+ break;
+ }
+ }
+ if (filter == null) {
+ viewer.addFilter(this);
+ }
+ viewer.refresh();
+ IPreferenceStore store = getPreferenceStore();
+ String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$
+ store.setValue(key, action.isChecked());
+ CDebugUIPlugin.getDefault().savePluginPreferences();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ protected IPreferenceStore getPreferenceStore() {
+ return CDebugUIPlugin.getDefault().getPreferenceStore();
+ }
+
+ /**
+ * Returns the value of this filters preference (on/off) for the given
+ * view.
+ *
+ * @param part
+ * @return boolean
+ */
+ protected boolean getPreferenceValue(IViewPart part) {
+ String baseKey = getPreferenceKey();
+ String viewKey = part.getSite().getId();
+ String compositeKey = viewKey + "." + baseKey; //$NON-NLS-1$
+ IPreferenceStore store = getPreferenceStore();
+ boolean value = false;
+ if (store.contains(compositeKey)) {
+ value = store.getBoolean(compositeKey);
+ } else {
+ value = store.getBoolean(baseKey);
+ }
+ return value;
+ }
+
+ /**
+ * Returns the key for this action's preference
+ *
+ * @return String
+ */
+ protected abstract String getPreferenceKey();
+
+ protected IViewPart getView() {
+ return fView;
+ }
+
+ protected StructuredViewer getStructuredViewer() {
+ IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class);
+ if (view != null) {
+ Viewer viewer = view.getViewer();
+ if (viewer instanceof StructuredViewer) {
+ return (StructuredViewer)viewer;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns whether this action is seleted/checked.
+ *
+ * @return whether this action is seleted/checked
+ */
+ protected boolean getValue() {
+ return fAction.isChecked();
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java
index f2b03763f80..68f67431c24 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/ICDebugPreferenceConstants.java
@@ -1,7 +1,6 @@
/*
- *(c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- *
+ * (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved.
+ *
*/
package org.eclipse.cdt.debug.internal.ui.preferences;
@@ -13,38 +12,28 @@ import org.eclipse.swt.widgets.Display;
/**
*
- * Constants defining the keys to be used for accessing preferences
- * inside the debug ui plugin's preference bundle.
- *
- * In descriptions (of the keys) below describe the preference
- * stored at the given key. The type indicates type of the stored preferences
- *
+ * Constants defining the keys to be used for accessing preferences inside the debug ui plugin's preference bundle.
+ *
+ * In descriptions (of the keys) below describe the preference stored at the given key. The type indicates type of the stored preferences
+ *
* The preference store is loaded by the plugin (CDebugUIPlugin).
+ *
* @see CDebugUIPlugin.initializeDefaultPreferences(IPreferenceStore) - for initialization of the store
*
* @since Jul 23, 2002
*/
-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$
+public interface ICDebugPreferenceConstants {
/**
- * The default values for the memory view parameters.
+ * The default values for the memory view parameters.
*/
public static final String DEFAULT_MEMORY_PADDING_CHAR = "."; //$NON-NLS-1$
public static final FontData DEFAULT_MEMORY_FONT = Display.getDefault().getSystemFont().getFontData()[0];
-
public static final RGB DEFAULT_MEMORY_FOREGROUND_RGB = Display.getCurrent().getSystemColor( SWT.COLOR_LIST_FOREGROUND ).getRGB();
public static final RGB DEFAULT_MEMORY_BACKGROUND_RGB = Display.getCurrent().getSystemColor( SWT.COLOR_LIST_BACKGROUND ).getRGB();
public static final RGB DEFAULT_MEMORY_ADDRESS_RGB = Display.getCurrent().getSystemColor( SWT.COLOR_DARK_GRAY ).getRGB();
public static final RGB DEFAULT_MEMORY_CHANGED_RGB = Display.getCurrent().getSystemColor( SWT.COLOR_RED ).getRGB();
public static final RGB DEFAULT_MEMORY_DIRTY_RGB = Display.getCurrent().getSystemColor( SWT.COLOR_BLUE ).getRGB();
-
public static final String PREF_MEMORY_NUMBER_OF_BYTES = "Memory.NumberOfBytes"; //$NON-NLS-1$
public static final String PREF_MEMORY_SIZE = "Memory.Size"; //$NON-NLS-1$
public static final String PREF_MEMORY_FORMAT = "Memory.Format"; //$NON-NLS-1$
@@ -82,27 +71,29 @@ public interface ICDebugPreferenceConstants
public static final String MEMORY_FONT = "Memory.font"; //$NON-NLS-1$
/**
- * Boolean preference controlling whether primitive types
- * types display hexidecimal values.
+ * 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 types display hexidecimal values.
*/
- public static final String PREF_SHOW_HEX_VALUES = ICDebugUIConstants.PLUGIN_ID + "cDebug.showHexValues"; //$NON-NLS-1$
+ public static final String PREF_SHOW_HEX_VALUES = ICDebugUIConstants.PLUGIN_ID + ".cDebug.showHexValues"; //$NON-NLS-1$
/**
- * Boolean preference controlling whether primitive types
- * types display char values.
+ * Boolean preference controlling whether primitive types types display char values.
*/
- public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + "cDebug.showCharValues"; //$NON-NLS-1$
+ public static final String PREF_SHOW_CHAR_VALUES = ICDebugUIConstants.PLUGIN_ID + ".cDebug.showCharValues"; //$NON-NLS-1$
/**
- * Boolean preference controlling whether the memory view shows ASCII characters.
- * When <code>true</code> the memory view will show ASCII characters by default.
+ * Boolean preference controlling whether the memory view shows ASCII characters. When <code>true</code> the memory view will show ASCII characters by
+ * default.
*/
- public static final String PREF_MEMORY_SHOW_ASCII = ICDebugUIConstants.PLUGIN_ID + "Memory.show_ascii"; //$NON-NLS-1$
+ public static final String PREF_MEMORY_SHOW_ASCII = ICDebugUIConstants.PLUGIN_ID + ".Memory.show_ascii"; //$NON-NLS-1$
/**
- * Boolean preference controlling whether the memory view will be refreshed
- * every time when the execution of program stops.
- * When <code>true</code> the 'Auto-Refresh' option will be checked.
+ * Boolean preference controlling whether the memory view will be refreshed every time when the execution of program stops. When <code>true</code> the
+ * 'Auto-Refresh' option will be checked.
*/
- public static final String PREF_MEMORY_AUTO_REFRESH = ICDebugUIConstants.PLUGIN_ID + "Memory.auto_refresh"; //$NON-NLS-1$
-}
+ public static final String PREF_MEMORY_AUTO_REFRESH = ICDebugUIConstants.PLUGIN_ID + ".Memory.auto_refresh"; //$NON-NLS-1$
+} \ No newline at end of file

Back to the top