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 145005 Details for
Bug 284363
Move DebugCommandAction to an API package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch with refactored commands.
20090818_286310.patch (text/plain), 18.60 KB, created by
Pawel Piech
on 2009-08-19 13:42:37 EDT
(
hide
)
Description:
Patch with refactored commands.
Filename:
MIME Type:
Creator:
Pawel Piech
Created:
2009-08-19 13:42:37 EDT
Size:
18.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.debug.ui >Index: ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java,v >retrieving revision 1.9 >diff -u -r1.9 ElementLabelProvider.java >--- ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java 17 Apr 2008 16:21:11 -0000 1.9 >+++ ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java 18 Aug 2009 16:07:07 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Patrick Chuong (Texas Instruments) - added support for checkbox (Bug 286310) > *******************************************************************************/ > package org.eclipse.debug.internal.ui.model.elements; > >@@ -19,6 +20,7 @@ > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.ISchedulingRule; > import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; > import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; >@@ -214,6 +216,12 @@ > update.setBackground(getBackground(elementPath, presentationContext, columnId), i); > update.setForeground(getForeground(elementPath, presentationContext, columnId), i); > update.setFontData(getFontData(elementPath, presentationContext, columnId), i); >+ if (update instanceof ICheckUpdate && >+ Boolean.TRUE.equals(presentationContext.getProperty(ICheckUpdate.PROP_CHECK))) >+ { >+ ((ICheckUpdate) update).setChecked( >+ getChecked(elementPath, presentationContext), getGrayed(elementPath, presentationContext)); >+ } > } > } > >@@ -270,6 +278,36 @@ > */ > protected abstract String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException; > >+ /** >+ * Returns the checked state for the given path. >+ * >+ * @param path Path of the element to retrieve the grayed state for. >+ * @param presentationContext Presentation context where the element is >+ * displayed. >+ * @return <code>true<code> if the element check box should be checked >+ * @throws CoreException >+ * >+ * @since 3.6 >+ */ >+ public boolean getChecked(TreePath path, IPresentationContext presentationContext) throws CoreException { >+ return false; >+ } >+ >+ /** >+ * Returns the grayed state for the given path. >+ * >+ * @param path Path of the element to retrieve the grayed state for. >+ * @param presentationContext Presentation context where the element is >+ * displayed. >+ * @return <code>true<code> if the element check box should be grayed >+ * @throws CoreException >+ * >+ * @since 3.6 >+ */ >+ public boolean getGrayed(TreePath path, IPresentationContext presentationContext) throws CoreException { >+ return false; >+ } >+ > /* (non-Javadoc) > * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider#update(org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate[]) > */ >Index: ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProviderTarget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProviderTarget.java,v >retrieving revision 1.1 >diff -u -r1.1 ITreeModelLabelProviderTarget.java >--- ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProviderTarget.java 23 Jan 2009 23:29:07 -0000 1.1 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelLabelProviderTarget.java 18 Aug 2009 16:07:08 -0000 >@@ -16,7 +16,7 @@ > import org.eclipse.swt.graphics.RGB; > > /** >- * This interface must be implemented by the viewer which uses the >+ * This interface must be implemented by the viewer which uses the > * {@link TreeModelLabelProvider} label provider. It allows the label > * provider to update the viewer with information retrieved from the > * element-based label providers. >Index: ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java,v >retrieving revision 1.7 >diff -u -r1.7 ViewerAdapterService.java >--- ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java 9 Mar 2009 16:44:05 -0000 1.7 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/ViewerAdapterService.java 18 Aug 2009 16:07:09 -0000 >@@ -8,11 +8,13 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Wind River Systems - Pawel Piech: Bug 213244 - VariableAdapterService should also call IAdaptable.getAdapter() for adaptables that implement this method directly. >+ * Patrick Chuong (Texas Instruments) - added support for checkbox (Bug 286310) > *******************************************************************************/ > package org.eclipse.debug.internal.ui.viewers.model; > > import org.eclipse.debug.core.DebugPlugin; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; >+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCheckReceiver; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; >@@ -133,7 +135,19 @@ > public static IViewerInputProvider getInputProvider(Object element) { > return (IViewerInputProvider)getAdapter(element, IViewerInputProvider.class); > } >- >+ >+ /** >+ * Returns the check receiver for the given element or <code>null</code> if none. >+ * >+ * @param element element to retrieve adapter for >+ * @return check receiver or <code>null</code> >+ * >+ * @since 3.6 >+ */ >+ public static IElementCheckReceiver getElementCheckListener(Object element) { >+ return (IElementCheckReceiver)getAdapter(element, IElementCheckReceiver.class); >+ } >+ > /** > * Returns an adapter of the specified type for the given object or <code>null</code> > * if none. >Index: ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java,v >retrieving revision 1.30 >diff -u -r1.30 InternalTreeModelViewer.java >--- ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java 20 Apr 2009 18:21:15 -0000 1.30 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java 18 Aug 2009 16:07:09 -0000 >@@ -8,6 +8,7 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Pawel Piech (Wind River) - added support for a virtual tree model viewer (Bug 242489) >+ * Patrick Chuong (Texas Instruments) - added support for checkbox (Bug 286310) > *******************************************************************************/ > package org.eclipse.debug.internal.ui.viewers.model; > >@@ -24,9 +25,11 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; > import org.eclipse.debug.internal.core.commands.Request; >+import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory; >+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementCheckReceiver; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementEditor; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider; >@@ -55,6 +58,7 @@ > import org.eclipse.swt.events.DisposeEvent; > import org.eclipse.swt.events.PaintEvent; > import org.eclipse.swt.events.PaintListener; >+import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Font; > import org.eclipse.swt.graphics.FontData; >@@ -78,7 +82,7 @@ > * @since 3.3 > */ > public class InternalTreeModelViewer extends TreeViewer >- implements ITreeModelViewer, ITreeModelContentProviderTarget, ITreeModelLabelProviderTarget >+ implements ITreeModelViewer, ITreeModelContentProviderTarget, ITreeModelLabelProviderTarget, ITreeModelCheckProviderTarget > { > > private IPresentationContext fContext; >@@ -1015,6 +1019,9 @@ > if (fIsPopup) { > ((ITreeModelContentProvider)getContentProvider()).setSuppressModelControlDeltas(true); > } >+ if ((style & SWT.CHECK) != 0) { >+ context.setProperty(ICheckUpdate.PROP_CHECK, Boolean.TRUE); >+ } > } > > /** >@@ -2248,4 +2255,41 @@ > public void updateViewer(IModelDelta delta) { > ((ITreeModelContentProvider)getContentProvider()).updateModel(delta); > } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.debug.internal.ui.viewers.model.ITreeModelCheckProvider#setElementChecked(org.eclipse.jface.viewers.TreePath, boolean, boolean) >+ */ >+ public void setElementChecked(TreePath path, boolean checked, boolean grayed) { >+ Widget widget = findItem(path); >+ >+ if (widget != null && widget instanceof TreeItem && !widget.isDisposed()) { >+ TreeItem item = (TreeItem)widget; >+ >+ item.setChecked(checked); >+ item.setGrayed(grayed); >+ } >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.jface.viewers.StructuredViewer#handleSelect(org.eclipse.swt.events.SelectionEvent) >+ */ >+ protected void handleSelect(SelectionEvent event) { >+ if (event.detail == SWT.CHECK) { >+ TreeItem item = (TreeItem) event.item; >+ super.handleSelect(event); >+ >+ Object element = item.getData(); >+ if (element != null) { >+ IElementCheckReceiver listener = ViewerAdapterService.getElementCheckListener(element); >+ if (listener != null) { >+ TreePath path = getTreePathFromItem(item); >+ listener.setChecked(getPresentationContext(), getInput(), path, item.getChecked()); >+ } >+ } >+ } else { >+ super.handleSelect(event); >+ } >+ } > } >Index: ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java,v >retrieving revision 1.20 >diff -u -r1.20 LabelUpdate.java >--- ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java 23 Jan 2009 23:29:07 -0000 1.20 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java 18 Aug 2009 16:07:09 -0000 >@@ -8,10 +8,12 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Pawel Piech (Wind River) - added support for a virtual tree model viewer (Bug 242489) >+ * Patrick Chuong (Texas Instruments) - added support for checkbox (Bug 286310) > *******************************************************************************/ > package org.eclipse.debug.internal.ui.viewers.model; > > import org.eclipse.debug.internal.core.commands.Request; >+import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; > import org.eclipse.jface.resource.ImageDescriptor; >@@ -22,7 +24,7 @@ > /** > * @since 3.3 > */ >-class LabelUpdate extends Request implements ILabelUpdate { >+class LabelUpdate extends Request implements ILabelUpdate, ICheckUpdate { > > private TreePath fElementPath; > private String[] fColumnIds; >@@ -36,6 +38,8 @@ > private int fNumColumns; > private IPresentationContext fContext; > private Object fViewerInput; >+ private boolean fChecked; >+ private boolean fGrayed; > > /** > * @param viewerInput input at the time the request was made >@@ -151,6 +155,9 @@ > */ > public void update() { > fTreeViewer.setElementData(fElementPath, fNumColumns, fLabels, fImageDescriptors, fFontDatas, fForegrounds, fBackgrounds); >+ if (fTreeViewer instanceof ITreeModelCheckProviderTarget) >+ ((ITreeModelCheckProviderTarget) fTreeViewer).setElementChecked(fElementPath, fChecked, fGrayed); >+ > fProvider.updateComplete(this); > } > >@@ -174,4 +181,13 @@ > public Object getViewerInput() { > return fViewerInput; > } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckable#setChecked(boolean, boolean) >+ */ >+ public void setChecked(boolean checked, boolean grayed) { >+ fChecked = checked; >+ fGrayed = grayed; >+ } > } >Index: ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java >diff -N ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/***************************************************************** >+ * Copyright (c) 2009 Texas Instruments 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: >+ * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) >+ *****************************************************************/ >+package org.eclipse.debug.internal.ui.viewers.model; >+ >+import org.eclipse.jface.viewers.TreePath; >+ >+/** >+ * This interface can be implemented by the viewer which uses the >+ * {@link TreeModelLabelProvider} label provider and supports the >+ * {@link org.eclipse.swt.SWT.CHECK} style. It allows the label provider to >+ * update the viewer with check-box information retrieved from the >+ * element-based label providers. >+ * >+ * @since 3.6 >+ */ >+public interface ITreeModelCheckProviderTarget extends ITreeModelLabelProviderTarget { >+ >+ /** >+ * Sets the element check state data. >+ * >+ * @param path >+ * @param checked >+ * @param grayed >+ */ >+ public void setElementChecked(TreePath path, boolean checked, boolean grayed); >+} >Index: ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java >diff -N ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/***************************************************************** >+ * Copyright (c) 2009 Texas Instruments 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: >+ * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) >+ *****************************************************************/ >+package org.eclipse.debug.internal.ui.viewers.model.provisional; >+ >+/** >+ * Label update which allows the label provide to set the checked element state. >+ * The label provider can use the presentation context to determine whether the >+ * viewer is showing item check boxes. >+ * >+ * @since 3.6 >+ */ >+public interface ICheckUpdate extends ILabelUpdate { >+ >+ /** >+ * Property of the presentation context which indicates that the viewer >+ * has the check box style. >+ */ >+ public static final String PROP_CHECK = "org.eclipse.debug.ui.check"; //$NON-NLS-1$ >+ >+ /** >+ * Sets the check state of the tree node. >+ * >+ * @param checked >+ * @param grayed >+ */ >+ public void setChecked(boolean checked, boolean grayed); >+ >+} >Index: ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementCheckReceiver.java >=================================================================== >RCS file: ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementCheckReceiver.java >diff -N ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementCheckReceiver.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IElementCheckReceiver.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/***************************************************************** >+ * Copyright (c) 2009 Texas Instruments 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: >+ * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 286310) >+ *****************************************************************/ >+package org.eclipse.debug.internal.ui.viewers.model.provisional; >+ >+import org.eclipse.jface.viewers.TreePath; >+ >+ >+/** >+ * Receiver of checked events from a virtual viewer with check boxes. The >+ * receiver is retrieved for each element through the adapter mechanism. >+ * >+ * @since 3.6 >+ */ >+public interface IElementCheckReceiver { >+ >+ /** >+ * Notifies the receiver that the given element has had its >+ * checked state modified in the viewer. >+ * >+ * @param context Presentation context in which the element was updated. >+ * @param viewerInput The root element of the viewer where the check >+ * selection took place. >+ * @param path Path of the element that had its checked state changed >+ * @param checked The new checked state of the element >+ */ >+ public void setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked); >+ >+}
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 284363
:
145005
|
145060
|
145061
|
145200
|
146333
|
146696