Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.debug.examples.ui/plugin.xml21
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java39
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java13
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java13
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java34
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java8
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java8
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java10
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java45
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java59
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java1
17 files changed, 431 insertions, 17 deletions
diff --git a/org.eclipse.debug.examples.ui/plugin.xml b/org.eclipse.debug.examples.ui/plugin.xml
index 8a98ff28e..8129e2156 100644
--- a/org.eclipse.debug.examples.ui/plugin.xml
+++ b/org.eclipse.debug.examples.ui/plugin.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?> <!--
- Copyright (c) 2005, 2008 IBM Corporation and others.
+ Copyright (c) 2005, 2009 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
@@ -8,6 +8,7 @@
Contributors:
IBM Corporation - initial API and implementation
+ Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310)
-->
<plugin>
@@ -125,6 +126,12 @@
class="org.eclipse.debug.examples.ui.pda.views.DataStackView"
name="PDA Data Stack"
id="pda.dataStackView"/>
+ <view
+ class="org.eclipse.debug.examples.ui.pda.views.CheckboxView"
+ id="org.eclipse.debug.examples.ui.checkboxView"
+ name="Checkbox View"
+ restorable="true">
+ </view>
</extension>
<extension
@@ -275,7 +282,19 @@
<adapter
type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider">
</adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
+ </adapter>
</factory>
+ <factory
+ adaptableType="javax.sound.midi.Track"
+ class="org.eclipse.debug.examples.ui.midi.adapters.MidiAdapterFactory">
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
+ </adapter>
+ </factory>
+
+
</extension>
<extension
point="org.eclipse.debug.ui.detailPaneFactories">
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java
new file mode 100644
index 000000000..31d375ab8
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/CheckboxModelProxyFactory.java
@@ -0,0 +1,39 @@
+/*****************************************************************
+ * 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.examples.ui.midi.adapters;
+
+import javax.sound.midi.MidiEvent;
+import javax.sound.midi.Track;
+
+import org.eclipse.debug.examples.ui.pda.views.CheckboxView;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+
+public class CheckboxModelProxyFactory implements IModelProxyFactory {
+ private MidiEventModelProxy fMidiEventProxy = new MidiEventModelProxy();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory#createModelProxy(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ public IModelProxy createModelProxy(Object element, IPresentationContext context) {
+ if (CheckboxView.ID.equals(context.getId())) {
+ if (element instanceof Track) {
+ return new TrackModelProxy((Track) element);
+ } else if (element instanceof MidiEvent) {
+ return fMidiEventProxy;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java
index 26696b1c6..9ddbf24df 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310)
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
@@ -46,6 +47,8 @@ public class MidiAdapterFactory implements IAdapterFactory {
private static IElementMementoProvider fgMementoProvider = new ControlsMementoProvider();
private static IStepOverHandler fgStepOverHandler = new MidiStepOverHandler();
+
+ private static IModelProxyFactory fgCheckboxModelProxyFactory = new CheckboxModelProxyFactory();
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (IElementContentProvider.class.equals(adapterType)) {
@@ -81,9 +84,14 @@ public class MidiAdapterFactory implements IAdapterFactory {
return new ControlEditor();
}
}
+
if (IModelProxyFactory.class.equals(adapterType)) {
if (adaptableObject instanceof MidiLaunch) {
return fgSequencerModelProxyFactory;
+ } else if (adaptableObject instanceof Track) {
+ return fgCheckboxModelProxyFactory;
+ } else if (adaptableObject instanceof MidiEvent) {
+ return fgCheckboxModelProxyFactory;
}
}
if (IElementMementoProvider.class.equals(adapterType)) {
@@ -92,10 +100,11 @@ public class MidiAdapterFactory implements IAdapterFactory {
if (IStepOverHandler.class.equals(adapterType)) {
return fgStepOverHandler;
}
+
return null;
}
public Class[] getAdapterList() {
- return new Class[]{IElementContentProvider.class, IElementLabelProvider.class, IStepOverHandler.class};
+ return new Class[]{IElementContentProvider.class, IElementLabelProvider.class, IStepOverHandler.class,};
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java
index b357c67b7..6ea60ef96 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310)
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
@@ -57,6 +58,16 @@ public class MidiEventLabelProvider extends ElementLabelProvider {
return "";
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getChecked(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ public boolean getChecked(TreePath path, IPresentationContext presentationContext) throws CoreException {
+ Boolean result = (Boolean) MidiEventModelProxy.gChecked.get(path);
+ return result == null ? false : result.booleanValue();
+ }
+
/**
* Appends a byte to the buffer with 2 hex characters.
*
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java
new file mode 100644
index 000000000..b535c3d2d
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/MidiEventModelProxy.java
@@ -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.examples.ui.midi.adapters;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
+import org.eclipse.jface.viewers.TreePath;
+
+public class MidiEventModelProxy extends AbstractModelProxy implements ICheckboxModelProxy {
+ static Map gChecked = new HashMap();
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy#setChecked(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object, org.eclipse.jface.viewers.TreePath, boolean)
+ */
+ public boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
+ System.out.println("TrackCheckListener.setChecked() element = " + path.getLastSegment() + " checked = " + checked);
+ gChecked.put(path, Boolean.valueOf(checked));
+ return true;
+ }
+
+}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java
index c102fdc37..5a9fc55b1 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/SequencerColumnFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -7,9 +7,11 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310)
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
+import org.eclipse.debug.examples.ui.pda.views.CheckboxView;
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.IPresentationContext;
@@ -26,7 +28,7 @@ public class SequencerColumnFactory implements IColumnPresentationFactory {
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
*/
public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) {
return new SequencerColumnPresentation();
}
return null;
@@ -36,7 +38,7 @@ public class SequencerColumnFactory implements IColumnPresentationFactory {
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
*/
public String getColumnPresentationId(IPresentationContext context, Object element) {
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) {
return SequencerColumnPresentation.ID;
}
return null;
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java
index 0a5b5fb7e..66b9063e1 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackColumnFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -7,9 +7,11 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310)
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
+import org.eclipse.debug.examples.ui.pda.views.CheckboxView;
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.IPresentationContext;
@@ -26,7 +28,7 @@ public class TrackColumnFactory implements IColumnPresentationFactory {
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#createColumnPresentation(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
*/
public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) {
return new TrackColumnPresentation();
}
return null;
@@ -36,7 +38,7 @@ public class TrackColumnFactory implements IColumnPresentationFactory {
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentationFactory#getColumnPresentationId(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.Object)
*/
public String getColumnPresentationId(IPresentationContext context, Object element) {
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) {
return TrackColumnPresentation.ID;
}
return null;
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java
index 34c16a775..1606038d0 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 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
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Checkbox support for Flexible Hierachy view (Bug 286310)
*******************************************************************************/
package org.eclipse.debug.examples.ui.midi.adapters;
@@ -14,6 +15,7 @@ import javax.sound.midi.MidiEvent;
import javax.sound.midi.Track;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.examples.ui.pda.views.CheckboxView;
import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
@@ -32,7 +34,7 @@ public class TrackContentProvider extends ElementContentProvider {
*/
protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
Track track = (Track) element;
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId()) ) {
return track.size();
}
return 0;
@@ -42,7 +44,7 @@ public class TrackContentProvider extends ElementContentProvider {
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
*/
protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
- if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId())) {
+ if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(context.getId()) || CheckboxView.ID.equals(context.getId())) {
Track track = (Track) parent;
MidiEvent[] events= new MidiEvent[length];
for (int i = 0; i < length; i++) {
@@ -57,7 +59,7 @@ public class TrackContentProvider extends ElementContentProvider {
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String)
*/
protected boolean supportsContextId(String id) {
- return IDebugUIConstants.ID_VARIABLE_VIEW.equals(id);
+ return IDebugUIConstants.ID_VARIABLE_VIEW.equals(id) || CheckboxView.ID.equals(id);
}
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java
new file mode 100644
index 000000000..449c43c56
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/midi/adapters/TrackModelProxy.java
@@ -0,0 +1,45 @@
+/*****************************************************************
+ * 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.examples.ui.midi.adapters;
+
+import javax.sound.midi.Track;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckboxModelProxy;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.Viewer;
+
+public class TrackModelProxy extends AbstractModelProxy {
+ protected Track fTrack;
+
+ public TrackModelProxy(Track track) {
+ fTrack = track;
+ }
+
+ public void installed(Viewer viewer) {
+ super.installed(viewer);
+
+ ModelDelta delta = new ModelDelta(fTrack, IModelDelta.NO_CHANGE);
+ for (int i = 0; i < fTrack.size(); ++i) {
+ delta.addNode(fTrack.get(i), IModelDelta.INSTALL);
+ }
+
+ fireModelChanged(delta);
+ }
+
+ public synchronized void dispose() {
+ super.dispose();
+ MidiEventModelProxy.gChecked.clear();
+ }
+}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java
new file mode 100644
index 000000000..d5926f3b5
--- /dev/null
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/views/CheckboxView.java
@@ -0,0 +1,32 @@
+/*****************************************************************
+ * 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.examples.ui.pda.views;
+
+import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+public class CheckboxView extends VariablesView {
+ public static String ID = "CHECKBOX_VIEW_ID";
+
+ protected int getViewerStyle() {
+ return SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.CHECK;
+ }
+
+ protected String getHelpContextId() {
+ return ID;
+ }
+
+ protected String getPresentationContextId() {
+ return ID;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java
index 111b9bdc7..0c867bd64 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/ElementLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 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
@@ -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.IStatus;
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 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
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 @@ public abstract class ElementLabelProvider implements IElementLabelProvider {
*/
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
+ */
+ protected 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
+ */
+ protected 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[])
*/
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java
new file mode 100644
index 000000000..c56581396
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ITreeModelCheckProviderTarget.java
@@ -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);
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
index 10d404cad..449dff75f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java
@@ -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,6 +25,8 @@ import java.util.Map.Entry;
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.ICheckboxModelProxy;
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;
@@ -33,6 +36,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProv
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelSelectionPolicy;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
@@ -43,6 +47,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.IBasicPropertyConstants;
import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILazyTreePathContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
@@ -55,6 +60,7 @@ import org.eclipse.swt.events.ControlListener;
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 +84,7 @@ import org.eclipse.ui.IMemento;
* @since 3.3
*/
public class InternalTreeModelViewer extends TreeViewer
- implements ITreeModelViewer, ITreeModelContentProviderTarget, ITreeModelLabelProviderTarget
+ implements ITreeModelViewer, ITreeModelContentProviderTarget, ITreeModelLabelProviderTarget, ITreeModelCheckProviderTarget
{
private IPresentationContext fContext;
@@ -1015,6 +1021,9 @@ public class InternalTreeModelViewer extends TreeViewer
if (fIsPopup) {
((ITreeModelContentProvider)getContentProvider()).setSuppressModelControlDeltas(true);
}
+ if ((style & SWT.CHECK) != 0) {
+ context.setProperty(ICheckUpdate.PROP_CHECK, Boolean.TRUE);
+ }
}
/**
@@ -2248,4 +2257,52 @@ public class InternalTreeModelViewer extends TreeViewer
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) {
+ boolean checked = item.getChecked();
+
+ TreePath path = getTreePathFromItem(item);
+
+ boolean accepted = false;
+ IContentProvider contentProvider = getContentProvider();
+ if (contentProvider instanceof TreeModelContentProvider) {
+ IModelProxy elementProxy = ((TreeModelContentProvider) contentProvider).getElementProxy(path);
+ if (elementProxy instanceof ICheckboxModelProxy) {
+ accepted = ((ICheckboxModelProxy) elementProxy).setChecked(getPresentationContext(), getInput(), path, checked);
+ }
+ }
+
+ // if the listen rejects the change or there is not ICheckboxModelProxy, than revert the check state
+ if (!accepted)
+ item.setChecked(!checked);
+ }
+ } else {
+ super.handleSelect(event);
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
index 5be643c51..46d760aad 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/LabelUpdate.java
@@ -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 @@ import org.eclipse.swt.graphics.RGB;
/**
* @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 @@ class LabelUpdate extends Request implements ILabelUpdate {
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 @@ class LabelUpdate extends Request implements ILabelUpdate {
*/
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 @@ class LabelUpdate extends Request implements ILabelUpdate {
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;
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
new file mode 100644
index 000000000..91d90ef10
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckUpdate.java
@@ -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 provider 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);
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
new file mode 100644
index 000000000..71ac66958
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ICheckboxModelProxy.java
@@ -0,0 +1,37 @@
+/*****************************************************************
+ * 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;
+
+
+/**
+ * Optional extension to a model proxy for models that use a check box tree viewer. Provides
+ * notification for check state changes in the tree.
+ *
+ * @since 3.6
+ */
+public interface ICheckboxModelProxy extends IModelProxy {
+
+ /**
+ * 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
+ * @return false if the check state should not change
+ */
+ public boolean setChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked);
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
index 98c60b14d..65613521d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/IModelProxy.java
@@ -31,6 +31,7 @@ import org.eclipse.jface.viewers.Viewer;
* @see IModelDelta
* @see IModelProxyFactory
* @see IModelChangedListener
+ * @see ICheckboxModelProxy
* @since 3.2
*/
public interface IModelProxy {

Back to the top