Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 111683 Details for
Bug 246243
Convert debugger view contributions to command framework.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Path with fix.
20080904_jdiMenus.patch (text/plain), 78.75 KB, created by
Pawel Piech
on 2008-09-04 12:15:02 EDT
(
hide
)
Description:
Path with fix.
Filename:
MIME Type:
Creator:
Pawel Piech
Created:
2008-09-04 12:15:02 EDT
Size:
78.75 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug.ui >Index: ui/org/eclipse/jdt/internal/debug/ui/breakpoints/AddExceptionAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/breakpoints/AddExceptionAction.java,v >retrieving revision 1.16 >diff -u -r1.16 AddExceptionAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/breakpoints/AddExceptionAction.java 17 Jul 2007 17:14:14 -0000 1.16 >+++ ui/org/eclipse/jdt/internal/debug/ui/breakpoints/AddExceptionAction.java 4 Sep 2008 15:54:02 -0000 >@@ -14,6 +14,9 @@ > import java.util.HashMap; > import java.util.Map; > >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -39,17 +42,17 @@ > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.ui.IViewActionDelegate; > import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.IWorkbenchWindowActionDelegate; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.dialogs.SelectionDialog; >+import org.eclipse.ui.handlers.HandlerUtil; > > /** > * The workbench menu action for adding an exception breakpoint > */ >-public class AddExceptionAction implements IViewActionDelegate, IWorkbenchWindowActionDelegate { >+public class AddExceptionAction extends AbstractHandler implements IWorkbenchWindowActionDelegate { > > public static final String CAUGHT_CHECKED = "caughtChecked"; //$NON-NLS-1$ > public static final String UNCAUGHT_CHECKED = "uncaughtChecked"; //$NON-NLS-1$ >@@ -61,33 +64,42 @@ > * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) > */ > public void run(IAction action) { >- try { >- IDialogSettings settings = getDialogSettings(); >- AddExceptionTypeDialogExtension ext = new AddExceptionTypeDialogExtension(settings.getBoolean(CAUGHT_CHECKED), settings.getBoolean(UNCAUGHT_CHECKED)); >- SelectionDialog dialog = JavaUI.createTypeDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), >- fWindow, >- SearchEngine.createWorkspaceScope(), >- IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*Exception*", ext); //$NON-NLS-1$ >- dialog.setTitle(BreakpointMessages.AddExceptionAction_0); >- dialog.setMessage(BreakpointMessages.AddExceptionAction_1); >- dialog.create(); >- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IJavaDebugHelpContextIds.ADD_EXCEPTION_DIALOG); >- if(dialog.open() == IDialogConstants.OK_ID) { >- boolean caught = ext.shouldHandleCaughtExceptions(), >- uncaught = ext.shouldHandleUncaughtExceptions(); >- Object[] results = dialog.getResult(); >- if(results != null && results.length > 0) { >- try { >- createBreakpoint(caught, uncaught, (IType)results[0]); >- settings.put(CAUGHT_CHECKED, caught); >- settings.put(UNCAUGHT_CHECKED, uncaught); >- } >- catch (CoreException e) {JDIDebugUIPlugin.statusDialog(e.getStatus());} >- } >- >- } >- } >- catch (JavaModelException e1) {} >+ doRun(fWindow); >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ doRun(HandlerUtil.getActiveWorkbenchWindow(event)); >+ return null; >+ } >+ >+ public void doRun(IWorkbenchWindow window) { >+ try { >+ IDialogSettings settings = getDialogSettings(); >+ AddExceptionTypeDialogExtension ext = new AddExceptionTypeDialogExtension(settings.getBoolean(CAUGHT_CHECKED), settings.getBoolean(UNCAUGHT_CHECKED)); >+ SelectionDialog dialog = JavaUI.createTypeDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), >+ window, >+ SearchEngine.createWorkspaceScope(), >+ IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*Exception*", ext); //$NON-NLS-1$ >+ dialog.setTitle(BreakpointMessages.AddExceptionAction_0); >+ dialog.setMessage(BreakpointMessages.AddExceptionAction_1); >+ dialog.create(); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IJavaDebugHelpContextIds.ADD_EXCEPTION_DIALOG); >+ if(dialog.open() == IDialogConstants.OK_ID) { >+ boolean caught = ext.shouldHandleCaughtExceptions(), >+ uncaught = ext.shouldHandleUncaughtExceptions(); >+ Object[] results = dialog.getResult(); >+ if(results != null && results.length > 0) { >+ try { >+ createBreakpoint(caught, uncaught, (IType)results[0]); >+ settings.put(CAUGHT_CHECKED, caught); >+ settings.put(UNCAUGHT_CHECKED, uncaught); >+ } >+ catch (CoreException e) {JDIDebugUIPlugin.statusDialog(e.getStatus());} >+ } >+ >+ } >+ } >+ catch (JavaModelException e1) {} > } > > /** >Index: ui/org/eclipse/jdt/internal/debug/ui/JDIDebugUIPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIDebugUIPlugin.java,v >retrieving revision 1.141 >diff -u -r1.141 JDIDebugUIPlugin.java >--- ui/org/eclipse/jdt/internal/debug/ui/JDIDebugUIPlugin.java 6 May 2008 21:14:19 -0000 1.141 >+++ ui/org/eclipse/jdt/internal/debug/ui/JDIDebugUIPlugin.java 4 Sep 2008 15:54:02 -0000 >@@ -127,6 +127,8 @@ > > private IDebugModelPresentation fUtilPresentation; > >+ private ViewFilterManager fViewFilterManager; >+ > /** > * Java Debug UI listeners > */ >@@ -394,6 +396,8 @@ > } > }); > JavaDebugOptionsManager.getDefault().startup(); >+ >+ fViewFilterManager = new ViewFilterManager(); > } > > /* (non-Javadoc) >@@ -418,6 +422,11 @@ > fTextTools.dispose(); > } > ResourcesPlugin.getWorkspace().removeSaveParticipant(this); >+ >+ if (fViewFilterManager != null) { >+ fViewFilterManager.dispose(); >+ fViewFilterManager = null; >+ } > } finally { > super.stop(context); > } >Index: ui/org/eclipse/jdt/internal/debug/ui/variables/VariableOptionsAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/variables/VariableOptionsAction.java,v >retrieving revision 1.9 >diff -u -r1.9 VariableOptionsAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/variables/VariableOptionsAction.java 3 Apr 2007 20:23:52 -0000 1.9 >+++ ui/org/eclipse/jdt/internal/debug/ui/variables/VariableOptionsAction.java 4 Sep 2008 15:54:02 -0000 >@@ -10,55 +10,22 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.debug.ui.variables; > >-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; >-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; >-import org.eclipse.debug.ui.IDebugView; >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; > import org.eclipse.jdt.internal.debug.ui.SWTFactory; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.ui.IViewActionDelegate; >-import org.eclipse.ui.IViewPart; > > /** > * Action which opens preference settings for Java variables. > */ >-public class VariableOptionsAction implements IViewActionDelegate, IPropertyChangeListener { >- >- private IViewPart fPart; >+public class VariableOptionsAction extends AbstractHandler { > >- /* (non-Javadoc) >- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) >- */ >- public void init(IViewPart view) { >- fPart = view; >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ SWTFactory.showPreferencePage("org.eclipse.jdt.debug.ui.JavaDetailFormattersPreferencePage", //$NON-NLS-1$ >+ new String[] {"org.eclipse.jdt.debug.ui.JavaDetailFormattersPreferencePage", //$NON-NLS-1$ >+ "org.eclipse.jdt.debug.ui.JavaLogicalStructuresPreferencePage", //$NON-NLS-1$ >+ "org.eclipse.jdt.debug.ui.heapWalking", //$NON-NLS-1$ >+ "org.eclipse.jdt.debug.ui.JavaPrimitivesPreferencePage"}); //$NON-NLS-1$ >+ return null; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >- */ >- public void run(IAction action) { >- SWTFactory.showPreferencePage("org.eclipse.jdt.debug.ui.JavaDetailFormattersPreferencePage", //$NON-NLS-1$ >- new String[] {"org.eclipse.jdt.debug.ui.JavaDetailFormattersPreferencePage", //$NON-NLS-1$ >- "org.eclipse.jdt.debug.ui.JavaLogicalStructuresPreferencePage", //$NON-NLS-1$ >- "org.eclipse.jdt.debug.ui.heapWalking", //$NON-NLS-1$ >- "org.eclipse.jdt.debug.ui.JavaPrimitivesPreferencePage"}); //$NON-NLS-1$ >- } >- >- /* (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) { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) >- */ >- public void propertyChange(PropertyChangeEvent event) { >- if (fPart instanceof IDebugView) { >- IDebugView view = (IDebugView) fPart; >- view.getViewer().refresh(); >- } >- >- } >- > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowNullArrayEntriesAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowNullArrayEntriesAction.java,v >retrieving revision 1.4 >diff -u -r1.4 ShowNullArrayEntriesAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowNullArrayEntriesAction.java 24 Feb 2005 15:25:56 -0000 1.4 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowNullArrayEntriesAction.java 4 Sep 2008 15:54:02 -0000 >@@ -12,6 +12,7 @@ > > > import org.eclipse.debug.core.DebugException; >+import org.eclipse.debug.ui.IDebugView; > import org.eclipse.jdt.debug.core.IJavaDebugTarget; > import org.eclipse.jdt.internal.debug.core.model.JDIArrayEntryVariable; > import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants; >@@ -34,22 +35,32 @@ > return IJDIPreferencesConstants.PREF_SHOW_NULL_ARRAY_ENTRIES; > } > >- /** >- * @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) { >- if (getValue()) { >- // when on, filter nothing >- return true; >- } >- if (element instanceof JDIArrayEntryVariable) { >- JDIArrayEntryVariable variable = (JDIArrayEntryVariable)element; >- try { >- return !variable.getValue().equals(((IJavaDebugTarget)variable.getDebugTarget()).nullValue()); >- } catch (DebugException e) { >- JDIDebugUIPlugin.log(e); >- } >- } >- return true; >- } >+ private class ShowNullArrayEntriesFilter extends JDIViewerFilter { >+ ShowNullArrayEntriesFilter(IDebugView view) { >+ super(view); >+ } >+ >+ /** >+ * @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) { >+ if (getPreferenceValue()) { >+ // when on, filter nothing >+ return true; >+ } >+ if (element instanceof JDIArrayEntryVariable) { >+ JDIArrayEntryVariable variable = (JDIArrayEntryVariable)element; >+ try { >+ return !variable.getValue().equals(((IJavaDebugTarget)variable.getDebugTarget()).nullValue()); >+ } catch (DebugException e) { >+ JDIDebugUIPlugin.log(e); >+ } >+ } >+ return true; >+ } >+ } >+ >+ public static JDIViewerFilter getFilter(IDebugView view) { >+ return new ShowNullArrayEntriesAction().new ShowNullArrayEntriesFilter(view); >+ } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowSystemThreadsAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowSystemThreadsAction.java,v >retrieving revision 1.12 >diff -u -r1.12 ShowSystemThreadsAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowSystemThreadsAction.java 30 Jul 2008 14:36:56 -0000 1.12 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowSystemThreadsAction.java 4 Sep 2008 15:54:02 -0000 >@@ -15,17 +15,17 @@ > import org.eclipse.debug.core.DebugException; > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.core.IDebugEventSetListener; >+import org.eclipse.debug.ui.IDebugView; > import org.eclipse.jdt.debug.core.IJavaThread; > import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; > import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.ui.IViewPart; > > /** > * An action delegate that toggles the state of its viewer to > * show/hide System Threads. > */ >-public class ShowSystemThreadsAction extends ViewFilterAction implements IDebugEventSetListener { >+public class ShowSystemThreadsAction extends ViewFilterAction { > > /* (non-Javadoc) > * @see org.eclipse.jdt.internal.debug.ui.actions.ThreadFilterAction#getPreferenceKey() >@@ -37,84 +37,84 @@ > /* (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) { >- if (!getValue()) { >- >- IJavaThread thread = getJavaThread(element); >- >- if (thread != null) { >- try { >- // Show only non-system threads and suspended threads. >- return !thread.isSystemThread() || thread.isSuspended(); >- } catch (DebugException e) { >- } >- } >+ private class ShowSystemThreadsFilter extends JDIViewerFilter implements IDebugEventSetListener { >+ ShowSystemThreadsFilter(IDebugView view) { >+ super(view); >+ DebugPlugin.getDefault().addDebugEventListener(this); > } >- return true; >- } >+ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ if (!getPreferenceValue()) { >+ IJavaThread thread = getJavaThread(element); > >- private IJavaThread getJavaThread(Object element) { >- IJavaThread thread = null; >- >- if (element instanceof IJavaThread) >- thread = (IJavaThread) element; >- else if (element instanceof IAdaptable) >- thread = (IJavaThread) ((IAdaptable)element).getAdapter(IJavaThread.class); >- >- return thread; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) >- */ >- public void init(IViewPart view) { >- super.init(view); >- DebugPlugin.getDefault().addDebugEventListener(this); >- } >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionDelegate2#dispose() >- */ >- public void dispose() { >- super.dispose(); >- DebugPlugin.getDefault().removeDebugEventListener(this); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) >- */ >- public void handleDebugEvents(DebugEvent[] events) { >- if (getValue()) { >- // if showing system threads, no need to worry about displaying/hiding >- return; >- } >- for (int i = 0; i < events.length; i++) { >- DebugEvent event = events[i]; >- switch (event.getKind()) { >- case DebugEvent.RESUME: >- if (event.getDetail() == DebugEvent.CLIENT_REQUEST) { >- // when a system thread resumes we need to refresh the viewer to re-filter it >- refresh(event.getSource()); >- } >- break; >- } >- } >+ if (thread != null) { >+ try { >+ // Show only non-system threads and suspended threads. >+ return !thread.isSystemThread() || thread.isSuspended(); >+ } catch (DebugException e) { >+ } >+ } >+ } >+ return true; >+ } >+ >+ private IJavaThread getJavaThread(Object element) { >+ IJavaThread thread = null; >+ >+ if (element instanceof IJavaThread) >+ thread = (IJavaThread) element; >+ else if (element instanceof IAdaptable) >+ thread = (IJavaThread) ((IAdaptable)element).getAdapter(IJavaThread.class); >+ >+ return thread; >+ } >+ >+ public void dispose() { >+ super.dispose(); >+ DebugPlugin.getDefault().removeDebugEventListener(this); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) >+ */ >+ public void handleDebugEvents(DebugEvent[] events) { >+ if (getPreferenceValue()) { >+ // if showing system threads, no need to worry about displaying/hiding >+ return; >+ } >+ for (int i = 0; i < events.length; i++) { >+ DebugEvent event = events[i]; >+ switch (event.getKind()) { >+ case DebugEvent.RESUME: >+ if (event.getDetail() == DebugEvent.CLIENT_REQUEST) { >+ // when a system thread resumes we need to refresh the viewer to re-filter it >+ refresh(event.getSource()); >+ } >+ break; >+ } >+ } >+ } >+ >+ private void refresh(Object source) { >+ final IJavaThread thread = getJavaThread(source); >+ if (thread != null) { >+ try { >+ if (thread.isSystemThread()) { >+ Runnable r = new Runnable() { >+ public void run() { >+ getStructuredViewer().refresh(); >+ } >+ }; >+ JDIDebugUIPlugin.getStandardDisplay().asyncExec(r); >+ return; >+ } >+ } catch (DebugException e) { >+ } >+ } >+ } > } > >- private void refresh(Object source) { >- final IJavaThread thread = getJavaThread(source); >- if (thread != null) { >- try { >- if (thread.isSystemThread()) { >- Runnable r = new Runnable() { >- public void run() { >- getStructuredViewer().refresh(); >- } >- }; >- JDIDebugUIPlugin.getStandardDisplay().asyncExec(r); >- return; >- } >- } catch (DebugException e) { >- } >- } >+ public static JDIViewerFilter getFilter(IDebugView view) { >+ return new ShowSystemThreadsAction().new ShowSystemThreadsFilter(view); > } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ViewFilterAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ViewFilterAction.java,v >retrieving revision 1.8 >diff -u -r1.8 ViewFilterAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ViewFilterAction.java 4 Dec 2006 21:20:43 -0000 1.8 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ViewFilterAction.java 4 Sep 2008 15:54:02 -0000 >@@ -11,173 +11,155 @@ > package org.eclipse.jdt.internal.debug.ui.actions; > > >+import java.util.Map; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; > import org.eclipse.debug.ui.IDebugView; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; >-import org.eclipse.jface.action.IAction; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; >-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; >+import org.eclipse.swt.custom.BusyIndicator; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchPartSite; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.commands.ICommandService; >+import org.eclipse.ui.commands.IElementUpdater; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.ui.internal.services.IWorkbenchLocationService; >+import org.eclipse.ui.menus.UIElement; > > /** > * > */ >-public abstract class ViewFilterAction extends ViewerFilter implements IViewActionDelegate, IActionDelegate2 { >- >- private IViewPart fView; >- private IAction fAction; >- private IPropertyChangeListener fListener = new Updater(); >- >- class Updater implements IPropertyChangeListener { >- >- /* (non-Javadoc) >- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) >- */ >- public void propertyChange(PropertyChangeEvent event) { >- if (event.getProperty().equals(getPreferenceKey()) || >- event.getProperty().equals(getCompositeKey())) { >- fAction.setChecked(getPreferenceValue()); >- } >- >- } >+public abstract class ViewFilterAction extends AbstractHandler implements IElementUpdater { > >- } >- >+ /** >+ * Base class for viewer filters used in debug views. >+ */ >+ abstract public class JDIViewerFilter extends ViewerFilter { >+ >+ final private IDebugView fView; >+ private IPropertyChangeListener fListener = new Updater(); >+ >+ class Updater implements IPropertyChangeListener { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) >+ */ >+ public void propertyChange(PropertyChangeEvent event) { >+ if (event.getProperty().equals(getCompositeKey(fView.getSite()))) { >+ BusyIndicator.showWhile(fView.getSite().getShell().getDisplay(), new Runnable() { >+ public void run() { >+ getStructuredViewer().refresh(); >+ } >+ }); >+ } >+ } >+ } >+ >+ public JDIViewerFilter(IDebugView view) { >+ fView = view; >+ getPreferenceStore().addPropertyChangeListener(fListener); >+ } >+ >+ public void dispose() { >+ getPreferenceStore().removePropertyChangeListener(fListener); >+ } >+ >+ protected StructuredViewer getStructuredViewer() { >+ Viewer viewer = fView.getViewer(); >+ if (viewer instanceof StructuredViewer) { >+ return (StructuredViewer)viewer; >+ } >+ return null; >+ } >+ >+ protected IDebugView getView() { >+ return fView; >+ } >+ >+ /** >+ * Returns the value of this filters preference (on/off) for the given >+ * view. >+ * >+ * @param part >+ * @return boolean >+ */ >+ protected boolean getPreferenceValue() { >+ String key = getCompositeKey(fView.getSite()); >+ IPreferenceStore store = getPreferenceStore(); >+ boolean value = false; >+ if (store.contains(key)) { >+ value = store.getBoolean(key); >+ } else { >+ value = store.getBoolean(getPreferenceKey()); >+ } >+ return value; >+ } >+ } >+ > 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()); >- run(fAction); >- getPreferenceStore().addPropertyChangeListener(fListener); >- } >- >- /* (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() { >- getPreferenceStore().removePropertyChangeListener(fListener); >- } >- >- /* (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); >- } else { >- // only refresh is removing - adding will refresh automatically >- viewer.refresh(); >- } >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ IWorkbenchPart part = HandlerUtil.getActivePart(event); > IPreferenceStore store = getPreferenceStore(); >- String key = getView().getSite().getId() + "." + getPreferenceKey(); //$NON-NLS-1$ >- store.setValue(key, action.isChecked()); >+ String key = getCompositeKey(part.getSite()); >+ boolean oldValue = store.getBoolean(key); >+ store.setValue(key, !oldValue); >+ >+ // Refresh other menu items using this command. >+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); >+ ICommandService commandService = (ICommandService) window.getService(ICommandService.class); >+ commandService.refreshElements(event.getCommand().getId(), null); >+ >+ return null; > } > >- /* (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) { >- } >+ public void updateElement(UIElement element, Map parameters) { >+ IWorkbenchLocationService wls = (IWorkbenchLocationService) element >+ .getServiceLocator() >+ .getService(IWorkbenchLocationService.class); >+ >+ /*IWorkbenchPartSite partSite = (IWorkbenchPartSite) >+ element.getServiceLocator().getService(IWorkbenchPartSite.class);*/ >+ IWorkbenchPartSite partSite = wls.getPartSite(); >+ if (partSite != null) { >+ String key = getCompositeKey(partSite); >+ boolean value = getPreferenceStore().getBoolean(key); >+ element.setChecked(value); >+ } >+ } > > protected IPreferenceStore getPreferenceStore() { > return JDIDebugUIPlugin.getDefault().getPreferenceStore(); > } >- >- /** >- * Returns the value of this filters preference (on/off) for the given >- * view. >- * >- * @param part >- * @return boolean >- */ >- protected boolean getPreferenceValue() { >- String key = getCompositeKey(); >- IPreferenceStore store = getPreferenceStore(); >- boolean value = false; >- if (store.contains(key)) { >- value = store.getBoolean(key); >- } else { >- value = store.getBoolean(getPreferenceKey()); >- } >- return value; >- } >- >+ > /** > * Returns the key for this action's preference >- * >+ * getView() > * @return String > */ > protected abstract String getPreferenceKey(); >- >- /** >- * Returns the key used by this action to store its preference value/setting. >- * Based on a base key (suffix) and part id (prefix). >- * >- * @return preference store key >- */ >- protected String getCompositeKey() { >- String baseKey = getPreferenceKey(); >- String viewKey = getView().getSite().getId(); >- return viewKey + "." + baseKey; //$NON-NLS-1$ >- } >- >- 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 selected/checked. >- * >- * @return whether this action is selected/checked >- */ >- protected boolean getValue() { >- return fAction.isChecked(); >- } >+ /** >+ * Returns the key used by this action to store its preference value/setting. >+ * Based on a base key (suffix) and part id (prefix). >+ * >+ * @return preference store key >+ */ >+ protected String getCompositeKey(IWorkbenchPartSite site) { >+ String baseKey = getPreferenceKey(); >+ String viewKey = site.getId(); >+ return viewKey + "." + baseKey; //$NON-NLS-1$ >+ } >+ >+ > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowConstantsAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowConstantsAction.java,v >retrieving revision 1.6 >diff -u -r1.6 ShowConstantsAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowConstantsAction.java 18 Dec 2007 21:33:36 -0000 1.6 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowConstantsAction.java 4 Sep 2008 15:54:02 -0000 >@@ -16,7 +16,7 @@ > /** > * Shows static final variables (constants) > */ >-public class ShowConstantsAction extends ToggleBooleanPreferenceAction { >+public class ShowConstantsAction extends ViewFilterAction { > > public ShowConstantsAction() { > super(); >@@ -28,12 +28,4 @@ > protected String getPreferenceKey() { > return IJDIPreferencesConstants.PREF_SHOW_CONSTANTS; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.debug.ui.actions.ToggleBooleanPreferenceAction#getViewKey() >- */ >- protected String getViewKey() { >- return getCompositeKey(); >- } >- > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowStaticVariablesAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowStaticVariablesAction.java,v >retrieving revision 1.6 >diff -u -r1.6 ShowStaticVariablesAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowStaticVariablesAction.java 18 Dec 2007 21:33:36 -0000 1.6 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowStaticVariablesAction.java 4 Sep 2008 15:54:02 -0000 >@@ -16,23 +16,12 @@ > /** > * Shows non-final static variables > */ >-public class ShowStaticVariablesAction extends ToggleBooleanPreferenceAction { >+public class ShowStaticVariablesAction extends ViewFilterAction { > >- public ShowStaticVariablesAction() { >- super(); >- } >- >- /* (non-Javadoc) >+ /* (non-Javadoc) > * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#getPreferenceKey() > */ > protected String getPreferenceKey() { > return IJDIPreferencesConstants.PREF_SHOW_STATIC_VARIABLES; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.debug.ui.actions.ToggleBooleanPreferenceAction#getViewKey() >- */ >- protected String getViewKey() { >- return getCompositeKey(); >- } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowQualifiedAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowQualifiedAction.java,v >retrieving revision 1.21 >diff -u -r1.21 ShowQualifiedAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowQualifiedAction.java 27 Apr 2007 18:24:48 -0000 1.21 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowQualifiedAction.java 4 Sep 2008 15:54:02 -0000 >@@ -11,16 +11,17 @@ > package org.eclipse.jdt.internal.debug.ui.actions; > > >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; > import org.eclipse.debug.ui.IDebugModelPresentation; > import org.eclipse.debug.ui.IDebugView; > import org.eclipse.jdt.debug.core.JDIDebugModel; > import org.eclipse.jdt.internal.debug.ui.IJDIPreferencesConstants; > import org.eclipse.jdt.internal.debug.ui.JDIModelPresentation; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.viewers.StructuredViewer; >-import org.eclipse.jface.viewers.Viewer; > import org.eclipse.swt.custom.BusyIndicator; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.handlers.HandlerUtil; > > /** > * An action delegate that toggles the state of its viewer to >@@ -35,35 +36,28 @@ > return IJDIPreferencesConstants.PREF_SHOW_QUALIFIED_NAMES; > } > >- /** >- * This method is not actually called - this action is not a filter. Instead >- * it sets an attribute on the viewer's model presentation. >- * >- * @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.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >- */ >- public void run(IAction action) { >- final StructuredViewer viewer = getStructuredViewer(); >- IDebugView view = (IDebugView)getView().getAdapter(IDebugView.class); >- if (view != null) { >- IDebugModelPresentation pres = view.getPresentation(JDIDebugModel.getPluginIdentifier()); >- if (pres != null) { >- pres.setAttribute(JDIModelPresentation.DISPLAY_QUALIFIED_NAMES, (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()); >- } >- }); >- } >- } >- } >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ super.execute(event); >+ >+ IWorkbenchPart part = HandlerUtil.getActivePart(event); >+ if (part != null) { >+ final IDebugView view = (IDebugView)part.getAdapter(IDebugView.class); >+ final StructuredViewer viewer = (StructuredViewer)view.getViewer(); >+ if (view != null) { >+ IDebugModelPresentation pres = view.getPresentation(JDIDebugModel.getPluginIdentifier()); >+ if (pres != null) { >+ boolean newValue = getPreferenceStore().getBoolean(getCompositeKey(view.getSite())); >+ pres.setAttribute(JDIModelPresentation.DISPLAY_QUALIFIED_NAMES, (newValue ? Boolean.TRUE : Boolean.FALSE)); >+ BusyIndicator.showWhile(viewer.getControl().getDisplay(), new Runnable() { >+ public void run() { >+ viewer.refresh(); >+ } >+ }); >+ } >+ } >+ } >+ >+ return null; >+ } >+ > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowMonitorThreadInformation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowMonitorThreadInformation.java,v >retrieving revision 1.6 >diff -u -r1.6 ShowMonitorThreadInformation.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowMonitorThreadInformation.java 18 Dec 2007 21:33:36 -0000 1.6 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowMonitorThreadInformation.java 4 Sep 2008 15:54:02 -0000 >@@ -15,7 +15,7 @@ > /** > * Toggle to display the thread and monitor information in the debug view. > */ >-public class ShowMonitorThreadInformation extends ToggleBooleanPreferenceAction { >+public class ShowMonitorThreadInformation extends ViewFilterAction { > > /* (non-Javadoc) > * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#getPreferenceKey() >@@ -23,11 +23,4 @@ > protected String getPreferenceKey() { > return IJavaDebugUIConstants.PREF_SHOW_MONITOR_THREAD_INFO; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#getCompositeKey() >- */ >- protected String getCompositeKey() { >- return getPreferenceKey(); >- } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ShowThreadGroups.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ShowThreadGroups.java,v >retrieving revision 1.3 >diff -u -r1.3 ShowThreadGroups.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ShowThreadGroups.java 18 Dec 2007 21:33:36 -0000 1.3 >+++ ui/org/eclipse/jdt/internal/debug/ui/actions/ShowThreadGroups.java 4 Sep 2008 15:54:02 -0000 >@@ -15,7 +15,7 @@ > /** > * Toggle to display the thread and monitor information in the debug view. > */ >-public class ShowThreadGroups extends ToggleBooleanPreferenceAction { >+public class ShowThreadGroups extends ViewFilterAction { > > /* (non-Javadoc) > * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#getPreferenceKey() >@@ -23,11 +23,4 @@ > protected String getPreferenceKey() { > return IJavaDebugUIConstants.PREF_SHOW_THREAD_GROUPS; > } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#getCompositeKey() >- */ >- protected String getCompositeKey() { >- return getPreferenceKey(); >- } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBooleanPreferenceAction.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBooleanPreferenceAction.java >diff -N ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBooleanPreferenceAction.java >--- ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBooleanPreferenceAction.java 18 Dec 2007 21:33:36 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,60 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006, 2007 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.jdt.internal.debug.ui.actions; >- >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.preference.IPreferenceStore; >-import org.eclipse.jface.viewers.StructuredViewer; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.swt.custom.BusyIndicator; >- >-/** >- * Toggle to display the thread and monitor information in the debug view. >- */ >-public abstract class ToggleBooleanPreferenceAction extends ViewFilterAction { >- >- /* (non-Javadoc) >- * This method is not actually called - this action is not a filter. Instead >- * it sets an preference. >- * >- * @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 false; >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction#run(org.eclipse.jface.action.IAction) >- */ >- public void run(IAction action) { >- final StructuredViewer viewer = getStructuredViewer(); >- BusyIndicator.showWhile(viewer.getControl().getDisplay(), new Runnable() { >- public void run() { >- // note, this uses the pref key, not the composite key - the prefs are global, not view specific. >- IPreferenceStore store = getPreferenceStore(); >- store.setValue(getViewKey(), getValue()); >- viewer.refresh(); >- } >- }); >- } >- >- /** >- * Returns a key to use in the preference store for this option. >- * By default the preference key is used, but actions may override. >- * >- * @return >- */ >- protected String getViewKey() { >- return getPreferenceKey(); >- } >- >- >-} >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/plugin.xml,v >retrieving revision 1.473 >diff -u -r1.473 plugin.xml >--- plugin.xml 16 Jul 2008 13:51:58 -0000 1.473 >+++ plugin.xml 4 Sep 2008 15:54:01 -0000 >@@ -389,8 +389,7 @@ > <actionSet > id="org.eclipse.jdt.debug.ui.JDTDebugActionSet"> > </actionSet> >- </perspectiveExtension> >- <perspectiveExtension >+ </perspectiveExtension> <perspectiveExtension > targetID="org.eclipse.jdt.ui.JavaHierarchyPerspective"> > <actionSet > id="org.eclipse.debug.ui.breakpointActionSet"> >@@ -1768,215 +1767,288 @@ > </action> > </objectContribution> > </extension> >+ > <extension >- point="org.eclipse.ui.viewActions"> >- <viewContribution >- targetID="org.eclipse.debug.ui.VariableView" >- id="org.eclipse.jdt.debug.ui.VariableViewActions"> >- <action >- helpContextId="edit_variable_preferences" >- label="%variablePreferences.label" >- tooltip="%variablePreferences.tooltip" >- class="org.eclipse.jdt.internal.debug.ui.variables.VariableOptionsAction" >- menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart" >- id="org.eclipse.jdt.debug.ui.variableViewActions.Preferences"/> >- <action >- class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllReferencesInViewActionDelegate" >- helpContextId="show_references_action_context" >- icon="icons/full/elcl16/all_references.gif" >- id="org.eclipse.jdt.debug.ui.variablesViewActions.AllReferencesInView" >- label="%allReferencesInView.label" >- menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart" >- style="toggle" >- tooltip="%allReferencesInView.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.variableViewActions.ShowNullEntries" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowNullArrayEntriesAction" >- helpContextId="show_null_entries_action_context" >- label="%showNullEntriesAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart" >- tooltip="%showNullEntriesAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.variableViewActions.ShowQualified" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowQualifiedAction" >- icon="$nl$/icons/full/obj16/package_obj.gif" >- helpContextId="show_qualified_action_context" >- label="%showQualifiedAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart" >- tooltip="%showQualifiedAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.variableViewActions.ShowStatic" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowStaticVariablesAction" >- icon="$nl$/icons/full/elcl16/static_co.gif" >- helpContextId="show_static_action_context" >- label="%showStaticAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart" >- tooltip="%showStaticAction.tooltip"> >- </action> >- <action >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowConstantsAction" >- helpContextId="show_constants_action_context" >- icon="$nl$/icons/full/elcl16/constant_co.gif" >- id="org.eclipse.jdt.debug.ui.variableViewActions.ShowConstants" >- label="%showConstantsAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu/javaPart" >- style="toggle" >- tooltip="%showConstantsAction.tooltip"> >- </action> >+ point="org.eclipse.ui.commands"> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.variables.VariableOptionsAction" >+ helpContextId="show_references_action_context" >+ id="org.eclipse.jdt.debug.ui.variableViewActions.Preferences" >+ name="%variablePreferences.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.heapwalking.AllReferencesInViewActionDelegate" >+ helpContextId="edit_variable_preferences" >+ id="org.eclipse.jdt.debug.ui.variablesViewActions.AllReferencesInView" >+ name="%allReferencesInView.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowNullArrayEntriesAction" >+ id="org.eclipse.jdt.debug.ui.variableViewActions.ShowNullEntries" >+ helpContextId="show_null_entries_action_context" >+ name="%showNullEntriesAction.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowQualifiedAction" >+ id="org.eclipse.jdt.debug.ui.variableViewActions.ShowQualified" >+ helpContextId="show_qualified_action_context" >+ name="%showQualifiedAction.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowStaticVariablesAction" >+ id="org.eclipse.jdt.debug.ui.variableViewActions.ShowStatic" >+ helpContextId="show_static_action_context" >+ name="%showStaticAction.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowConstantsAction" >+ id="org.eclipse.jdt.debug.ui.variableViewActions.ShowConstants" >+ helpContextId="show_constants_action_context" >+ name="%showConstantsAction.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowSystemThreadsAction" >+ helpContextId="show_system_threads_action_context" >+ id="org.eclipse.jdt.debug.ui.launchViewActions.ShowSystemThreads" >+ name="%showSystemThreads.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowMonitorThreadInformation" >+ helpContextId="show_monitors_action_context" >+ id="org.eclipse.jdt.debug.ui.launchViewActions.ShowMonitorThreadInfo" >+ name="%showMonitorThreadInfo.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.actions.ShowThreadGroups" >+ helpContextId="show_thread_groups_action_context" >+ id="org.eclipse.jdt.debug.ui.launchViewActions.ShowThreadGroups" >+ name="%showThreadGroupsAction.label"> >+ </command> >+ <command >+ defaultHandler="org.eclipse.jdt.internal.debug.ui.breakpoints.AddExceptionAction" >+ helpContextId="add_exception_action_context" >+ id="org.eclipse.jdt.debug.ui.actions.AddException" >+ name="%exceptionAction.label"> >+ </command> >+ </extension> >+ >+ <extension >+ point="org.eclipse.core.expressions.definitions"> >+ <definition >+ id="org.eclipse.jdt.debug.ui.inJavaDebugActionSet"> >+ <with >+ variable="activeContexts"> >+ <iterate >+ operator="or"> >+ <equals >+ value="org.eclipse.jdt.debug.ui.JDTDebugActionSet"> >+ </equals> >+ </iterate> >+ </with> >+ </definition> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.menus"> >+ <menuContribution >+ locationURI="menu:org.eclipse.debug.ui.VariableView"> > <menu > id="org.eclipse.jdt.debug.ui.VariableView.javaSubmenu" >- label="%VariablesViewJavaSubmenu.label" >- path="javaActions"> >- <groupMarker name="org.eclipse.jdt.debug.ui.javaPart"/> >+ label="%VariablesViewJavaSubmenu.label"> >+ <separator >+ name="org.eclipse.jdt.debug.ui.javaPart" >+ visible="false"> >+ </separator> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.Preferences" >+ label="%variablePreferences.label" >+ style="push"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variablesViewActions.AllReferencesInView" >+ icon="icons/full/elcl16/all_references.gif" >+ label="%allReferencesInView.label" >+ style="toggle" >+ tooltip="%allReferencesInView.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowNullEntries" >+ label="%showNullEntriesAction.label" >+ style="toggle" >+ tooltip="%showNullEntriesAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowQualified" >+ label="%showQualifiedAction.label" >+ icon="$nl$/icons/full/obj16/package_obj.gif" >+ style="toggle" >+ tooltip="%showQualifiedAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowStatic" >+ label="%showStaticAction.label" >+ icon="$nl$/icons/full/elcl16/static_co.gif" >+ style="toggle" >+ tooltip="%showStaticAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowConstants" >+ label="%showConstantsAction.label" >+ icon="$nl$/icons/full/elcl16/constant_co.gif" >+ style="toggle" >+ tooltip="%showConstantsAction.tooltip"> >+ </command> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.jdt.debug.ui.inJavaDebugActionSet"> >+ </reference> >+ </visibleWhen> > </menu> >- </viewContribution> >- <viewContribution >- targetID="org.eclipse.debug.ui.ExpressionView" >- id="org.eclipse.jdt.debug.ui.ExpressionViewActions"> >- <action >- helpContextId="edit_variable_preferences" >- label="%variablePreferences.label" >- tooltip="%variablePreferences.tooltip" >- class="org.eclipse.jdt.internal.debug.ui.variables.VariableOptionsAction" >- menubarPath="org.eclipse.jdt.debug.ui.expSubmenu/javaPart" >- id="org.eclipse.jdt.debug.ui.variableViewActions.Preferences"/> >- <action >- class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllReferencesInViewActionDelegate" >- helpContextId="show_references_action_context" >- icon="icons/full/elcl16/all_references.gif" >- id="org.eclipse.jdt.debug.ui.expressionViewActions.AllReferencesInView" >- label="%allReferencesInView.label" >- menubarPath="org.eclipse.jdt.debug.ui.expSubmenu/javaPart" >- style="toggle" >- tooltip="%allReferencesInView.label"/> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.variableViewActions.ShowNullEntries" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowNullArrayEntriesAction" >- helpContextId="show_null_entries_action_context" >- label="%showNullEntriesAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.expSubmenu/javaPart" >- tooltip="%showNullEntriesAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.expressionViewActions.ShowQualified" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowQualifiedAction" >- icon="$nl$/icons/full/obj16/package_obj.gif" >- helpContextId="show_qualified_action_context" >- label="%showQualifiedAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.expSubmenu/javaPart" >- tooltip="%showQualifiedAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.expressionViewActions.ShowStatic" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowStaticVariablesAction" >- icon="$nl$/icons/full/elcl16/static_co.gif" >- helpContextId="show_static_action_context" >- label="%showStaticAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.expSubmenu/javaPart" >- tooltip="%showStaticAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.expressionViewActions.ShowConstants" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowConstantsAction" >- icon="$nl$/icons/full/elcl16/constant_co.gif" >- helpContextId="show_constants_action_context" >- label="%showConstantsAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.expSubmenu/javaPart" >- tooltip="%showConstantsAction.tooltip"> >- </action> >+ </menuContribution> >+ <menuContribution >+ locationURI="menu:org.eclipse.debug.ui.ExpressionView"> > <menu >- id="org.eclipse.jdt.debug.ui.expSubmenu" >- label="%ExpressionViewJavaSubmenu.label" >- path="javaActions"> >- <groupMarker name="org.eclipse.jdt.debug.ui.javaPart"/> >+ id="org.eclipse.jdt.debug.ui.ExpressionView.javaSubmenu" >+ label="%VariablesViewJavaSubmenu.label"> >+ <separator >+ name="org.eclipse.jdt.debug.ui.javaPart" >+ visible="false"> >+ </separator> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.Preferences" >+ label="%variablePreferences.label" >+ style="push"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variablesViewActions.AllReferencesInView" >+ icon="icons/full/elcl16/all_references.gif" >+ label="%allReferencesInView.label" >+ style="toggle" >+ tooltip="%allReferencesInView.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowNullEntries" >+ label="%showNullEntriesAction.label" >+ style="toggle" >+ tooltip="%showNullEntriesAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowQualified" >+ label="%showQualifiedAction.label" >+ icon="$nl$/icons/full/obj16/package_obj.gif" >+ style="toggle" >+ tooltip="%showQualifiedAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowStatic" >+ label="%showStaticAction.label" >+ icon="$nl$/icons/full/elcl16/static_co.gif" >+ style="toggle" >+ tooltip="%showStaticAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowConstants" >+ label="%showConstantsAction.label" >+ icon="$nl$/icons/full/elcl16/constant_co.gif" >+ style="toggle" >+ tooltip="%showConstantsAction.tooltip"> >+ </command> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.jdt.debug.ui.inJavaDebugActionSet"> >+ </reference> >+ </visibleWhen> > </menu> >- </viewContribution> >- <viewContribution >- targetID="org.eclipse.debug.ui.BreakpointView" >- id="org.eclipse.jdt.debug.ui.BreakpointViewActions"> >- <action >- id="org.eclipse.jdt.debug.ui.actions.AddException" >- toolbarPath="javaExceptions" >- hoverIcon="$nl$/icons/full/elcl16/exc_catch.gif" >- class="org.eclipse.jdt.internal.debug.ui.breakpoints.AddExceptionAction" >+ </menuContribution> >+ <menuContribution >+ locationURI="menu:org.eclipse.debug.ui.DebugView"> >+ <separator >+ name="additions" >+ visible="false"> >+ </separator> >+ <separator >+ name="java" >+ visible="true"> >+ </separator> >+ <menu >+ id="org.eclipse.jdt.debug.ui.LaunchView.javaSubmenu" >+ label="%LaunchViewJavaSubmenu.label"> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.launchViewActions.ShowThreadGroups" >+ icon="$nl$/icons/full/obj16/threadgroup_obj.gif" >+ label="%showThreadGroupsAction.label" >+ style="toggle" >+ tooltip="%showThreadGroupsAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowQualified" >+ icon="$nl$/icons/full/obj16/package_obj.gif" >+ label="%showQualifiedAction.label" >+ style="toggle" >+ tooltip="%showQualifiedAction.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.launchViewActions.ShowSystemThreads" >+ icon="$nl$/icons/full/obj16/thread_obj.gif" >+ label="%showSystemThreads.label" >+ style="toggle" >+ tooltip="%showSystemThreads.tooltip"> >+ </command> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.launchViewActions.ShowMonitorThreadInfo" >+ icon="$nl$/icons/full/obj16/thread_and_monitor_obj.gif" >+ label="%showMonitorThreadInfo.label" >+ style="toggle" >+ tooltip="%showMonitorThreadInfo.tooltip"> >+ </command> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.jdt.debug.ui.inJavaDebugActionSet"> >+ </reference> >+ </visibleWhen> >+ </menu> >+ </menuContribution> >+ <menuContribution >+ locationURI="toolbar:org.eclipse.debug.ui.BreakpointView"> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.actions.AddException" > disabledIcon="$nl$/icons/full/dlcl16/exc_catch.gif" >+ hoverIcon="$nl$/icons/full/elcl16/exc_catch.gif" > icon="$nl$/icons/full/elcl16/exc_catch.gif" >- helpContextId="add_exception_action_context" > label="%exceptionAction.label" >- tooltip="%exceptionAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.breakpointViewActions.ShowQualified" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowQualifiedAction" >+ style="push"> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.jdt.debug.ui.inJavaDebugActionSet"> >+ </reference> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="menu:org.eclipse.debug.ui.BreakpointView"> >+ <command >+ commandId="org.eclipse.jdt.debug.ui.variableViewActions.ShowQualified" > icon="$nl$/icons/full/obj16/package_obj.gif" >- helpContextId="show_qualified_action_context" > label="%showQualifiedAction.label" >- menubarPath="javaActions" >- tooltip="%showQualifiedAction.tooltip"> >- </action> >- </viewContribution> >- <viewContribution >- targetID="org.eclipse.debug.ui.DebugView" >- id="org.eclipse.jdt.debug.ui.LaunchViewActions"> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.launchViewActions.ShowThreadGroups" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowThreadGroups" >- icon="$nl$/icons/full/obj16/threadgroup_obj.gif" >- helpContextId="show_thread_groups_action_context" >- label="%showThreadGroupsAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.LaunchView.javaSubmenu/javaPart" >- tooltip="%showThreadGroupsAction.tooltip"> >- </action> >- <action > style="toggle" >- id="org.eclipse.jdt.debug.ui.launchViewActions.ShowQualified" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowQualifiedAction" >- icon="$nl$/icons/full/obj16/package_obj.gif" >- helpContextId="show_qualified_action_context" >- label="%showQualifiedAction.label" >- menubarPath="org.eclipse.jdt.debug.ui.LaunchView.javaSubmenu/javaPart" > tooltip="%showQualifiedAction.tooltip"> >- </action> >- <action >- style="toggle" >- id="org.eclipse.jdt.debug.ui.launchViewActions.ShowSystemThreads" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowSystemThreadsAction" >- icon="$nl$/icons/full/obj16/thread_obj.gif" >- helpContextId="show_system_threads_action_context" >- label="%showSystemThreads.label" >- menubarPath="org.eclipse.jdt.debug.ui.LaunchView.javaSubmenu/javaPart" >- tooltip="%showSystemThreads.tooltip"> >- </action> >- <action >- helpContextId="show_monitors_action_context" >- label="%showMonitorThreadInfo.label" >- icon="$nl$/icons/full/obj16/thread_and_monitor_obj.gif" >- tooltip="%showMonitorThreadInfo.tooltip" >- class="org.eclipse.jdt.internal.debug.ui.actions.ShowMonitorThreadInformation" >- style="toggle" >- menubarPath="org.eclipse.jdt.debug.ui.LaunchView.javaSubmenu/javaPart" >- id="org.eclipse.jdt.debug.ui.launchViewActions.ShowMonitorThreadInfo"/> >- <menu >- id="org.eclipse.jdt.debug.ui.LaunchView.javaSubmenu" >- label="%LaunchViewJavaSubmenu.label" >- path="javaActions"> >- <groupMarker >- name="org.eclipse.jdt.debug.ui.javaPart"> >- </groupMarker> >- </menu> >- </viewContribution> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.jdt.debug.ui.inJavaDebugActionSet"> >+ </reference> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.viewActions"> > <viewContribution > targetID="org.eclipse.jdt.debug.ui.DisplayView" > id="org.eclipse.jdt.debug.ui.DisplayViewActions"> >Index: ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesInViewActionDelegate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesInViewActionDelegate.java,v >retrieving revision 1.3 >diff -u -r1.3 AllReferencesInViewActionDelegate.java >--- ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesInViewActionDelegate.java 19 Apr 2007 15:47:07 -0000 1.3 >+++ ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesInViewActionDelegate.java 4 Sep 2008 15:54:02 -0000 >@@ -10,94 +10,57 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.debug.ui.heapwalking; > >+import java.util.Map; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; >-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; >-import org.eclipse.core.runtime.Preferences.PropertyChangeEvent; > import org.eclipse.debug.ui.IDebugView; > import org.eclipse.jdt.debug.core.IJavaStackFrame; > import org.eclipse.jdt.internal.debug.core.HeapWalkingManager; >-import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin; > import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.swt.widgets.Event; >-import org.eclipse.ui.IActionDelegate2; >-import org.eclipse.ui.IViewActionDelegate; >-import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.commands.ICommandService; >+import org.eclipse.ui.commands.IElementUpdater; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.ui.menus.UIElement; > > /** > * Action delegate that turns on/off references being displayed as variables in the view. > * > * @since 3.3 > */ >-public class AllReferencesInViewActionDelegate implements IPropertyChangeListener, IActionDelegate2, IViewActionDelegate { >- >- private IAction fAction; >- private IDebugView fView; >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >- */ >- public void run(IAction action) { >- HeapWalkingManager.getDefault().setShowReferenceInVarView(action.isChecked()); >- // If the current target doesn't support instance retrieval, warn the user that turning the option on will not do anything. >- if (action.isChecked() && fView.getViewer() != null){ >- if (fView.getViewer().getInput() instanceof IJavaStackFrame){ >- if (!HeapWalkingManager.supportsHeapWalking(fView.getViewer().getInput())){ >- JDIDebugUIPlugin.statusDialog(Messages.AllReferencesInViewActionDelegate_0,new Status(IStatus.WARNING,JDIDebugUIPlugin.getUniqueIdentifier(),Messages.AllReferencesInViewActionDelegate_1)); >- } >- } >- } >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) >- */ >- public void init(IAction action) { >- fAction = action; >- action.setChecked(HeapWalkingManager.getDefault().isShowReferenceInVarView()); >- JDIDebugPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(this); >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) >- */ >- public void init(IViewPart view) { >- if (view instanceof IDebugView){ >- fView = (IDebugView)view; >- } >- } >- >- /* (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) { >- } >- >- /* (non-Javadoc) >- * @see org.eclipse.ui.IActionDelegate2#dispose() >- */ >- public void dispose() { >- JDIDebugPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(this); >- } >- >- /* (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.core.runtime.Preferences$IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) >- */ >- public void propertyChange(PropertyChangeEvent event) { >- if (JDIDebugPlugin.PREF_SHOW_REFERENCES_IN_VAR_VIEW.equals(event.getProperty()) || JDIDebugPlugin.PREF_ALL_REFERENCES_MAX_COUNT.equals(event.getProperty())){ >- if (fAction != null){ >- fAction.setChecked(HeapWalkingManager.getDefault().isShowReferenceInVarView()); >- fView.getViewer().refresh(); >- } >- } >- } >+public class AllReferencesInViewActionDelegate extends AbstractHandler implements IElementUpdater { >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ boolean newValue = !HeapWalkingManager.getDefault().isShowReferenceInVarView(); >+ HeapWalkingManager.getDefault().setShowReferenceInVarView(newValue); >+ >+ // Refresh other menu items using this command. >+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); >+ ICommandService commandService = (ICommandService) window.getService(ICommandService.class); >+ commandService.refreshElements(event.getCommand().getId(), null); >+ >+ >+ // If the current target doesn't support instance retrieval, warn the user that turning the option on will not do anything. >+ if (newValue) { >+ IWorkbenchPart part = HandlerUtil.getActivePart(event); >+ if (part instanceof IDebugView) { >+ IDebugView view = (IDebugView)part; >+ if (view.getViewer().getInput() instanceof IJavaStackFrame) { >+ if (!HeapWalkingManager.supportsHeapWalking(view.getViewer().getInput())){ >+ JDIDebugUIPlugin.statusDialog(Messages.AllReferencesInViewActionDelegate_0,new Status(IStatus.WARNING,JDIDebugUIPlugin.getUniqueIdentifier(),Messages.AllReferencesInViewActionDelegate_1)); >+ } >+ } >+ } >+ } >+ >+ return null; >+ } >+ >+ public void updateElement(UIElement element, Map parameters) { >+ element.setChecked(HeapWalkingManager.getDefault().isShowReferenceInVarView()); >+ } > } >Index: ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesHandler.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesHandler.java >diff -N ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllReferencesHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Wind River Systems and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Wind River Systems - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.debug.ui.heapwalking; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+/** >+ * >+ */ >+public class AllReferencesHandler extends AbstractHandler { >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ HandlerUtil.getActiveContexts(event); >+ // TODO Auto-generated method stub >+ return null; >+ } >+} >Index: ui/org/eclipse/jdt/internal/debug/ui/ViewFilterManager.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/debug/ui/ViewFilterManager.java >diff -N ui/org/eclipse/jdt/internal/debug/ui/ViewFilterManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/debug/ui/ViewFilterManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,190 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 Wind River Systems and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Wind River Systems - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.debug.ui; >+ >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.ui.IDebugUIConstants; >+import org.eclipse.debug.ui.IDebugView; >+import org.eclipse.jdt.internal.debug.ui.actions.ShowNullArrayEntriesAction; >+import org.eclipse.jdt.internal.debug.ui.actions.ShowSystemThreadsAction; >+import org.eclipse.jdt.internal.debug.ui.actions.ViewFilterAction.JDIViewerFilter; >+import org.eclipse.jface.viewers.StructuredViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; >+import org.eclipse.ui.IPageListener; >+import org.eclipse.ui.IPartListener2; >+import org.eclipse.ui.IViewReference; >+import org.eclipse.ui.IWindowListener; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.IWorkbenchPartReference; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.progress.UIJob; >+ >+/** >+ * Manager that installs viewer filters for java elements in debugger views. >+ */ >+public class ViewFilterManager implements IWindowListener, IPageListener, IPartListener2 { >+ >+ private HashMap fFilters = new HashMap(2); >+ >+ public ViewFilterManager() { >+ final IWorkbench workbench = PlatformUI.getWorkbench(); >+ new UIJob(workbench.getDisplay(), "Initialize JDI view filters") { //$NON-NLS-1$ >+ { >+ setSystem(true); >+ } >+ >+ public IStatus runInUIThread(IProgressMonitor monitor) { >+ IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows(); >+ for (int i = 0; i < workbenchWindows.length; i++) { >+ IWorkbenchWindow window = workbenchWindows[i]; >+ windowOpened(window); >+ IWorkbenchPage[] pages = window.getPages(); >+ for (int j = 0; j < pages.length; j++) { >+ pageOpened(pages[j]); >+ IViewReference[] viewRefs = pages[j].getViewReferences(); >+ for (int k = 0; k < viewRefs.length; k++) { >+ partOpened(viewRefs[k]); >+ } >+ } >+ } >+ workbench.addWindowListener(ViewFilterManager.this); >+ >+ return Status.OK_STATUS; >+ } >+ }.schedule(); >+ } >+ >+ public void dispose() { >+ final IWorkbench workbench = PlatformUI.getWorkbench(); >+ new UIJob(workbench.getDisplay(), "Initialize JDI view filters") { //$NON-NLS-1$ >+ { >+ setSystem(true); >+ } >+ >+ public IStatus runInUIThread(IProgressMonitor monitor) { >+ IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows(); >+ for (int i = 0; i < workbenchWindows.length; i++) { >+ IWorkbenchWindow window = workbenchWindows[i]; >+ IWorkbenchPage[] pages = window.getPages(); >+ for (int j = 0; j < pages.length; j++) { >+ pageClosed(pages[j]); >+ IViewReference[] viewRefs = pages[j].getViewReferences(); >+ for (int k = 0; k < viewRefs.length; k++) { >+ partClosed(viewRefs[i]); >+ } >+ } >+ windowClosed(window); >+ } >+ workbench.removeWindowListener(ViewFilterManager.this); >+ >+ return Status.OK_STATUS; >+ } >+ }.schedule(); >+ } >+ >+ public void windowOpened(IWorkbenchWindow window) { >+ window.addPageListener(this); >+ } >+ >+ public void windowClosed(IWorkbenchWindow window) { >+ window.removePageListener(this); >+ } >+ >+ public void windowActivated(IWorkbenchWindow window) { >+ } >+ >+ public void windowDeactivated(IWorkbenchWindow window) { >+ } >+ >+ public void pageOpened(IWorkbenchPage page) { >+ page.addPartListener(this); >+ } >+ >+ public void pageClosed(IWorkbenchPage page) { >+ page.removePartListener(this); >+ } >+ >+ public void pageActivated(IWorkbenchPage page) { >+ } >+ >+ public void partOpened(IWorkbenchPartReference partRef) { >+ IWorkbenchPart part = partRef.getPart(false); >+ if (part instanceof IDebugView) { >+ addViewFilters( (IDebugView)part ); >+ } >+ } >+ >+ public void partClosed(IWorkbenchPartReference partRef) { >+ List filtersPerSite = (List)fFilters.remove(partRef); >+ if (filtersPerSite != null) { >+ for (Iterator itr = filtersPerSite.iterator(); itr.hasNext();) { >+ ((JDIViewerFilter)itr.next()).dispose(); >+ } >+ } >+ } >+ >+ public void partActivated(IWorkbenchPartReference partRef) { >+ } >+ >+ public void partBroughtToTop(IWorkbenchPartReference partRef) { >+ } >+ >+ public void partDeactivated(IWorkbenchPartReference partRef) { >+ } >+ >+ public void partHidden(IWorkbenchPartReference partRef) { >+ } >+ >+ public void partInputChanged(IWorkbenchPartReference partRef) { >+ } >+ >+ public void partVisible(IWorkbenchPartReference partRef) { >+ } >+ >+ private void addViewFilters(IDebugView view) { >+ if ( IDebugUIConstants.ID_DEBUG_VIEW.equals(view.getSite().getId()) ) { >+ addFilter(view, ShowSystemThreadsAction.getFilter(view)); >+ } else if ( IDebugUIConstants.ID_VARIABLE_VIEW.equals(view.getSite().getId()) ) { >+ addFilter(view, ShowNullArrayEntriesAction.getFilter(view)); >+ } else if ( IDebugUIConstants.ID_EXPRESSION_VIEW.equals(view.getSite().getId()) ) { >+ addFilter(view, ShowNullArrayEntriesAction.getFilter(view)); >+ } else if ( IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(view.getSite().getId()) ) { >+ } >+ } >+ >+ private void addFilter(IDebugView view, ViewerFilter filter) { >+ IWorkbenchPartReference viewRef = view.getSite().getPage().getReference(view); >+ >+ Viewer viewer = view.getViewer(); >+ if (viewer instanceof StructuredViewer) { >+ StructuredViewer structViewer = null; >+ structViewer = (StructuredViewer)viewer; >+ List filtersPerSite = (List)fFilters.get(viewRef); >+ if (filtersPerSite == null) { >+ filtersPerSite = new ArrayList(1); >+ fFilters.put(viewRef, filtersPerSite); >+ } >+ filtersPerSite.add(filter); >+ structViewer.addFilter(filter); >+ } >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 246243
: 111683