Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2009-12-14 18:23:37 +0000
committerPawel Piech2009-12-14 18:23:37 +0000
commit062193b9adcd85293dee996d5200a625a060d0fe (patch)
tree936a2c21235a56d873317c8928c7c4adc995ac84 /org.eclipse.debug.ui
parent97c9b36b439160e36bd197e4c9ed29134da6c193 (diff)
downloadeclipse.platform.debug-062193b9adcd85293dee996d5200a625a060d0fe.tar.gz
eclipse.platform.debug-062193b9adcd85293dee996d5200a625a060d0fe.tar.xz
eclipse.platform.debug-062193b9adcd85293dee996d5200a625a060d0fe.zip
[Bug 238956] Improve usability of the breakpoints view
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/.options1
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.debug.ui/plugin.xml49
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java35
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java98
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java50
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java41
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SelectAllBreakpointsAction.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowTargetBreakpointsAction.java85
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java52
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java (renamed from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java)121
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java62
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java (renamed from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java)198
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AbstractBreakpointManagerInput.java45
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointManagerInput.java58
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultViewerInputProvider.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java64
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/AbstractBreakpointManagerContentProvider.java727
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java156
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContentProvider.java46
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java108
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerInputMementoProvider.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java94
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/InternalTreeModelViewer.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ModelContentProvider.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java78
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointProxy.java53
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java15
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java644
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java19
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java37
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java1280
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java186
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java33
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java160
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizerInputProvider.java34
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java6
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java57
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java21
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java6
71 files changed, 4003 insertions, 1307 deletions
diff --git a/org.eclipse.debug.ui/.options b/org.eclipse.debug.ui/.options
index 03fe0ac8c..6932029b6 100644
--- a/org.eclipse.debug.ui/.options
+++ b/org.eclipse.debug.ui/.options
@@ -2,6 +2,7 @@ org.eclipse.debug.ui/debug = false
org.eclipse.debug.ui/debug/viewers/model = false
org.eclipse.debug.ui/debug/viewers/viewer = false
org.eclipse.debug.ui/debug/viewers/deltas = false
+org.eclipse.debug.ui/debug/viewers/breakpointDeltas = false
org.eclipse.debug.ui/debug/viewers/contentProvider = false
org.eclipse.debug.ui/debug/viewers/updateSequence = false
org.eclipse.debug.ui/debug/contextlaunching = false
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index 97ec5f420..5f68343ed 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -13,6 +13,12 @@ Export-Package: org.eclipse.debug.internal.ui;x-internal:=true,
org.eclipse.debug.internal.ui.actions.expressions;x-internal:=true,
org.eclipse.debug.internal.ui.actions.variables;x-internal:=true,
org.eclipse.debug.internal.ui.actions.variables.details;x-internal:=true,
+ org.eclipse.debug.internal.ui.breakpoints.provisional;
+ x-friends:="org.eclipse.debug.examples.ui,
+ org.eclipse.jdt.debug.ui,
+ org.eclipse.cdt.dsf.ui,
+ org.eclipse.cdt.dsf.gdb.ui,
+ org.eclipse.debug.tests",
org.eclipse.debug.internal.ui.commands.actions;x-internal:=true,
org.eclipse.debug.internal.ui.contextlaunching;x-internal:=true,
org.eclipse.debug.internal.ui.contexts;x-internal:=true,
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index a862624b9..28522476b 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -8,6 +8,7 @@
Contributors:
IBM Corporation - initial API and implementation
+ Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
-->
<plugin>
@@ -1276,7 +1277,7 @@
id="org.eclipse.debug.ui.breakpointview.breakpointGroupActions">
<visibility>
<objectClass
- name="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer">
+ name="org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer">
</objectClass>
</visibility>
<action
@@ -2265,7 +2266,7 @@ M4 = Platform-specific fourth key
</factory>
<factory
class="org.eclipse.debug.internal.ui.DebugUIAdapterFactory"
- adaptableType="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer">
+ adaptableType="org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer">
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter2"/>
</factory>
@@ -2479,6 +2480,48 @@ M4 = Platform-specific fourth key
type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
</adapter>
</factory>
+ <factory
+ adaptableType="org.eclipse.debug.internal.ui.elements.adapters.DefaultBreakpointManagerInput"
+ class="org.eclipse.debug.internal.ui.views.launch.DebugElementAdapterFactory">
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.debug.core.model.IBreakpoint"
+ class="org.eclipse.debug.internal.ui.views.launch.DebugElementAdapterFactory">
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider">
+ </adapter>
+ </factory>
+ <factory
+ adaptableType="org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer"
+ class="org.eclipse.debug.internal.ui.views.launch.DebugElementAdapterFactory">
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementLabelProvider">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IElementMementoProvider">
+ </adapter>
+ <adapter
+ type="org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxyFactory">
+ </adapter>
+ </factory>
<factory
adaptableType="org.eclipse.debug.core.ILaunch"
class="org.eclipse.debug.internal.ui.contexts.SuspendTriggerAdapterFactory">
@@ -2804,6 +2847,8 @@ M4 = Platform-specific fourth key
<or>
<instanceof value="org.eclipse.debug.core.model.IVariable"/>
<instanceof value="org.eclipse.debug.core.model.IExpression"/>
+ <instanceof value="org.eclipse.debug.core.model.IBreakpoint"/>
+ <instanceof value="org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer"/>
<instanceof value="java.lang.String"/>
</or>
</iterate>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java
index e788f8025..f44a5243e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -13,7 +13,7 @@ package org.eclipse.debug.internal.ui;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainerWorkbenchAdapter;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointPersistableElementAdapter;
import org.eclipse.ui.IPersistableElement;
@@ -37,13 +37,13 @@ public class DebugUIAdapterFactory implements IAdapterFactory {
}
if (adapterType == IWorkbenchAdapter.class) {
- if (obj instanceof BreakpointContainer) {
+ if (obj instanceof IBreakpointContainer) {
return new BreakpointContainerWorkbenchAdapter();
}
}
if (adapterType == IWorkbenchAdapter2.class) {
- if (obj instanceof BreakpointContainer) {
+ if (obj instanceof IBreakpointContainer) {
return new BreakpointContainerWorkbenchAdapter();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
index 494d1e877..db243a07f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui;
@@ -94,6 +95,9 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer
//Registers View
prefs.setDefault(IDebugPreferenceConstants.REGISTERS_DETAIL_PANE_ORIENTATION, IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
+ // Breakpoints view default settings
+ prefs.setDefault(IDebugPreferenceConstants.BREAKPOINTS_DETAIL_PANE_ORIENTATION, IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_HIDDEN);
+
// Variable/Expression view default settings
prefs.setDefault(IDebugUIConstants.ID_VARIABLE_VIEW + '+' + "org.eclipse.debug.ui.ShowDetailPaneAction", true); //$NON-NLS-1$
prefs.setDefault(IDebugUIConstants.ID_EXPRESSION_VIEW + '+' + "org.eclipse.debug.ui.ShowDetailPaneAction", true); //$NON-NLS-1$
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
index 35be296ae..83e340315 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ImageDescriptorRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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,12 +7,15 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Bug 292411
*******************************************************************************/
package org.eclipse.debug.internal.ui;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -24,7 +27,7 @@ import org.eclipse.swt.widgets.Display;
*/
public class ImageDescriptorRegistry {
- private HashMap fRegistry= new HashMap(10);
+ private Map fRegistry= Collections.synchronizedMap(new HashMap(10));
private Display fDisplay;
/**
@@ -81,10 +84,15 @@ public class ImageDescriptorRegistry {
}
private void hookDisplay() {
- fDisplay.disposeExec(new Runnable() {
+ fDisplay.asyncExec(new Runnable() {
public void run() {
- dispose();
- }
+ fDisplay.disposeExec(new Runnable() {
+
+ public void run() {
+ dispose();
+ }
+ });
+ }
});
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java
index 3ee9a6476..8001be377 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/CopyBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -13,6 +13,7 @@ package org.eclipse.debug.internal.ui.actions.breakpointGroups;
import java.util.Iterator;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
@@ -125,7 +126,8 @@ public class CopyBreakpointsAction extends BreakpointSelectionAction {
}
Iterator iterator = selection.iterator();
while (iterator.hasNext()) {
- if (!(iterator.next() instanceof IBreakpoint)) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iterator.next(), IBreakpoint.class);
+ if (breakpoint == null) {
return false;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java
index d8225fcff..6bcce2775 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/EditBreakpointGroupAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 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,12 +7,13 @@
*
* Contributors:
* IBM Corporation - initial implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetCategory;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
@@ -45,19 +46,22 @@ public class EditBreakpointGroupAction extends AbstractBreakpointsViewAction {
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection sel) {
- IStructuredSelection selection= (IStructuredSelection) sel;
- fSet = null;
- if (selection.size() == 1) {
- Object element = selection.getFirstElement();
- if (element instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer)element;
- IAdaptable category = container.getCategory();
- if (category instanceof WorkingSetCategory) {
- IWorkingSet set = ((WorkingSetCategory)category).getWorkingSet();
- action.setEnabled(true);
- fSet = set;
- return;
- }
+ fSet = null;
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection= (IStructuredSelection) sel;
+
+ if (selection.size() == 1) {
+ Object element = selection.getFirstElement();
+ if (element instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer)element;
+ IAdaptable category = container.getCategory();
+ if (category instanceof WorkingSetCategory) {
+ IWorkingSet set = ((WorkingSetCategory)category).getWorkingSet();
+ action.setEnabled(true);
+ fSet = set;
+ return;
+ }
+ }
}
}
action.setEnabled(false);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java
index c53ab9ab8..40bd2a9ae 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -11,8 +11,8 @@
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
-import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
index 4ebf6be86..36b30036d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 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 implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
@@ -14,10 +15,13 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointOrganizerManager;
-import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer;
+import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizerInputProvider;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
@@ -76,13 +80,36 @@ public class GroupBreakpointsByAction extends AbstractBreakpointsViewAction impl
});
return menu;
}
-
+
+ /**
+ * Get the breakpoint organizer input provider from the view input.
+ *
+ * @param input the view input.
+ * @return the breakpoint organizer input provider, can be <code>null</code>.
+ */
+ private IBreakpointOrganizerInputProvider getOrganizerProvider(Object input) {
+ if (input instanceof IAdaptable) {
+ return (IBreakpointOrganizerInputProvider) ((IAdaptable) input).getAdapter(IBreakpointOrganizerInputProvider.class);
+ }
+ return null;
+ }
/**
* Fill pull down menu with the "group by" options
*/
private void fillMenu(Menu menu) {
+ // allow the organizer provider to populate the menu first
+ Object input = fView.getTreeModelViewer().getInput();
+ IBreakpointOrganizerInputProvider provider = getOrganizerProvider(input);
+ if (provider != null) {
+ IPresentationContext context = fView.getTreeModelViewer().getPresentationContext();
+ provider.fillMenu(input, context, menu);
+ fAction.setEnabled(menu.getItemCount() > 0);
+ return;
+ }
+
// determine which item should be checked
- IBreakpointOrganizer[] organizers = fView.getBreakpointOrganizers();
+ IBreakpointOrganizer[] organizers = fView.getBreakpointOrganizers();
+
boolean none = false;
boolean advanced = false;
IBreakpointOrganizer organizer = null;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
index a261c78af..49c776dd6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/GroupBreakpointsByDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -17,9 +17,9 @@ import java.util.List;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.SWTFactory;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointOrganizerManager;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
-import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.jface.resource.ImageDescriptor;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java
index db5fca697..800494b0c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/PasteBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -13,9 +13,9 @@ package org.eclipse.debug.internal.ui.actions.breakpointGroups;
import java.util.List;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
-import org.eclipse.debug.internal.ui.views.breakpoints.OtherBreakpointCategory;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
@@ -51,7 +51,7 @@ public class PasteBreakpointsAction extends BreakpointSelectionAction {
List selectedNonResources = getSelectedNonResources();
if (selectedNonResources.size() == 1) {
Object target = selectedNonResources.get(0);
- if (target instanceof BreakpointContainer) {
+ if (target instanceof IBreakpointContainer) {
return target;
}
}
@@ -74,8 +74,8 @@ public class PasteBreakpointsAction extends BreakpointSelectionAction {
protected boolean updateSelection(IStructuredSelection selection) {
// can't paste into "Others" (only move)
Object target = getTarget();
- if (target instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) target;
+ if (target instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) target;
if (container.getCategory() instanceof OtherBreakpointCategory) {
return false;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
index 9835ba0c1..f0110ee8d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
@@ -1,29 +1,38 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ * Freescale Semiconductor - bug 287863
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer;
-import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetCategory;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Item;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
/**
* Removes a breakpoint from a breakpoint working set.
*/
public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
- /**
+ private BreakpointSetElement[] fBreakpoints;
+
+
+ /**
* Constructs action to remove breakpoints from a category.
*
* @param view
@@ -36,29 +45,68 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
- BreakpointsViewer viewer = (BreakpointsViewer) getBreakpointsView().getViewer();
- Item[] items = viewer.getSelectedItems();
- IBreakpoint breakpoint = null;
- BreakpointContainer container = null;
- for(int i = 0; i < items.length; i++) {
- if(items[i].getData() instanceof IBreakpoint) {
- breakpoint = (IBreakpoint) items[i].getData();
- container = viewer.getRemovableContainer(items[i]);
- if(container != null) {
- container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory());
- }
- }
- }
+ if (fBreakpoints != null) {
+ for (int i = 0; i < fBreakpoints.length; i++) {
+ fBreakpoints[i].container.getOrganizer().removeBreakpoint(fBreakpoints[i].breakpoint, fBreakpoints[i].container.getCategory());
+ }
+ }
+ }
+
+ protected static class BreakpointSetElement {
+ BreakpointSetElement(IBreakpoint b, IBreakpointContainer c) { breakpoint = b; container = c; }
+ IBreakpoint breakpoint;
+ IBreakpointContainer container;
+ }
+
+ /**
+ * Returns a array of breakpoint/container pairs for the selection
+ *
+ * All the returned elements contain a breakpoint and a working set container the breakpoint is contained and the breakpoint
+ * can be removed from.
+ *
+ * @param selection
+ * @return
+ */
+ protected BreakpointSetElement[] getRemovableBreakpoints(IStructuredSelection selection) {
+ List res = new ArrayList();
+ if (selection instanceof ITreeSelection) {
+ ITreeSelection tSel = (ITreeSelection)selection;
+
+ TreePath[] paths = tSel.getPaths();
+ for (int i = 0; i < paths.length; i++) {
+ TreePath path = paths[i];
+
+ // We can remove Breakpoints from their working set if any of their parents is a non "Other" breakpoint working set
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
+ if (breakpoint != null) {
+ TreePath parents = path.getParentPath();
+
+ for (int j = 0; j < parents.getSegmentCount(); j++) {
+ Object parent = parents.getSegment(j);
+
+ if (parent instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer)parent;
+
+ // Test if this is a working set container.
+ if (container.getCategory() instanceof WorkingSetCategory) {
+ // Test if this container allows to remove this breakpoint.
+ if (container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
+ res.add(new BreakpointSetElement(breakpoint, container));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return (BreakpointSetElement[])res.toArray(new BreakpointSetElement[res.size()]);
}
/* (non-Javadoc)
* @see org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/
protected boolean updateSelection(IStructuredSelection selection) {
- Object element = selection.getFirstElement();
- if(element instanceof BreakpointContainer) {
- return ((BreakpointContainer) element).getCategory().equals(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID);
- }
- return false;
+ fBreakpoints = getRemovableBreakpoints(selection);
+ return fBreakpoints.length > 0;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java
index 7b777f266..f236c2e1a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/ToggleDefaultGroupAction.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointSetOrganizer;
import org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetCategory;
import org.eclipse.debug.ui.IDebugUIConstants;
@@ -47,8 +47,8 @@ public class ToggleDefaultGroupAction extends AbstractBreakpointsViewAction {
IStructuredSelection selection = (IStructuredSelection) sel;
if (selection.size() == 1) {
Object firstElement = selection.getFirstElement();
- if (firstElement instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) firstElement;
+ if (firstElement instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) firstElement;
if (container.getCategory() instanceof WorkingSetCategory) {
WorkingSetCategory category = (WorkingSetCategory)container.getCategory();
if (IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(category.getWorkingSet().getId())) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java
index 03e9c96d0..895e9d6db 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsCollapseAllAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 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,13 +7,15 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
+import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IViewActionDelegate;
@@ -26,7 +28,7 @@ import org.eclipse.ui.handlers.IHandlerService;
*/
public class BreakpointsCollapseAllAction implements IViewActionDelegate, IActionDelegate2 {
- private BreakpointsView fView;
+ private AbstractDebugView fView;
private IAction fAction;
@@ -34,7 +36,7 @@ public class BreakpointsCollapseAllAction implements IViewActionDelegate, IActio
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
public void init(IViewPart view) {
- fView= (BreakpointsView) view;
+ fView = (AbstractDebugView) view;
IHandlerService hs = (IHandlerService) view.getSite().getService(IHandlerService.class);
if (hs != null) {
hs.activateHandler(CollapseAllHandler.COMMAND_ID, new ActionHandler(fAction));
@@ -45,7 +47,7 @@ public class BreakpointsCollapseAllAction implements IViewActionDelegate, IActio
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
- fView.getCheckboxViewer().collapseAll();
+ ((TreeViewer) fView.getViewer()).collapseAll();
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java
index e3c91aa9b..b9ae154eb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointsExpandAllAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 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,34 +7,72 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
+import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.VirtualTreeModelViewer;
+import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
/**
* Action which fully expands the tree in the breakpoints view.
*/
-public class BreakpointsExpandAllAction implements IViewActionDelegate {
+public class BreakpointsExpandAllAction implements IViewActionDelegate {
- private BreakpointsView fView;
+ private AbstractDebugView fView;
+ private boolean fFinishedExpanding;
+
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
public void init(IViewPart view) {
- fView= (BreakpointsView) view;
+ fView = (AbstractDebugView) view;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
- fView.getCheckboxViewer().expandAll();
+ Display display = fView.getSite().getShell().getDisplay();
+
+ VirtualTreeModelViewer virtualViewer = new VirtualTreeModelViewer(
+ display, 0, ((ITreeModelViewer)fView.getViewer()).getPresentationContext());
+
+ fFinishedExpanding = false;
+ virtualViewer.setAutoExpandLevel(-1);
+ virtualViewer.addViewerUpdateListener(new IViewerUpdateListener() {
+ public void viewerUpdatesComplete() {
+ fFinishedExpanding = true;
+ }
+
+ public void viewerUpdatesBegin() {}
+ public void updateStarted(IViewerUpdate update) {}
+ public void updateComplete(IViewerUpdate update) {}
+ });
+
+ virtualViewer.setInput(fView.getViewer().getInput());
+
+ while (!fFinishedExpanding) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+
+ ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
+ virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
+ ((ITreeModelViewer) fView.getViewer()).updateViewer(stateDelta);
+
+ virtualViewer.dispose();
}
/* (non-Javadoc)
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
index 35cd2a1e7..86033d684 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/EnableBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -26,7 +26,7 @@ import org.eclipse.debug.core.IBreakpointsListener;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -91,10 +91,11 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
Object element= itr.next();
try {
IBreakpoint[] breakpoints= null;
- if (element instanceof IBreakpoint) {
- breakpoints= new IBreakpoint[] { (IBreakpoint) element };
- } else if (element instanceof BreakpointContainer) {
- breakpoints= ((BreakpointContainer) element).getBreakpoints();
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
+ if (breakpoint != null) {
+ breakpoints= new IBreakpoint[] { breakpoint };
+ } else if (element instanceof IBreakpointContainer) {
+ breakpoints= ((IBreakpointContainer) element).getBreakpoints();
}
if (breakpoints != null) {
setEnabled(breakpoints);
@@ -147,8 +148,21 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
boolean allDisabled= true;
while (itr.hasNext()) {
Object selected= itr.next();
- if (selected instanceof BreakpointContainer) {
- IBreakpoint[] breakpoints = ((BreakpointContainer) selected).getBreakpoints();
+ IBreakpoint bp = (IBreakpoint)DebugPlugin.getAdapter(selected, IBreakpoint.class);
+
+ if (bp != null) {
+ try {
+ if (bp.isEnabled()) {
+ allDisabled= false;
+ } else {
+ allEnabled= false;
+ }
+ } catch (CoreException ce) {
+ handleException(ce);
+ }
+ }
+ else if (selected instanceof IBreakpointContainer) {
+ IBreakpoint[] breakpoints = ((IBreakpointContainer) selected).getBreakpoints();
for (int i = 0; i < breakpoints.length; i++) {
try {
if (breakpoints[i].isEnabled()) {
@@ -160,17 +174,6 @@ public class EnableBreakpointsAction implements IViewActionDelegate, IPartListen
handleException(ce);
}
}
- } else if (selected instanceof IBreakpoint) {
- IBreakpoint bp= (IBreakpoint)selected;
- try {
- if (bp.isEnabled()) {
- allDisabled= false;
- } else {
- allEnabled= false;
- }
- } catch (CoreException ce) {
- handleException(ce);
- }
} else {
return;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java
index b292f4c63..50cccc6d7 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/OpenBreakpointMarkerAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
@@ -85,9 +86,8 @@ public class OpenBreakpointMarkerAction extends SelectionProviderAction {
*/
public void selectionChanged(IStructuredSelection sel) {
if (sel.size() == 1) {
- Object element = sel.getFirstElement();
- if (element instanceof IBreakpoint) {
- breakpoint= (IBreakpoint) element;
+ breakpoint = (IBreakpoint)DebugPlugin.getAdapter(sel.getFirstElement(), IBreakpoint.class);
+ if (breakpoint != null) {
input= fgPresentation.getEditorInput(breakpoint);
if (input != null) {
setEnabled(true);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
index 6d9aa0982..45e1e50e3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
@@ -26,8 +27,8 @@ import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.actions.AbstractRemoveActionDelegate;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
import org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetCategory;
import org.eclipse.jface.action.IAction;
@@ -61,11 +62,12 @@ public class RemoveBreakpointAction extends AbstractRemoveActionDelegate {
boolean prompted = false;
while (itr.hasNext()) {
Object next= itr.next();
- if (next instanceof IBreakpoint) {
- breakpointsToDelete.add(next);
- } else if (next instanceof BreakpointContainer) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(next, IBreakpoint.class);
+ if (breakpoint != null) {
+ breakpointsToDelete.add(breakpoint);
+ } else if (next instanceof IBreakpointContainer) {
//the the container is a workingset, ask if they want to delete it as well
- BreakpointContainer bpc = (BreakpointContainer) next;
+ IBreakpointContainer bpc = (IBreakpointContainer) next;
if(bpc.getCategory() instanceof WorkingSetCategory) {
IWorkingSet set = ((WorkingSetCategory)bpc.getCategory()).getWorkingSet();
if(!prompted) {
@@ -93,12 +95,12 @@ public class RemoveBreakpointAction extends AbstractRemoveActionDelegate {
if(prompted) {
MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(getView().getSite().getShell(), ActionMessages.RemoveBreakpointAction_0,
ActionMessages.RemoveBreakpointAction_1, ActionMessages.RemoveAllBreakpointsAction_3, !prompted, null, null);
- if(mdwt.getReturnCode() == IDialogConstants.YES_ID) {
- store.setValue(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, !mdwt.getToggleState());
- deleteAll = true;
+ if(mdwt.getReturnCode() == IDialogConstants.NO_ID) {
+ deleteAll = false;
}
else {
- deleteAll = false;
+ store.setValue(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, !mdwt.getToggleState());
+ deleteAll = true;
}
}
else {
@@ -154,12 +156,12 @@ public class RemoveBreakpointAction extends AbstractRemoveActionDelegate {
* @see org.eclipse.debug.internal.ui.actions.AbstractSelectionActionDelegate#isEnabledFor(java.lang.Object)
*/
protected boolean isEnabledFor(Object element) {
- if (element instanceof BreakpointContainer) {
- if(((BreakpointContainer)element).getCategory() instanceof WorkingSetCategory) {
+ if (element instanceof IBreakpointContainer) {
+ if(((IBreakpointContainer)element).getCategory() instanceof WorkingSetCategory) {
return true;
}
- return ((BreakpointContainer)element).getChildren().length > 0;
+ return ((IBreakpointContainer)element).getBreakpoints().length > 0;
}
- return super.isEnabledFor(element);
+ return DebugPlugin.getAdapter(element, IBreakpoint.class) != null;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SelectAllBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SelectAllBreakpointsAction.java
index 5f1e29f5f..f68b4fe17 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SelectAllBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/SelectAllBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
@@ -15,10 +16,11 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointsListener;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.actions.SelectAllAction;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
+import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Tree;
public class SelectAllBreakpointsAction extends SelectAllAction implements IBreakpointsListener {
@@ -29,12 +31,9 @@ public class SelectAllBreakpointsAction extends SelectAllAction implements IBrea
return DebugPlugin.getDefault().getBreakpointManager().hasBreakpoints();
}
- public void run(IAction action) {
- if (!(getView() instanceof BreakpointsView)) {
- return;
- }
- CheckboxTreeViewer viewer = ((BreakpointsView) getView()).getCheckboxViewer();
- viewer.getTree().selectAll();
+ public void run(IAction action) {
+ Viewer viewer = ((AbstractDebugView) getView()).getViewer();
+ ((Tree) viewer.getControl()).selectAll();
// ensure that the selection change callback is fired
viewer.setSelection(viewer.getSelection());
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
index 280986f31..66a1d1353 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowSupportedBreakpointsAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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,9 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
+ * This class should be obsoleted for the new async breakpoints view.
+ * @see ShowTargetBreakpointsAction
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpoints;
@@ -25,8 +28,8 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.internal.ui.actions.ToggleFilterAction;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
-import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -46,13 +49,12 @@ import org.eclipse.ui.PlatformUI;
* @see org.eclipse.debug.core.model.IDebugTarget#supportsBreakpoint(IBreakpoint)
*
*/
-public class ShowSupportedBreakpointsAction extends ToggleFilterAction implements ISelectionListener {
-
+public class ShowSupportedBreakpointsAction extends ToggleFilterAction implements ISelectionListener {
/**
* The view associated with this action
*/
- private BreakpointsView fView;
-
+ private AbstractDebugView fView;
+
/**
* The list of identifiers for the current state
*/
@@ -68,9 +70,9 @@ public class ShowSupportedBreakpointsAction extends ToggleFilterAction implement
* @see ViewerFilter#select(Viewer, Object, Object)
*/
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof BreakpointContainer) {
+ if (element instanceof IBreakpointContainer) {
// Breakpoint containers are visible if any of their children are visible.
- IBreakpoint[] breakpoints = ((BreakpointContainer) element).getBreakpoints();
+ IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints();
for (int i = 0; i < breakpoints.length; i++) {
if (select(viewer, element, breakpoints[i])) {
return true;
@@ -180,8 +182,8 @@ public class ShowSupportedBreakpointsAction extends ToggleFilterAction implement
return fView;
}
- protected void setView(IViewPart view) {
- fView = (BreakpointsView) view;
+ protected void setView(IViewPart view) {
+ fView = (AbstractDebugView) view;
}
protected List getDebugTargets(IStructuredSelection ss) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowTargetBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowTargetBreakpointsAction.java
new file mode 100644
index 000000000..4630a2ab2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/ShowTargetBreakpointsAction.java
@@ -0,0 +1,85 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.actions.breakpoints;
+
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.actions.ActionMessages;
+import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This class implements the show target breakpoint action.
+ *
+ * @since 3.6
+ */
+public class ShowTargetBreakpointsAction extends Action implements ISelectionListener {
+ /**
+ * Breakpoints view
+ */
+ BreakpointsView fView;
+
+ /**
+ * Constructor.
+ *
+ * @param view the breakpoints view
+ */
+ public ShowTargetBreakpointsAction(BreakpointsView view) {
+ super();
+
+ fView = view;
+
+ setText(ActionMessages.ShowSupportedBreakpointsAction_Show_For_Selected);
+ setToolTipText(ActionMessages.ShowSupportedBreakpointsAction_tooltip);
+
+ setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET));
+ setChecked(false);
+ setId(DebugUIPlugin.getUniqueIdentifier() + ".ShowSupportedBreakpointsAction"); //$NON-NLS-1$
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.SHOW_BREAKPOINTS_FOR_MODEL_ACTION);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run() {
+ if (fView.getViewer().getControl().isDisposed()) {
+ return;
+ }
+
+ if (isChecked()) {
+ fView.getSite().getPage().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
+ ISelection selection = fView.getSite().getPage().getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
+ selectionChanged(null, selection);
+ } else {
+ fView.getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
+ fView.setFilterSelection(null);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ fView.setFilterSelection((IStructuredSelection) selection);
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java
new file mode 100644
index 000000000..f411b73c0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointContainer.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.breakpoints.provisional;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.model.IBreakpoint;
+
+/**
+ * Interface representing a breakpoint category container elements in
+ * Breakpoints view. Clients which provide custom content in the
+ * Breakpoints view may implement this interface to represent container
+ * elements. This will allow the breakpoints view to properly handle
+ * drag-and-drop and copy-paste operations.
+ *
+ * @since 3.6
+ */
+public interface IBreakpointContainer {
+
+ /**
+ * Returns the breakpoint organizer that this container uses.
+ */
+ public IBreakpointOrganizer getOrganizer();
+
+ /**
+ * Returns the breakpoint category that this container is based on.
+ * @return
+ */
+ public IAdaptable getCategory();
+
+ /**
+ * Returns whether this breakpoint container contains the given breakpoint.
+ *
+ * @param breakpoint Breakpoint to check
+ * @return Returns <code>true</code> if this container contains the
+ * given breakpoint.
+ */
+ public boolean contains(IBreakpoint breakpoint);
+
+ /**
+ * Returns the array of breakpoints in this container.
+ */
+ public IBreakpoint[] getBreakpoints();
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java
index eefe1f7f5..e5ff6070d 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointOrganizer.java
@@ -1,58 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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.debug.internal.ui.views.breakpoints;
-
-import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A breakpoint organizer is used to categorize breakpoints and provides
- * change notification when categorization has changed. Breakpoint organizers
- * are contributed via the <code>breakpointOrganizers</code> extension point.
- * <p>
- * This interface is not intended to be implemented. Clients contributing a breakpoint
- * organizer are intended to implement <code>IBreakpointOrganizerDelegate</code>.
- * </p>
- * @since 3.1
- */
-public interface IBreakpointOrganizer extends IBreakpointOrganizerDelegate {
-
- /**
- * Returns a label for this breakpoint organizer.
- *
- * @return a label for this breakpoint organizer
- */
- public String getLabel();
-
- /**
- * Returns an image descriptor for this breakpoint organizer or <code>null</code>.
- *
- * @return an image descriptor for this breakpoint organizer or <code>null</code>
- */
- public ImageDescriptor getImageDescriptor();
-
- /**
- * Returns a unique identifier for this breakpoint organizer.
- *
- * @return a unique identifier for this breakpoint organizer
- */
- public String getIdentifier();
-
- /**
- * Returns the label for breakpoints that do not fall into a category
- * for this organizer.
- *
- * @return label for breakpoints that do not fall into a category
- * for this organizer
- */
- public String getOthersLabel();
-
-}
+/*******************************************************************************
+ * Copyright (c) 2000, 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.breakpoints.provisional;
+
+import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * A breakpoint organizer is represents a breakpoint organizer delegate in
+ * the breakpoint view. Clients can retrieve the current active breakpoint
+ * organizers from the breakpoint view's presentation context using the
+ * {@link IBreakpointUIConstants#PROP_BREAKPOINTS_ORGANIZERS} property.
+ * <p>
+ * This interface is not intended to be implemented. Clients contributing a breakpoint
+ * organizer are intended to implement <code>IBreakpointOrganizerDelegate</code>.
+ * </p>
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 3.6 (internal interface since 3.1)
+ *
+ * @see IBreakpointUIConstants#PROP_BREAKPOINTS_ORGANIZERS
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext
+ */
+public interface IBreakpointOrganizer extends IBreakpointOrganizerDelegate {
+
+ /**
+ * Returns a label for this breakpoint organizer.
+ *
+ * @return a label for this breakpoint organizer
+ */
+ public String getLabel();
+
+ /**
+ * Returns an image descriptor for this breakpoint organizer or <code>null</code>.
+ *
+ * @return an image descriptor for this breakpoint organizer or <code>null</code>
+ */
+ public ImageDescriptor getImageDescriptor();
+
+ /**
+ * Returns a unique identifier for this breakpoint organizer.
+ *
+ * @return a unique identifier for this breakpoint organizer
+ */
+ public String getIdentifier();
+
+ /**
+ * Returns the label for breakpoints that do not fall into a category
+ * for this organizer.
+ *
+ * @return label for breakpoints that do not fall into a category
+ * for this organizer
+ */
+ public String getOthersLabel();
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java
new file mode 100644
index 000000000..1e6921694
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.debug.internal.ui.breakpoints.provisional;
+
+/**
+ * Constants to use with Breakpoint view.
+ *
+ * @since 3.6
+ */
+public interface IBreakpointUIConstants {
+ /**
+ * Breakpoints presentation context property used to retrieve the array of
+ * breakpoint organizers. The expected property type is
+ * <code>IBreakpointOrganizer[]</code>. If property value is <code>null</code>,
+ * the breakpoint categories should not be shown.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ public static final String PROP_BREAKPOINTS_ORGANIZERS = "BreakpointOrganizers"; //$NON-NLS-1$
+
+ /**
+ * Breakpoints presentation context property used to retrieve the debug
+ * context selection which should be used to filter the visible
+ * breakpoints. The returned property value should be of type
+ * <code>org.eclipse.jface.viewers.ISelection</code>. If property value
+ * is <code>null</code>, the breakpoints should not be filtered.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ public static final String PROP_BREAKPOINTS_FILTER_SELECTION = "FilterSelection"; //$NON-NLS-1$
+
+ /**
+ * Breakpoints presentation context property used to retrieve a flag
+ * indicating whether breakpoints view selection should be updated
+ * upon a breakpoint event in debug model. The returned property value
+ * should be of type <code>java.lang.Boolean</code>. If property value is
+ * <code>null</code>, then value should be treated the same as
+ * <code>Boolean.FALSE</code>.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ public static final String PROP_BREAKPOINTS_TRACK_SELECTION = "TrackSelection"; //$NON-NLS-1$
+
+ /**
+ * Breakpoints presentation context property used to retrieve a
+ * comparator for sorting breakpoints. The returned property value should
+ * be of type <code>java.util.Comparator</code>. If property value is
+ * <code>null</code>, the breakpoints should not be sorted.
+ *
+ * @see org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext#getProperty(String)
+ */
+ public static final String PROP_BREAKPOINTS_ELEMENT_COMPARATOR = "ElementComparator"; //$NON-NLS-1$
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java
index 388bb547c..621109137 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/OtherBreakpointCategory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/OtherBreakpointCategory.java
@@ -1,95 +1,103 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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.debug.internal.ui.views.breakpoints;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Category for breakpoints in "other" categories.
- */
-public class OtherBreakpointCategory extends PlatformObject implements IWorkbenchAdapter {
-
- private static Map fOthers = new HashMap();
- private IBreakpointOrganizer fOrganizer;
-
-
- public static IAdaptable[] getCategories(IBreakpointOrganizer organizer) {
- IAdaptable[] others = (IAdaptable[]) fOthers.get(organizer);
- if (others == null) {
- others = new IAdaptable[]{new OtherBreakpointCategory(organizer)};
- fOthers.put(organizer, others);
- }
- return others;
- }
-
- /**
- * Constructs an 'other' category for the given organizer.
- *
- * @param organizer breakpoint organizer
- */
- private OtherBreakpointCategory(IBreakpointOrganizer organizer) {
- fOrganizer = organizer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return fOrganizer.getOthersLabel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof OtherBreakpointCategory) {
- OtherBreakpointCategory category = (OtherBreakpointCategory) obj;
- return fOrganizer.equals(category.fOrganizer);
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fOrganizer.hashCode();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2000, 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.breakpoints.provisional;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.debug.internal.ui.DebugPluginImages;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+/**
+ * Category for breakpoints in "other" categories. Clients which provide
+ * custom content in the Breakpoints view may instantiate this object to
+ * represent elements in a breakpoint organizer that do not fall into any known
+ * category.
+ *
+ * @since 3.6
+ *
+ * @see IBreakpointContainer
+ * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate
+ */
+public class OtherBreakpointCategory extends PlatformObject implements IWorkbenchAdapter {
+
+ private static Map fOthers = new HashMap();
+ private IBreakpointOrganizer fOrganizer;
+
+
+ public static IAdaptable[] getCategories(IBreakpointOrganizer organizer) {
+ IAdaptable[] others = (IAdaptable[]) fOthers.get(organizer);
+ if (others == null) {
+ others = new IAdaptable[]{new OtherBreakpointCategory(organizer)};
+ fOthers.put(organizer, others);
+ }
+ return others;
+ }
+
+ /**
+ * Constructs an 'other' category for the given organizer.
+ *
+ * @param organizer breakpoint organizer
+ */
+ private OtherBreakpointCategory(IBreakpointOrganizer organizer) {
+ fOrganizer = organizer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
+ */
+ public Object[] getChildren(Object o) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
+ */
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_VIEW_BREAKPOINTS);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
+ */
+ public String getLabel(Object o) {
+ return fOrganizer.getOthersLabel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
+ */
+ public Object getParent(Object o) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof OtherBreakpointCategory) {
+ OtherBreakpointCategory category = (OtherBreakpointCategory) obj;
+ return fOrganizer.equals(category.fOrganizer);
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return fOrganizer.hashCode();
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AbstractBreakpointManagerInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AbstractBreakpointManagerInput.java
new file mode 100644
index 000000000..148a03b5e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/AbstractBreakpointManagerInput.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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.elements.adapters;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+
+/**
+ * A breakpoint manager input allows the breakpoints view to link the active debug context
+ * per workbench window.
+ *
+ * @since 3.6
+ */
+public abstract class AbstractBreakpointManagerInput {
+
+ /**
+ * The presentation context of the breakpoints view.
+ */
+ final private IPresentationContext fContext;
+
+ /**
+ * Constructor.
+ *
+ * @param context the presentation context for this input
+ */
+ protected AbstractBreakpointManagerInput(IPresentationContext context) {
+ fContext = context;
+ }
+
+ /**
+ * Returns the presentation context for this input.
+ *
+ * @return the presentation context
+ */
+ public IPresentationContext getContext() {
+ return fContext;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointManagerInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointManagerInput.java
new file mode 100644
index 000000000..ae0ab52e2
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultBreakpointManagerInput.java
@@ -0,0 +1,58 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.elements.adapters;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+
+/**
+ * Default breakpoint manager input.
+ *
+ * @since 3.6
+ */
+public class DefaultBreakpointManagerInput extends AbstractBreakpointManagerInput {
+
+ /**
+ * Constructor - Default breakpoint manager input.
+ *
+ * @param context the presentation context.
+ */
+ public DefaultBreakpointManagerInput(IPresentationContext context) {
+ super(context);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ if (getContext() != null) {
+ return getContext().hashCode();
+ } else {
+ return 1;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object arg0) {
+ if ( (arg0 != null) && arg0.getClass().equals(this.getClass()) ) {
+
+ IPresentationContext context = ((DefaultBreakpointManagerInput) arg0).getContext();
+ if (getContext() != null && context != null)
+ return getContext().equals(context);
+ }
+
+ return super.equals(arg0);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultViewerInputProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultViewerInputProvider.java
index cd5a10d91..74a830a63 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultViewerInputProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/DefaultViewerInputProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems and others.
+ * Copyright (c) 2007, 2009 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.elements.adapters;
@@ -28,7 +29,12 @@ public class DefaultViewerInputProvider extends ViewerInputProvider {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.model.elements.ViewerInputProvider#getViewerInput(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
*/
- protected Object getViewerInput(Object source, IPresentationContext context, IViewerUpdate update) throws CoreException {
+ protected Object getViewerInput(Object source, IPresentationContext context, IViewerUpdate update) throws CoreException {
+ if (IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId())) {
+ AbstractBreakpointManagerInput input = new DefaultBreakpointManagerInput(context);
+ return input;
+ }
+
return DebugPlugin.getDefault().getExpressionManager();
}
@@ -36,7 +42,8 @@ public class DefaultViewerInputProvider extends ViewerInputProvider {
* @see org.eclipse.debug.internal.ui.model.elements.ViewerInputProvider#supportsContextId(java.lang.String)
*/
protected boolean supportsContextId(String id) {
- return IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id);
+ return IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id) ||
+ IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java
index d48d9d822..97b3ce6fa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/elements/adapters/StackFrameViewerInputProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 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
* Wind River Systems - support for alternative expression view content providers
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.elements.adapters;
@@ -23,13 +24,15 @@ import org.eclipse.debug.ui.IDebugUIConstants;
* @since 3.4
*/
public class StackFrameViewerInputProvider extends ViewerInputProvider {
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.model.elements.ViewerInputProvider#getViewerInput(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
*/
protected Object getViewerInput(Object source, IPresentationContext context, IViewerUpdate update) throws CoreException {
if ( IDebugUIConstants.ID_REGISTER_VIEW.equals(context.getId()) ) {
- return new RegisterGroupProxy((IStackFrame) source);
+ return new RegisterGroupProxy((IStackFrame) source);
+ } else if ( IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(context.getId()) ) {
+ return new DefaultBreakpointManagerInput(context);
} else {
return DebugPlugin.getDefault().getExpressionManager();
}
@@ -41,7 +44,8 @@ public class StackFrameViewerInputProvider extends ViewerInputProvider {
*/
protected boolean supportsContextId(String id) {
return IDebugUIConstants.ID_REGISTER_VIEW.equals(id) ||
- IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id);
+ IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id) ||
+ IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
index 92e8b3138..f9c7ed5e0 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/EmbeddedBreakpointsViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -17,17 +17,19 @@ import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
import org.eclipse.debug.internal.ui.SWTFactory;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsComparator;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsContentProvider;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsLabelProvider;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer;
-import org.eclipse.debug.internal.ui.views.breakpoints.IBreakpointOrganizer;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@@ -151,11 +153,12 @@ public class EmbeddedBreakpointsViewer {
ArrayList list = new ArrayList();
for(int i = 0; i < items.length; i++) {
Object item = items[i];
- if(item instanceof IBreakpoint) {
- list.add(item);
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(item, IBreakpoint.class);
+ if(breakpoint != null) {
+ list.add(breakpoint);
}
- else if (item instanceof BreakpointContainer) {
- getBreakpointsFromContainers((BreakpointContainer)item, list);
+ else if (item instanceof IBreakpointContainer) {
+ getBreakpointsFromContainers((IBreakpointContainer)item, list);
}
}
for(int i = 0; i < list.size(); i++) {
@@ -168,16 +171,12 @@ public class EmbeddedBreakpointsViewer {
* @param container the container to get breakpoints from
* @param list the list of breakpoints to update state for
*/
- private void getBreakpointsFromContainers(BreakpointContainer container, ArrayList list) {
- Object[] elements = container.getChildren();
- for(int i = 0; i < elements.length; i++) {
- if(elements[i] instanceof IBreakpoint) {
- list.add(elements[i]);
- }
- else {
- getBreakpointsFromContainers((BreakpointContainer)elements[i], list);
- }
- }
+ private void getBreakpointsFromContainers(IBreakpointContainer container, ArrayList list) {
+ IBreakpoint[] bps = container.getBreakpoints();
+ list.ensureCapacity(list.size() + bps.length);
+ for (int j = 0; j < bps.length; j++) {
+ list.add(bps[j]);
+ }
}
/**
@@ -240,22 +239,23 @@ public class EmbeddedBreakpointsViewer {
* @param enable the checked status of the obj
*/
private void updateCheckedState(Object obj, boolean enable) {
- if (obj instanceof IBreakpoint) {
- Widget[] list = searchItems(obj);
- TreeItem item = null;
- for(int i = 0; i < list.length; i++) {
- item = (TreeItem)list[i];
- item.setChecked(enable);
- refreshParents(item);
- }
- }
- else if (obj instanceof BreakpointContainer) {
- ArrayList bps = new ArrayList();
- getBreakpointsFromContainers((BreakpointContainer)obj, bps);
- for(int j = 0; j < bps.size(); j++) {
- updateCheckedState(bps.get(j), enable);
- }
- }
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(obj, IBreakpoint.class);
+ if (breakpoint != null) {
+ Widget[] list = searchItems(obj);
+ TreeItem item = null;
+ for(int i = 0; i < list.length; i++) {
+ item = (TreeItem)list[i];
+ item.setChecked(enable);
+ refreshParents(item);
+ }
+ }
+ else if (obj instanceof BreakpointContainer) {
+ ArrayList bps = new ArrayList();
+ getBreakpointsFromContainers((BreakpointContainer)obj, bps);
+ for(int j = 0; j < bps.size(); j++) {
+ updateCheckedState(bps.get(j), enable);
+ }
+ }
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/AbstractBreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/AbstractBreakpointManagerContentProvider.java
new file mode 100644
index 000000000..dbfeb3a30
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/AbstractBreakpointManagerContentProvider.java
@@ -0,0 +1,727 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IBreakpointManager;
+import org.eclipse.debug.core.IBreakpointsListener;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
+import org.eclipse.debug.internal.ui.elements.adapters.AbstractBreakpointManagerInput;
+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.IViewerUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
+import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
+import org.eclipse.debug.internal.ui.views.breakpoints.ElementComparator;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * This class provides breakpoint content for the breakpoint manager.
+ *
+ * @since 3.6
+ */
+public abstract class AbstractBreakpointManagerContentProvider extends ElementContentProvider
+ implements IBreakpointsListener {
+
+ /**
+ * Breakpoint input data. Contains all input specific data.
+ *
+ * @since 3.6
+ */
+ private class InputData {
+ /**
+ * Breakpoint manager input
+ */
+ private AbstractBreakpointManagerInput fInput;
+
+ /**
+ * Model proxy of the input
+ */
+ private List/*<AbstractModelProxy>*/ fProxies = new ArrayList(1);
+
+ /**
+ * Element comparator, use to compare the ordering of elements for the model
+ * <br/> Note: We assume that the comparator does not change.
+ */
+ private ElementComparator fComparator;
+
+ /**
+ * The breakpoint root container.<br/>
+ * Note: The final qualifier guarantees that fContainer will be
+ * initialized before the class is accessed on other threads.
+ */
+ final private BreakpointContainer fContainer;
+
+ /**
+ * Constructor
+ *
+ * @param input the breakpoint manager input
+ * @param proxy the model proxy
+ * @param filter the debug context selection
+ * @param comparator the element comparator
+ */
+ InputData(AbstractBreakpointManagerInput input) {
+ fInput = input;
+ fProxies = new ArrayList(1);
+ fComparator = (ElementComparator)
+ input.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR);
+
+ IBreakpointOrganizer[] organizers = (IBreakpointOrganizer[])
+ input.getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS);
+
+ // Create the initial container.
+ ModelDelta initialDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ fContainer = createRootContainer(initialDelta, fInput, organizers, fBpManager);
+ }
+
+ synchronized void proxyInstalled(AbstractModelProxy proxy) {
+ fProxies.add(proxy);
+
+ // Generate an install delta
+
+ ModelDelta rootDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ buildInstallDelta(rootDelta, fContainer);
+ proxy.fireModelChanged(rootDelta);
+ }
+
+ synchronized void proxyDisposed(AbstractModelProxy proxy) {
+ fProxies.remove(proxy);
+ }
+
+ /**
+ * Change the breakpoint organizers for the root container.
+ *
+ * @param organizers the new organizers.
+ */
+ synchronized void setOrganizers(IBreakpointOrganizer[] organizers) {
+ // create a reference container, use for deleting elements and adding elements
+ ModelDelta dummyDelta = new ModelDelta(null, IModelDelta.NO_CHANGE);
+ BreakpointContainer refContainer = createRootContainer(dummyDelta, fInput, organizers, fBpManager);
+
+ // delete the removed elements
+ ModelDelta deletedDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ deleteRemovedElements(fContainer, refContainer, deletedDelta);
+ fireModelChanged(fInput, deletedDelta, "setOrganizers - Delete removed elements"); //$NON-NLS-1$
+
+ // adjust the old organizer with the reference organizer
+ BreakpointContainer.copyOrganizers(fContainer, refContainer);
+
+ // insert the added elements
+ ModelDelta addedDelta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ IBreakpoint newBreakpoint = insertAddedElements(fContainer, refContainer, addedDelta);
+ addedDelta.setChildCount(fContainer.getChildren().length);
+
+ // select the new breakpoint
+ if (newBreakpoint != null)
+ appendModelDeltaToElement(addedDelta, newBreakpoint, IModelDelta.SELECT);
+
+ fireModelChanged(fInput, addedDelta, "setOrganizers - Insert added elements"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.actions.breakpoints.IBreakpointFilterContentProvider#setFilterSelection(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ synchronized public void setFilterSelection(IStructuredSelection ss) {
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+
+ Set existingBreakpoints = new HashSet(Arrays.asList(fContainer.getBreakpoints()));
+ IBreakpoint[] allBreakpoints = fBpManager.getBreakpoints();
+
+ for (int i = 0; i < allBreakpoints.length; ++i) {
+ boolean supported = supportsBreakpoint(ss, allBreakpoints[i]);
+ boolean contain = existingBreakpoints.contains(allBreakpoints[i]);
+
+ if (supported) {
+ if (!contain)
+ fContainer.addBreakpoint(allBreakpoints[i], delta);
+ } else {
+ if (contain)
+ fContainer.removeBreakpoint(allBreakpoints[i], delta);
+ }
+
+ }
+
+ fireModelChanged(fInput, delta, "setFilterSelection"); //$NON-NLS-1$
+ }
+
+ /**
+ * Helper method to add breakpoints to the given input.
+ *
+ * @param data the input to add the breakpoints
+ * @param breakpoints the breakpoints
+ */
+ synchronized void breakpointsAdded(IBreakpoint[] breakpoints) {
+ IBreakpoint[] filteredBreakpoints = filterBreakpoints(fInput, breakpoints);
+ ModelDelta delta = new ModelDelta(fInput, 0, IModelDelta.NO_CHANGE, -1);
+ for (int i = 0; i < filteredBreakpoints.length; ++i) {
+ fContainer.addBreakpoint(filteredBreakpoints[i], delta);
+ }
+ delta.setChildCount(fContainer.getChildren().length);
+
+ // select the breakpoint
+ if (filteredBreakpoints.length > 0) {
+ appendModelDeltaToElement(delta, filteredBreakpoints[0], IModelDelta.SELECT);
+ }
+
+ fireModelChanged(fInput, delta, "breakpointsAddedInput"); //$NON-NLS-1$
+ }
+
+ /**
+ * Helper method to remove breakpoints from a given input.
+ *
+ * @param data the input to add the breakpoints
+ * @param breakpoints the breakpoints
+ */
+ synchronized void breakpointsRemoved(IBreakpoint[] breakpoints) {
+ IBreakpoint[] filteredBreakpoints = filterBreakpoints(fInput, breakpoints);
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ for (int i = 0; i < filteredBreakpoints.length; ++i) {
+ fContainer.removeBreakpoint(filteredBreakpoints[i], delta);
+ }
+ fireModelChanged(fInput, delta, "breakpointsRemovedInput"); //$NON-NLS-1$
+ }
+
+ synchronized void breakpointsChanged(IBreakpoint[] breakpoints) {
+ IBreakpoint[] filteredBreakpoints = filterBreakpoints(fInput, breakpoints);
+
+ // If the change caused a breakpoint to be added (installed) or remove (un-installed) update accordingly.
+ List removed = new ArrayList();
+ List added = new ArrayList();
+ List filteredAsList = Arrays.asList(filteredBreakpoints);
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint bp = breakpoints[i];
+ boolean oldContainedBp = fContainer.contains(bp);
+ boolean newContained = filteredAsList.contains(bp);
+ if (oldContainedBp && !newContained) {
+ removed.add(bp);
+ } else if (!oldContainedBp && newContained) {
+ added.add(bp);
+ }
+ }
+ if (!added.isEmpty()) {
+ breakpointsAdded((IBreakpoint[]) added.toArray(new IBreakpoint[added.size()]));
+ }
+ if (!removed.isEmpty()) {
+ breakpointsRemoved((IBreakpoint[]) removed.toArray(new IBreakpoint[removed.size()]));
+ }
+
+ ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ for (int i = 0; i < filteredBreakpoints.length; ++i)
+ appendModelDelta(fContainer, delta, IModelDelta.STATE, filteredBreakpoints[i]);
+ fireModelChanged(fInput, delta, "breakpointsChanged"); //$NON-NLS-1$
+ }
+
+
+ private void buildInstallDelta(ModelDelta delta, BreakpointContainer container) {
+ Object[] children = container.getChildren();
+ delta.setChildCount(children.length);
+ for (int i = 0; i < children.length; i++) {
+ ModelDelta childDelta = delta.addNode(children[i], i, IModelDelta.NO_CHANGE);
+ if (children[i] instanceof BreakpointContainer) {
+ buildInstallDelta(childDelta, (BreakpointContainer)children[i]);
+ } else if (children[i] instanceof IBreakpoint) {
+ childDelta.setFlags(IModelDelta.INSTALL);
+ }
+ }
+ }
+
+ /**
+ * Insert elements from the reference container to an existing container.
+ *
+ * @param container the existing container to insert the new elements.
+ * @param refContainer the reference container to compare elements that are added.
+ * @param containerDelta the delta of the existing container.
+ */
+ private IBreakpoint insertAddedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
+ IBreakpoint newBreakpoint = null;
+
+ Object[] children = container.getChildren();
+ Object[] refChildren = refContainer.getChildren();
+
+
+ for (int i = 0; i < refChildren.length; ++i) {
+ Object element = getElement(children, refChildren[i]);
+
+ // if a child of refContainer doesn't exist in container, than insert it to container
+ // - if the reference child is a container, than copy the reference child container to container
+ // - otherwise (Breakpoint), add the breakpoint to container
+ if (element == null) {
+ if (refChildren[i] instanceof BreakpointContainer) {
+ BreakpointContainer.addChildContainer(container, (BreakpointContainer) refChildren[i], containerDelta);
+ } else {
+ BreakpointContainer.addBreakpoint(container, (IBreakpoint) refChildren[i], containerDelta);
+ if (newBreakpoint == null)
+ newBreakpoint = (IBreakpoint) refChildren[i];
+ }
+
+ // if a child exist in container, than recursively search into container. And also update the organizer of
+ // of container to the one in the refContainer's child.
+ } else if (element instanceof BreakpointContainer) {
+ int index = Arrays.asList(children).indexOf(element);
+ ModelDelta childDelta = containerDelta.addNode(element, index, IModelDelta.STATE, -1);
+ BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildren[i]);
+ newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildren[i], childDelta);
+ childDelta.setChildCount(((BreakpointContainer) element).getChildren().length);
+ }
+ }
+
+ return newBreakpoint;
+ }
+
+ /**
+ * Delete elements from existing container that doesn't exist in the reference container.
+ *
+ * @param container the existing container to delete the removed elements.
+ * @param refContainer the reference container to compare elements that are removed.
+ * @param containerDelta the delta of the existing container.
+ */
+ private void deleteRemovedElements(BreakpointContainer container, BreakpointContainer refContainer, ModelDelta containerDelta) {
+ Object[] children = container.getChildren();
+ Object[] refChildren = refContainer.getChildren();
+
+ // if a child of container doesn't exist in refContainer, than remove it from container
+ for (int i = 0; i < children.length; ++i) {
+ Object element = getElement(refChildren, children[i]);
+
+ if (element == null) {
+ if (children[i] instanceof BreakpointContainer) {
+ BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta);
+ } else {
+ BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta);
+ }
+ } else if (element instanceof BreakpointContainer){
+
+ ModelDelta childDelta = containerDelta.addNode(children[i], IModelDelta.STATE);
+ deleteRemovedElements((BreakpointContainer) children[i], (BreakpointContainer) element, childDelta);
+ }
+ }
+ }
+
+ /**
+ * Get the element that is in the collection.
+ *
+ * @param collection the collection of elements.
+ * @param element the element to search.
+ * @return if element exist in collection, than it is returned, otherwise <code>null</code> is returned.
+ * @see insertAddedElements
+ * @see deleteRemovedElements
+ */
+ private Object getElement(Object[] collection, Object element) {
+ for (int i = 0; i < collection.length; ++i)
+ if (collection[i] instanceof BreakpointContainer && element instanceof BreakpointContainer) {
+ if (collection[i].equals(element))
+ return collection[i];
+ } else {
+ if (collection[i].equals(element))
+ return collection[i];
+ }
+ return null;
+ }
+
+ /**
+ * Create a root container.
+ *
+ * @param rootDelta the root delta.
+ * @param input the view input.
+ * @param organizers the breakpoint organizers.
+ * @param oldContainer the old container, use to determine whether a new breakpoint should be expanded.
+ * @param the breakpoint manager.
+ */
+ private BreakpointContainer createRootContainer(ModelDelta rootDelta, AbstractBreakpointManagerInput input,
+ IBreakpointOrganizer[] organizers, IBreakpointManager bpManager) {
+
+ IBreakpoint[] breakpoints = filterBreakpoints(input, bpManager.getBreakpoints());
+ BreakpointContainer container = new BreakpointContainer(organizers, fComparator);
+ container.initDefaultContainers(rootDelta);
+
+ for (int i = 0; i < breakpoints.length; ++i) {
+ container.addBreakpoint(breakpoints[i], rootDelta);
+ }
+
+ return container;
+ }
+ }
+
+ private class InputDataMap extends LinkedHashMap {
+ private static final long serialVersionUID = 1L;
+
+ public InputDataMap() {
+ super(1, (float)0.75, true);
+ }
+
+ protected boolean removeEldestEntry(java.util.Map.Entry arg0) {
+ InputData data = (InputData)arg0.getValue();
+ return size() > getMaxInputsCache() && data.fProxies.isEmpty();
+ }
+ }
+
+ private class PresentationContextListener implements IPropertyChangeListener {
+ final private IPresentationContext fContext;
+
+ PresentationContextListener(IPresentationContext context) {
+ fContext = context;
+ fContext.addPropertyChangeListener(this);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ contextPropertyChanged(fContext, event);
+ }
+ }
+
+ // debug flags
+ public static boolean DEBUG_BREAKPOINT_DELTAS = false;
+
+ static {
+ DEBUG_BREAKPOINT_DELTAS = DebugUIPlugin.DEBUG && "true".equals( //$NON-NLS-1$
+ Platform.getDebugOption("org.eclipse.debug.ui/debug/viewers/breakpointDeltas")); //$NON-NLS-1$
+ }
+
+ /**
+ * A map of input to info data cache
+ */
+ final private Map fInputToData = Collections.synchronizedMap(new InputDataMap());
+
+ /**
+ * A map of presetnation context listeners.
+ */
+ final private Map fContextListeners = Collections.synchronizedMap(new HashMap());
+
+ /**
+ * The breakpoint manager.
+ */
+ final private IBreakpointManager fBpManager;
+
+ /**
+ * Constructor.
+ */
+ protected AbstractBreakpointManagerContentProvider() {
+ fBpManager = DebugPlugin.getDefault().getBreakpointManager();
+ }
+
+ /**
+ * Sub-classes is required to implements this method to filter the breakpoints.
+ *
+ * @param input the breakpoint manager input.
+ * @param breakpoints the list of breakpoint to filter.
+ * @return the filtered list of breakpoint based on the input.
+ */
+ protected abstract IBreakpoint[] filterBreakpoints(AbstractBreakpointManagerInput input, IBreakpoint[] breakpoints);
+
+ /**
+ * Sub-classes is required to implements this method, to determine whether the breakpoint is supported by the selection.
+ *
+ * @param ss the selection of the debug elements.
+ * @param breakpoint the breakpoint.
+ * @return true if supported.
+ */
+ protected abstract boolean supportsBreakpoint(IStructuredSelection ss, IBreakpoint breakpoint);
+
+ /**
+ * Maximum number of breakpoint manager input objects that this provider
+ * will cache data for. This method is called once upon class creation
+ * when setting up the data cache. Sub-classes may override to provide
+ * a custom setting.
+ *
+ * @return Maximum data cache size
+ */
+ protected int getMaxInputsCache() {
+ return 2;
+ }
+
+ /**
+ * Handles the propety changed events in presentation contexts.
+ * Sub-classes may override to perform additional handling.
+ *
+ * @param context Presetnation context that was disposed.
+ */
+ protected void contextPropertyChanged(IPresentationContext context, PropertyChangeEvent event) {
+ if (IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS.equals(event.getProperty())) {
+ IBreakpointOrganizer[] organizers = (IBreakpointOrganizer[])event.getNewValue();
+ InputData[] contextDatas = getContextInputDatas(context);
+ for (int i = 0; i < contextDatas.length; i++) {
+ contextDatas[i].setOrganizers(organizers);
+ }
+ }
+ else if (IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION.equals(event.getProperty())) {
+ IStructuredSelection selection = (IStructuredSelection)event.getNewValue();
+ InputData[] contextDatas = getContextInputDatas(context);
+ for (int i = 0; i < contextDatas.length; i++) {
+ contextDatas[i].setFilterSelection(selection);
+ }
+ }
+ }
+
+ private InputData[] getContextInputDatas(IPresentationContext context) {
+ List list = new ArrayList(fInputToData.size());
+ synchronized (fInputToData) {
+ for (Iterator itr = fInputToData.values().iterator(); itr.hasNext();) {
+ InputData data = (InputData)itr.next();
+ if (context.equals( data.fInput.getContext() )) {
+ list.add(data);
+ }
+ }
+ }
+ return (InputData[]) list.toArray(new InputData[list.size()]);
+ }
+
+ /**
+ * Handles the event when a presentation context is dispoed.
+ * Sub-classes may override to perform additional cleanup.
+ *
+ * @param context Presetnation context that was disposed.
+ */
+ protected void contextDisposed(IPresentationContext context) {
+ synchronized (fInputToData) {
+ for (Iterator itr = fInputToData.entrySet().iterator(); itr.hasNext();) {
+ Map.Entry entry = (Map.Entry)itr.next();
+ IPresentationContext entryContext = ((AbstractBreakpointManagerInput)entry.getKey()).getContext();
+ if (context.equals(entryContext)) {
+ itr.remove();
+ }
+ }
+ }
+
+ // Remove the context listener.
+ PresentationContextListener listener = (PresentationContextListener)fContextListeners.remove(context);
+ if (listener != null) {
+ context.removePropertyChangeListener(listener);
+ }
+ }
+
+ /**
+ * Register the breakpoint manager input with this content provider.
+ *
+ * @param input the breakpoint manager input to register.
+ * @param proxy the model proxy of the input.
+ * @param organizers the breakpoint organizer, can be <code>null</code>.
+ * @param selectionFilter the selection filter, can be <code>null</code>.
+ * @param comparator the element comparator.
+ */
+ public void registerModelProxy(AbstractBreakpointManagerInput input, AbstractModelProxy proxy) {
+ if (fInputToData.isEmpty()) {
+ fBpManager.addBreakpointListener(this);
+ }
+
+ getInputData(input).proxyInstalled(proxy);
+ }
+
+ /**
+ * Unregister the breakpoint manager input with this content provider.
+ *
+ * @param input the breakpoint manager input to unregister.
+ */
+ public void unregisterModelProxy(AbstractBreakpointManagerInput input, AbstractModelProxy proxy) {
+ getInputData(input).proxyDisposed(proxy);
+
+ if (fInputToData.isEmpty()) {
+ fBpManager.removeBreakpointListener(this);
+ }
+ }
+
+ private InputData getInputData(AbstractBreakpointManagerInput input) {
+ InputData data = null;
+ synchronized (fInputToData) {
+ data = (InputData)fInputToData.get(input);
+ if (data == null) {
+ data = new InputData(input);
+ fInputToData.put(input, data);
+ }
+ }
+
+ // Also make sure that we're listening to the presentation context properties
+ synchronized (fContextListeners) {
+ IPresentationContext context = input.getContext();
+ if ( !Boolean.TRUE.equals(context.getProperty(IPresentationContext.PROPERTY_DISPOSED)) &&
+ !fContextListeners.containsKey(context) )
+ {
+ fContextListeners.put(context, new PresentationContextListener(context));
+ }
+ }
+
+ return data;
+ }
+
+ /**
+ * Returns the model proxy for the input.
+ *
+ * @param input the input.
+ * @return the model proxy.
+ */
+ private List getModelProxies(AbstractBreakpointManagerInput input) {
+ InputData data = getInputData(input);
+ return data != null ? data.fProxies : null;
+ }
+
+ /**
+ * Returns the selection filter for the input.
+ *
+ * @param input the selection.
+ */
+ protected IStructuredSelection getSelectionFilter(Object input) {
+ if (input instanceof AbstractBreakpointManagerInput) {
+ return (IStructuredSelection) ((AbstractBreakpointManagerInput)input).getContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION);
+ }
+ return null;
+ }
+
+ /**
+ * Fire model change event for the input.
+ *
+ * @param input the input.
+ * @param delta the model delta.
+ * @param debugReason the debug string.
+ */
+ protected void fireModelChanged(AbstractBreakpointManagerInput input, IModelDelta delta, String debugReason) {
+ List proxies = getModelProxies(input);
+
+ if (DEBUG_BREAKPOINT_DELTAS && proxies.size() > 0) {
+ System.out.println("FIRE BREAKPOINT DELTA (" + debugReason + ")\n" + delta.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ for (int i = 0; i < proxies.size(); i++) {
+ ((AbstractModelProxy)proxies.get(i)).fireModelChanged(delta);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String)
+ */
+ protected boolean supportsContextId(String id) {
+ return id.equals(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
+ */
+ protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
+ Object input = monitor.getViewerInput();
+ if (input instanceof AbstractBreakpointManagerInput) {
+ AbstractBreakpointManagerInput bpManagerInput = (AbstractBreakpointManagerInput)input;
+ return getInputData(bpManagerInput).fContainer.getChildren().length;
+ }
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @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 {
+ Object input = monitor.getViewerInput();
+ if (input instanceof AbstractBreakpointManagerInput) {
+ AbstractBreakpointManagerInput bpManagerInput = (AbstractBreakpointManagerInput)input;
+ Object[] children = getInputData(bpManagerInput).fContainer.getChildren();
+ return getElements(children, index, length);
+ }
+
+ return EMPTY;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsAdded(org.eclipse.debug.core.model.IBreakpoint[])
+ */
+ public void breakpointsAdded(IBreakpoint[] breakpoints) {
+ InputData[] datas = (InputData[])fInputToData.values().toArray(new InputData[0]);
+ for (int i = 0; i < datas.length; i++) {
+ datas[i].breakpointsAdded(breakpoints);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsRemoved(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[])
+ */
+ public void breakpointsRemoved(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
+ InputData[] datas = (InputData[])fInputToData.values().toArray(new InputData[0]);
+ for (int i = 0; i < datas.length; i++) {
+ datas[i].breakpointsRemoved(breakpoints);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsChanged(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[])
+ */
+ public void breakpointsChanged(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
+ InputData[] datas = (InputData[])fInputToData.values().toArray(new InputData[0]);
+ for (int i = 0; i < datas.length; i++) {
+ datas[i].breakpointsChanged(breakpoints);
+ }
+ }
+ /**
+ * Appends the model delta flags to child containers that contains the breakpoint.
+ *
+ * @param parent the parent container.
+ * @param parentDelta the parent model delta.
+ * @param flags the model delta flags.
+ * @param breakpoint the breakpoint to search in the children containers.
+ */
+ private void appendModelDelta(BreakpointContainer parent, ModelDelta parentDelta, int flags, IBreakpoint breakpoint) {
+ BreakpointContainer[] containers = parent.getContainers();
+
+ if (parent.contains(breakpoint)) {
+ if ((containers.length != 0)) {
+ for (int i = 0; i < containers.length; ++i) {
+ ModelDelta nodeDelta = parentDelta.addNode(containers[i], flags);
+ appendModelDelta(containers[i], nodeDelta, flags, breakpoint);
+ }
+ } else {
+ parentDelta.addNode(breakpoint, flags);
+ }
+ }
+ }
+
+ /**
+ * Appends the model delta to the first found element in the model delta tree.
+ *
+ * @param parentDelta the parent delta
+ * @param element the element to search
+ * @param flags the delta flags
+ */
+ private void appendModelDeltaToElement(IModelDelta parentDelta, Object element, int flags) {
+ if (element.equals(parentDelta.getElement())) {
+ ((ModelDelta) parentDelta).setFlags(parentDelta.getFlags() | flags);
+ return;
+ }
+
+ IModelDelta[] childDeltas = parentDelta.getChildDeltas();
+ for (int i = 0; i < childDeltas.length; ++i) {
+ if (element.equals(childDeltas[i].getElement())) {
+ ((ModelDelta) childDeltas[i]).setFlags(childDeltas[i].getFlags() | flags);
+ return;
+ }
+
+ appendModelDeltaToElement(childDeltas[i], element, flags);
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
new file mode 100644
index 000000000..7d0ac7405
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerLabelProvider.java
@@ -0,0 +1,156 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.CompositeDebugImageDescriptor;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.model.IWorkbenchAdapter2;
+
+/**
+ * Breakpoint container label provider.
+ *
+ * @since 3.6
+ */
+public class BreakpointContainerLabelProvider extends DebugElementLabelProvider {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider#getImageDescriptor(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String)
+ */
+ protected ImageDescriptor getImageDescriptor(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
+ ImageDescriptor desc = super.getImageDescriptor(elementPath, presentationContext, columnId);
+ int flags = computeAdornmentFlags();
+
+ if (flags > 0) {
+ Image image = DebugUIPlugin.getImageDescriptorRegistry().get(desc);
+ CompositeDebugImageDescriptor compDesc = new CompositeDebugImageDescriptor(image, flags);
+ return compDesc;
+ }
+ return desc;
+ }
+
+ /*
+ * (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 {
+ Object lastSegment = path.getLastSegment();
+ if (lastSegment instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) lastSegment;
+ IBreakpoint[] breakpoints = container.getBreakpoints();
+ for (int i = 0; i < breakpoints.length; ++i) {
+ if (breakpoints[i].isEnabled()) return true;
+ }
+
+ return false;
+ }
+
+ return super.getChecked(path, presentationContext);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementLabelProvider#getGrayed(org.eclipse.jface.viewers.TreePath, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ public boolean getGrayed(TreePath path, IPresentationContext presentationContext) throws CoreException {
+ Object lastSegment = path.getLastSegment();
+ if (lastSegment instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) lastSegment;
+ IBreakpoint[] breakpoints = container.getBreakpoints();
+
+ // Return true, gray if some breakpoints are enabled and some are disabled.
+ // return false if all breakpoints are either disabled or all are enabled.
+ boolean hasEnabled = false;
+ boolean hasDisabled = false;
+
+ for (int i = 0; i < breakpoints.length; ++i) {
+ if (breakpoints[i].isEnabled()) {
+ hasEnabled = true;
+ } else {
+ hasDisabled = true;
+ }
+
+ if (hasEnabled && hasDisabled) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ return super.getGrayed(path, presentationContext);
+ }
+
+ // Forward font data requests to the workbench adapter
+ protected FontData getFontData(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
+ Object element = elementPath.getLastSegment();
+ FontData fontData = super.getFontData(elementPath, presentationContext, columnId);
+ if (fontData == null && element instanceof IAdaptable) {
+
+ IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ fontData = adapter.getFont(element);
+ }
+ }
+ return fontData;
+ }
+
+ // Forward foreground color requests to the workbench adapter
+ protected RGB getForeground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
+ Object element = elementPath.getLastSegment();
+ RGB rgb = super.getForeground(elementPath, presentationContext, columnId);
+ if (rgb == null && element instanceof IAdaptable) {
+
+ IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ rgb = adapter.getForeground(element);
+ }
+ }
+ return rgb;
+ }
+
+ // Forward background color requests to the workbench adapter
+ protected RGB getBackground(TreePath elementPath, IPresentationContext presentationContext, String columnId) throws CoreException {
+ Object element = elementPath.getLastSegment();
+ RGB rgb = super.getBackground(elementPath, presentationContext, columnId);
+ if (rgb == null && element instanceof IAdaptable) {
+
+ IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) ((IAdaptable)element).getAdapter(IWorkbenchAdapter2.class);
+ if (adapter != null) {
+ rgb = adapter.getBackground(element);
+ }
+ }
+ return rgb;
+ }
+
+ /**
+ * Computes and return common adornment flags for the given category.
+ *
+ * @param element breakpoint category
+ * @return adornment flags defined in CompositeDebugImageDescriptor
+ */
+ private int computeAdornmentFlags() {
+ if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
+ return CompositeDebugImageDescriptor.SKIP_BREAKPOINT;
+ }
+ return 0;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java
new file mode 100644
index 000000000..aaa5a05f3
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContainerMementoProvider.java
@@ -0,0 +1,53 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+/**
+ * This class provides memento for the breakpoint container.
+ *
+ * @since 3.6
+ */
+public class BreakpointContainerMementoProvider extends DebugElementMementoProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider#getElementName(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ protected String getElementName(Object element, IPresentationContext context) throws CoreException {
+ if (element instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) element;
+ IAdaptable category = container.getCategory();
+ if (category != null) {
+ IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ return adapter.getLabel(category);
+ }
+ return container.getOrganizer().getLabel();
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider#isEqual(java.lang.Object, org.eclipse.ui.IMemento, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ protected boolean supportsContextId(String id) {
+ return IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContentProvider.java
new file mode 100644
index 000000000..c66ac4bac
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointContentProvider.java
@@ -0,0 +1,46 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Breakpoint content provider.
+ *
+ * @since 3.6
+ */
+public class BreakpointContentProvider extends ElementContentProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
+ */
+ protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @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 {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String)
+ */
+ protected boolean supportsContextId(String id) {
+ return id.equals(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java
new file mode 100644
index 000000000..6659e00c7
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.jface.viewers.TreePath;
+
+/**
+ * Breakpoint label provider.
+ *
+ * @since 3.6
+ */
+public class BreakpointLabelProvider extends DebugElementLabelProvider {
+
+ /*
+ * (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 {
+ Object lastSegment = path.getLastSegment();
+ if (lastSegment instanceof IBreakpoint) {
+ return ((IBreakpoint) lastSegment).isEnabled();
+ }
+
+ return false;
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
new file mode 100644
index 000000000..23cb0ad6e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java
@@ -0,0 +1,108 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.internal.ui.elements.adapters.AbstractBreakpointManagerInput;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * Breakpoint manager content provider.
+ *
+ * @since 3.6
+ */
+public class BreakpointManagerContentProvider extends AbstractBreakpointManagerContentProvider {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.AbstractBreakpointManagerContentProvider#supportsBreakpoint(org.eclipse.jface.viewers.IStructuredSelection, org.eclipse.debug.core.model.IBreakpoint)
+ */
+ protected boolean supportsBreakpoint(IStructuredSelection ss, IBreakpoint breakpoint) {
+ return supportsBreakpoint(getDebugTargets(ss), breakpoint);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.AbstractBreakpointManagerContentProvider#filterBreakpointsByInput(org.eclipse.debug.internal.ui.elements.adapters.AbstractBreakpointManagerInput, org.eclipse.debug.core.model.IBreakpoint[])
+ */
+ protected IBreakpoint[] filterBreakpoints(AbstractBreakpointManagerInput input, IBreakpoint[] breakpoints) {
+ ArrayList retVal = new ArrayList();
+
+ IStructuredSelection selectionFilter = getSelectionFilter(input);
+ List targets = getDebugTargets(selectionFilter);
+
+ if (targets != null) {
+ for (int i = 0; i < breakpoints.length; ++i) {
+ if (supportsBreakpoint(targets, breakpoints[i]))
+ retVal.add(breakpoints[i]);
+ }
+ } else {
+ return breakpoints;
+ }
+
+ return (IBreakpoint[]) retVal.toArray(new IBreakpoint[retVal.size()]);
+ }
+
+ /**
+ * Returns true if the breakpoint contains in one of the targets.
+ *
+ * @param targets a list of <code>IDebugTarget</code> objects.
+ * @param breakpoint the breakpoint.
+ * @return true if breakpoint contains in the list of targets.
+ */
+ protected boolean supportsBreakpoint(List targets, IBreakpoint breakpoint) {
+ boolean exist = targets.size() == 0 ? true : false;
+ for (int i = 0; !exist && i < targets.size(); ++i) {
+ IDebugTarget target = (IDebugTarget) targets.get(i);
+ exist |= target.supportsBreakpoint(breakpoint);
+ }
+ return exist;
+ }
+
+ /**
+ * Returns the list of IDebugTarget for the selection.
+ *
+ * @param ss the selection.
+ * @return list of IDebugTarget object.
+ */
+ protected List getDebugTargets(IStructuredSelection ss) {
+ List debugTargets = new ArrayList(2);
+ if (ss != null) {
+ Iterator i = ss.iterator();
+ while (i.hasNext()) {
+ Object next = i.next();
+ if (next instanceof IDebugElement) {
+ debugTargets.add(((IDebugElement)next).getDebugTarget());
+ } else if (next instanceof ILaunch) {
+ IDebugTarget[] targets = ((ILaunch)next).getDebugTargets();
+ for (int j = 0; j < targets.length; j++) {
+ debugTargets.add(targets[j]);
+ }
+ } else if (next instanceof IProcess) {
+ IDebugTarget target = (IDebugTarget)((IProcess)next).getAdapter(IDebugTarget.class);
+ if (target != null) {
+ debugTargets.add(target);
+ }
+ }
+ }
+ }
+ return debugTargets;
+ }
+
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerInputMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerInputMementoProvider.java
new file mode 100644
index 000000000..672a91ea9
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerInputMementoProvider.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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.ui.IDebugUIConstants;
+
+/**
+ * Breakpoint manager input memento provider.
+ *
+ * @since 3.6
+ */
+public class BreakpointManagerInputMementoProvider extends DebugElementMementoProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider#getElementName(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ protected String getElementName(Object element, IPresentationContext context) throws CoreException {
+ return "BreakpointInputMemento"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider#isEqual(java.lang.Object, org.eclipse.ui.IMemento, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ protected boolean supportsContextId(String id) {
+ return IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java
new file mode 100644
index 000000000..ae3cbc083
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointMementoProvider.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Freescale Semiconductor 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:
+ * 2009 Freescale - initial API and implementation (Bug 238956)
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.model.elements;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.ui.IMemento;
+
+/**
+ * Memento provider for breakpoints
+ *
+ * @since 3.6
+ */
+public class BreakpointMementoProvider extends ElementMementoProvider {
+
+ /**
+ * Marker ID. Stored as string in order to support the full range of the long type.
+ */
+ private static final String MARKER_ID = "MARKER_ID"; //$NON-NLS-1$
+
+ /**
+ * Full path from the workspace to the resource referred to by the breakpoint marker.
+ *
+ * Stored as String.
+ */
+ private static final String RESOURCE_PATH = "RESOURCE_PATH"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.DebugElementMementoProvider#supportsContextId(java.lang.String)
+ */
+ protected boolean supportsContextId(String id) {
+ return IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider#encodeElement(java.lang.Object, org.eclipse.ui.IMemento, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ protected boolean encodeElement(Object element, IMemento memento, IPresentationContext context) throws CoreException {
+ if (element instanceof IBreakpoint) {
+
+ IMarker marker = ((IBreakpoint)element).getMarker();
+ if (marker != null) {
+
+ long markerId = marker.getId();
+ memento.putString(MARKER_ID, Long.toString(markerId));
+
+ IPath fullPath = marker.getResource().getFullPath();
+ String path = fullPath.toString();
+ memento.putString(RESOURCE_PATH, path);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementMementoProvider#isEqual(java.lang.Object, org.eclipse.ui.IMemento, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext)
+ */
+ protected boolean isEqual(Object element, IMemento memento, IPresentationContext context) throws CoreException {
+ if (element instanceof IBreakpoint) {
+ IBreakpoint breakpoint =(IBreakpoint)element;
+ IMarker marker = breakpoint.getMarker();
+
+ long markerId = marker.getId();
+ String mementoMarkerId = memento.getString(MARKER_ID);
+ if (!Long.toString(markerId).equals(mementoMarkerId)) {
+ return false;
+ }
+
+ IPath fullPath = marker.getResource().getFullPath();
+ String path = fullPath.toString();
+ String mementoPath = memento.getString(RESOURCE_PATH);
+ if (!path.equals(mementoPath)) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
index 971aa7fb7..8e781096a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
* Wind River Systems - Pawel Piech - Added Modules view (bug 211158)
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.preferences;
@@ -91,6 +92,7 @@ public interface IDebugPreferenceConstants {
public static final String EXPRESSIONS_DETAIL_PANE_ORIENTATION = "Expressions.detail.orientation"; //$NON-NLS-1$
public static final String REGISTERS_DETAIL_PANE_ORIENTATION = "Registers.detail.orientation"; //$NON-NLS-1$
public static final String MODULES_DETAIL_PANE_ORIENTATION = "Modules.detail.orientation"; //$NON-NLS-1$
+ public static final String BREAKPOINTS_DETAIL_PANE_ORIENTATION = "Breakpoints.detail.orientation"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_RIGHT = "Variables.detail.orientation.right"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_UNDERNEATH = "Variables.detail.orientation.underneath"; //$NON-NLS-1$
public static final String VARIABLES_DETAIL_PANE_HIDDEN = "Variables.detail.orientation.hidden"; //$NON-NLS-1$
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 ae1f0939c..4016d7da8 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
@@ -1091,6 +1091,14 @@ public class InternalTreeModelViewer extends TreeViewer
item.setBackground(i, (Color) backgrounds[i]);
}
}
+ Boolean checked = (Boolean) item.getData(PREV_CHECKED_KEY);
+ if (checked != null) {
+ item.setChecked(checked.booleanValue());
+ }
+ Boolean grayed = (Boolean) item.getData(PREV_GRAYED_KEY);
+ if (grayed != null) {
+ item.setGrayed(grayed.booleanValue());
+ }
}
/* (non-Javadoc)
@@ -2064,6 +2072,8 @@ public class InternalTreeModelViewer extends TreeViewer
static String PREV_FONT_KEY = "PREV_FONT_KEY"; //$NON-NLS-1$
static String PREV_FOREGROUND_KEY = "PREV_FOREGROUND_KEY"; //$NON-NLS-1$
static String PREV_BACKGROUND_KEY = "PREV_BACKGROUND_KEY"; //$NON-NLS-1$
+ static String PREV_CHECKED_KEY = "PREV_CHECKED_KEY"; //$NON-NLS-1$
+ static String PREV_GRAYED_KEY = "PREV_GRAYED_KEY"; //$NON-NLS-1$
public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] imageDescriptors,
FontData[] fontDatas, RGB[] _foregrounds, RGB[] _backgrounds)
@@ -2422,6 +2432,8 @@ public class InternalTreeModelViewer extends TreeViewer
// if the listen rejects the change or there is not ICheckboxModelProxy, than revert the check state
if (!accepted) {
item.setChecked(!checked);
+ } else {
+ item.setData(PREV_CHECKED_KEY, new Boolean(checked));
}
} else {
((TreeModelContentProvider) contentProvider).cancelRestore(path, IModelDelta.SELECT);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ModelContentProvider.java
index 4d097f431..0c3ec09fe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/ModelContentProvider.java
@@ -490,8 +490,7 @@ abstract class ModelContentProvider implements IContentProvider, IModelChangedLi
final ModelDelta stateDelta = (ModelDelta) fViewerStates.get(keyMementoString);
if (stateDelta != null) {
if (DEBUG_STATE_SAVE_RESTORE
- && (DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(getPresentationContext()
- .getId()))) {
+ && (DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(getPresentationContext().getId()))) {
System.out.println("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - MATCHING STATE FOUND"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -524,9 +523,7 @@ abstract class ModelContentProvider implements IContentProvider, IModelChangedLi
job.setSystem(true);
job.schedule();
} else {
- if (DEBUG_STATE_SAVE_RESTORE
- && (DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(getPresentationContext()
- .getId()))) {
+ if (DEBUG_STATE_SAVE_RESTORE && (DEBUG_PRESENTATION_ID == null || DEBUG_PRESENTATION_ID.equals(getPresentationContext().getId()))) {
System.out.println("STATE RESTORE INPUT COMARE ENDED : " + fRequest + " - NO MATCHING STATE"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -1293,7 +1290,8 @@ abstract class ModelContentProvider implements IContentProvider, IModelChangedLi
return proxy;
}
- proxy = (IModelProxy) fModelProxies.get(path.getLastSegment());
+ Object element = path.getSegmentCount() == 0 ? getViewer().getInput() : path.getLastSegment();
+ proxy = (IModelProxy) fModelProxies.get(element);
if (proxy != null) {
return proxy;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
index 4da98b87c..e24ecc3cb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/provisional/ViewerInputService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -24,6 +24,18 @@ import org.eclipse.debug.internal.ui.viewers.model.ViewerInputUpdate;
*/
public class ViewerInputService {
+ /**
+ * An input object which will yield a null input element.
+ *
+ * @since 3.6
+ */
+ public final static Object NULL_INPUT = new IViewerInputProvider() {
+ public void update(IViewerInputUpdate update) {
+ update.setInputElement(null);
+ update.done();
+ }
+ };
+
// previous update request, cancelled when a new request comes in
private IViewerInputUpdate fPendingUpdate = null;
@@ -70,7 +82,7 @@ public class ViewerInputService {
}
if (provdier == null) {
fPendingUpdate.setInputElement(source);
- fRequestor.viewerInputComplete(fPendingUpdate);
+ fPendingUpdate.done();
} else {
provdier.update(fPendingUpdate);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java
new file mode 100644
index 000000000..2f5113440
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointContainerProxy.java
@@ -0,0 +1,57 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.viewers.update;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+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;
+
+/**
+ * Breakpoint container model proxy.
+ *
+ * @since 3.6
+ */
+public class BreakpointContainerProxy extends AbstractModelProxy implements ICheckboxModelProxy {
+
+ /**
+ * The breakpoint container
+ */
+ private IBreakpointContainer fContainer;
+
+ /**
+ * Constructor.
+ *
+ * @param container the breakpoint container.
+ */
+ public BreakpointContainerProxy(IBreakpointContainer container) {
+ fContainer = container;
+ }
+
+ /* (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) {
+ boolean atLeastOne = false;
+ IBreakpoint[] breakpoints = fContainer.getBreakpoints();
+ for (int i = 0; i < breakpoints.length; ++i) {
+ try {
+ breakpoints[i].setEnabled(checked);
+ atLeastOne = true;
+ } catch (CoreException e) {}
+ }
+ return atLeastOne;
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
new file mode 100644
index 000000000..29a72545c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointManagerProxy.java
@@ -0,0 +1,78 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.viewers.update;
+
+import org.eclipse.debug.internal.ui.elements.adapters.AbstractBreakpointManagerInput;
+import org.eclipse.debug.internal.ui.model.elements.AbstractBreakpointManagerContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.ViewerAdapterService;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Breakpoint manager model proxy.
+ *
+ * @since 3.6
+ */
+public class BreakpointManagerProxy extends AbstractModelProxy {
+ /**
+ * The breakpoint manager content provider for this model proxy
+ */
+ protected AbstractBreakpointManagerContentProvider fProvider;
+
+ /**
+ * The breakpoint manager input for this model proxy
+ */
+ protected AbstractBreakpointManagerInput fInput;
+
+ /**
+ * Constructor.
+ *
+ * @param input the breakpoint manager input
+ * @param context the presentation context for this model proxy
+ */
+ public BreakpointManagerProxy(Object input, IPresentationContext context) {
+ super();
+
+ if (input instanceof AbstractBreakpointManagerInput) {
+ fInput = (AbstractBreakpointManagerInput) input;
+
+ // cache the required data and pass to the provider when this model is installed
+ IElementContentProvider provider = ViewerAdapterService.getContentProvider(input);
+ if (provider instanceof AbstractBreakpointManagerContentProvider) {
+ fProvider = (AbstractBreakpointManagerContentProvider) provider;
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#installed(org.eclipse.jface.viewers.Viewer)
+ */
+ public void installed(Viewer viewer) {
+ super.installed(viewer);
+ if (fProvider != null) {
+ fProvider.registerModelProxy(fInput, this);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.viewers.provisional.AbstractModelProxy#dispose()
+ */
+ public synchronized void dispose() {
+ if (fProvider != null) {
+ fProvider.unregisterModelProxy(fInput, this);
+ }
+ super.dispose();
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointProxy.java
new file mode 100644
index 000000000..b4308d6c8
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/BreakpointProxy.java
@@ -0,0 +1,53 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.viewers.update;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+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;
+
+/**
+ * Breakpoint model proxy.
+ *
+ * @since 3.6
+ */
+public class BreakpointProxy extends AbstractModelProxy implements ICheckboxModelProxy {
+
+ /**
+ * Breakpoint object
+ */
+ protected IBreakpoint fBreakpoint;
+
+ /**
+ * Constructor.
+ *
+ * @param breakpoint the breakpoint for this model proxy
+ */
+ public BreakpointProxy(IBreakpoint breakpoint) {
+ fBreakpoint = breakpoint;
+ }
+
+ /* (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) {
+ try {
+ fBreakpoint.setEnabled(checked);
+ return fBreakpoint.isEnabled() == checked;
+ } catch (CoreException e) {
+ return false;
+ }
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java
index 7892f6641..26f0ea3f9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/update/DefaultModelProxyFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 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
@@ -7,12 +7,14 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.viewers.update;
import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IMemoryBlock;
@@ -20,6 +22,8 @@ import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IWatchExpression;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.elements.adapters.DefaultBreakpointManagerInput;
import org.eclipse.debug.internal.ui.memory.provisional.AbstractAsyncTableRendering;
import org.eclipse.debug.internal.ui.memory.provisional.MemoryViewPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelProxy;
@@ -70,6 +74,15 @@ public class DefaultModelProxyFactory implements IModelProxyFactory {
if (element instanceof IMemoryBlockRetrieval)
return new MemoryRetrievalProxy((IMemoryBlockRetrieval)element);
}
+ if (IDebugUIConstants.ID_BREAKPOINT_VIEW.equals(id)) {
+ if (element instanceof DefaultBreakpointManagerInput) {
+ return new BreakpointManagerProxy(element, context);
+ } else if (element instanceof IBreakpoint) {
+ return new BreakpointProxy((IBreakpoint)element);
+ } else if (element instanceof IBreakpointContainer) {
+ return new BreakpointContainerProxy((IBreakpointContainer)element);
+ }
+ }
if (context instanceof MemoryViewPresentationContext)
{
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
index 5de6573a6..599a12b8b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -33,6 +33,7 @@ public class DebugUIViewsMessages extends NLS {
public static String BreakpointsView_0;
public static String BreakpointsView_10;
public static String BreakpointsView_11;
+ public static String BreakpointsView_12;
public static String BreakpointsView_1;
public static String BreakpointWorkingSetPage_0;
public static String BreakpointWorkingSetPage_1;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties
index dfbf22b8d..9eacb2459 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/DebugUIViewsMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2006 IBM Corporation and others.
+# Copyright (c) 2000, 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
@@ -27,6 +27,7 @@ BreakpointsView_9=disable
BreakpointsView_0=Enable Breakpoint
BreakpointsView_10=Error {0} Breakpoint
BreakpointsView_11=An exception occurred while attempting to {0} the breakpoint.
+BreakpointsView_12=Breakpoints View Only
BreakpointsView_1=Disable Breakpoint
BreakpointWorkingSetPage_0=Breakpoint Working Set
BreakpointWorkingSetPage_1=Enter a working set name and select breakpoints.
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
index 9e20fb5ce..dd7f9096b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java
@@ -7,93 +7,511 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
+ *****************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
+import java.util.Arrays;
+import java.util.Iterator;
import java.util.List;
-import java.util.Map;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
+import org.eclipse.debug.internal.ui.model.elements.ElementContentProvider;
+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.IViewerUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+import org.eclipse.debug.ui.IDebugUIConstants;
/**
- * A container of breakpoints, based on a category.
+ * This class contains the list of container or a list of breakpoint, elements are sorted according to rules
+ * in the comparator.
*/
-public class BreakpointContainer extends PlatformObject {
-
+public class BreakpointContainer extends ElementContentProvider implements IAdaptable, IBreakpointContainer {
+ /**
+ * Child breakpoints - inserting new element into this collection should use the insertBreakpoint method
+ */
+ final private List fBreakpoints = new ArrayList();
+
+ /**
+ * Child containers - inserting new element into this container should use the insertChildContainer method
+ */
+ final private List fChildContainers = new ArrayList();
+
+ /**
+ * The category for this container
+ */
private IAdaptable fCategory;
+
+ /**
+ * The breakpoint organizer for this container
+ */
private IBreakpointOrganizer fOrganizer;
- private List fBreakpoints;
- private Map fCategoriesToContainers;
+
+ /**
+ * The nested breakpoint organizer
+ */
private IBreakpointOrganizer[] fNesting;
/**
- * Constructs a container of breakpoints for the given category,
- * created by the given organizer.
- *
- * @param category breakpoint category
- * @param organizer breakpoint organizer
- * @param nesting nested organizers or <code>null</code> if none
- */
- public BreakpointContainer(IAdaptable category, IBreakpointOrganizer organizer, IBreakpointOrganizer[] nesting) {
- fCategory = category;
- fOrganizer = organizer;
- fBreakpoints = new ArrayList();
- fNesting = nesting;
- fCategoriesToContainers = new HashMap();
- // seed with all nested categories
- if (nesting != null && nesting.length > 0) {
- IAdaptable[] emptyCategories = nesting[0].getCategories();
- if (emptyCategories != null) {
- for (int i = 0; i < emptyCategories.length; i++) {
- IAdaptable empty = emptyCategories[i];
- BreakpointContainer container = (BreakpointContainer) fCategoriesToContainers.get(empty);
- if (container == null) {
- IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[nesting.length - 1];
- System.arraycopy(nesting, 1, siblings, 0, siblings.length);
- container = new BreakpointContainer(empty, nesting[0], siblings);
- fCategoriesToContainers.put(empty, container);
- }
- }
- }
- }
+ * A flag to indicate this is the default container
+ */
+ private boolean fDefaultContainer;
+
+ /**
+ * Parent container
+ */
+ private BreakpointContainer fParent;
+
+ /**
+ * The comparator, will be use to compare the order for inserting new element into this container
+ */
+ private ElementComparator fComparator;
+
+ /**
+ * Constructor, intended to be call when creating the root container.
+ *
+ * @param organizers the breakpoint organizer for this container
+ * @param comparator the element comparator, can be <code>null</code>. If <code>null</code> than new element
+ * will be added to the end of the list.
+ */
+ public BreakpointContainer(IBreakpointOrganizer[] organizers, ElementComparator comparator) {
+ fNesting = organizers;
+ fComparator = comparator;
+ }
+
+ /**
+ * Constructor, intended to be call within this class only.
+ *
+ * @param parent the parent breakpoint container
+ * @param category the category for this container
+ * @param organizer the organizer for this container
+ * @param comparator the element comparator
+ * @param nesting the nested breakpoint organizer
+ */
+ private BreakpointContainer(BreakpointContainer parent, IAdaptable category, IBreakpointOrganizer organizer,
+ ElementComparator comparator, IBreakpointOrganizer[] nesting) {
+ this(category, organizer, nesting);
+ fParent = parent;
+ fComparator = comparator;
+ }
+
+ /**
+ * Constructor, intended to be call when reorganizing the content.
+ *
+ * @param category the breakpoint category
+ * @param organizer the breakpoint organizer
+ * @param nesting the nested breakpoint organizer
+ */
+ BreakpointContainer(IAdaptable category, IBreakpointOrganizer organizer, IBreakpointOrganizer[] nesting) {
+ fCategory = category;
+ fOrganizer = organizer;
+ fNesting = nesting;
+ }
+
+ /**
+ * Initialize the default containers.
+ *
+ * @param parentDelta the parent delta, addition child delta will be added to the parent
+ */
+ public void initDefaultContainers(ModelDelta parentDelta) {
+ // seed with all nested categories
+ if (fNesting != null && fNesting.length > 0) {
+ IAdaptable[] emptyCategories = fNesting[0].getCategories();
+ if (emptyCategories != null) {
+ for (int i = 0; i < emptyCategories.length; i++) {
+ IAdaptable empty = emptyCategories[i];
+ BreakpointContainer container = findExistingContainer(fChildContainers, empty);
+ if (container == null) {
+ IBreakpointOrganizer[] siblings = new IBreakpointOrganizer[fNesting.length - 1];
+ System.arraycopy(fNesting, 1, siblings, 0, siblings.length);
+ container = new BreakpointContainer(this, empty, fNesting[0], fComparator, siblings);
+ insertChildContainer(container);
+ container.fDefaultContainer = true;
+
+ int size = container.getChildren().length;
+ parentDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSTALL|IModelDelta.ADDED|IModelDelta.EXPAND, size);
+
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Insert the breakpoint to this container.
+ *
+ * @param breakpoint the new breakpoint
+ * @return the index of the breakpoint in the cache, -1 if the breakpoint already exist
+ */
+ private int insertBreakpoint(IBreakpoint breakpoint) {
+ if (fBreakpoints.contains(breakpoint))
+ return -1;
+
+ int index = fBreakpoints.size();
+ for (; fComparator != null && index > 0; index--) {
+ if (fComparator.compare(fBreakpoints.get(index-1), breakpoint) < 0)
+ break;
+ }
+
+ if (index < 0)
+ index = 0;
+ fBreakpoints.add(index, breakpoint);
+
+ return index;
+ }
+
+ /**
+ * Insert the child container this container.
+ *
+ * @param container the child container
+ * @return the index of the container in the cache, -1 if the child container already exist
+ */
+ private int insertChildContainer(BreakpointContainer container) {
+ int index = fChildContainers.size();
+ for (; fComparator != null && index > 0; index--) {
+ if (fComparator.compare(fChildContainers.get(index-1), container) < 0)
+ break;
+ }
+
+ if (index < 0)
+ index = 0;
+ fChildContainers.add(index, container);
+
+ return index;
+ }
+
+
+ /**
+ * Returns the element comparator.
+ *
+ * @return the element comparator
+ */
+ public ElementComparator getElementComparator() {
+ return fComparator;
+ }
+
+ /**
+ * Returns the parent container, can be <code>null</code>.
+ *
+ * @return the parent container
+ */
+ public BreakpointContainer getParent() {
+ return fParent;
+ }
+
+ /**
+ * Determine whether there is any nested container.
+ *
+ * @return true if has nested container
+ */
+ private boolean hasNesting() {
+ return fNesting != null && fNesting.length > 0;
+ }
+
+ /**
+ * Get the categories for the breakpoint with the given organizer.
+ *
+ * @param breakpoint the breakpoint
+ * @param organizer the organizer
+ * @return the categories
+ */
+ private static IAdaptable[] getCategories(IBreakpoint breakpoint, IBreakpointOrganizer organizer) {
+ IAdaptable[] categories = organizer.getCategories(breakpoint);
+
+ if (categories == null || categories.length == 0)
+ categories = OtherBreakpointCategory.getCategories(organizer);
+
+ return categories;
}
/**
- * Adds a breakpoint to this container and its nested containers.
+ * Find existing breakpoint container in the container array the given category.
*
- * @param breakpoint breakpoint to add
+ * @param containers the container array
+ * @param category the category
+ * @return the breakpoint container, can be <code>null</code>.
*/
- public void addBreakpoint(IBreakpoint breakpoint) {
- fBreakpoints.add(breakpoint);
- if (fNesting != null && fNesting.length > 0) {
+ private static BreakpointContainer findExistingContainer(List containers, IAdaptable category) {
+ BreakpointContainer container = null;
+
+ Iterator containerIt = containers.iterator();
+ while (containerIt.hasNext()) {
+ container = (BreakpointContainer) containerIt.next();
+ IAdaptable containerCategory = container.getCategory();
+
+ if (category.equals(containerCategory))
+ break;
+
+ container = null;
+ }
+
+ return container;
+ }
+
+ // TODO [pchuong]: can be remove if BreakpointsContentProvider no longer uses this class
+ void addBreakpoint(IBreakpoint breakpoint) {
+ addBreakpoint(breakpoint, new ModelDelta(null, IModelDelta.NO_CHANGE));
+ }
+
+ /**
+ * Add a breakpoint to the container, additional delta will be added to the root delta.
+ *
+ * @param breakpoint the breakpoint to added
+ * @param rootDelta the root delta of this container
+ * @see removeBreakpoint
+ */
+ public void addBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
+ final int bpIndex = insertBreakpoint(breakpoint);
+ if (bpIndex < 0) return;
+
+ if (hasNesting()) {
IBreakpointOrganizer organizer = fNesting[0];
- IAdaptable[] categories = organizer.getCategories(breakpoint);
- if (categories== null || categories.length == 0) {
- categories = OtherBreakpointCategory.getCategories(organizer);
- }
- for (int i = 0; i < categories.length; i++) {
- IAdaptable category = categories[i];
- BreakpointContainer container = (BreakpointContainer) fCategoriesToContainers.get(category);
- if (container == null) {
- IBreakpointOrganizer[] nesting = null;
- if (fNesting.length > 1) {
- nesting = new IBreakpointOrganizer[fNesting.length - 1];
- System.arraycopy(fNesting, 1, nesting, 0, nesting.length);
- }
- container = new BreakpointContainer(category, organizer, nesting);
- fCategoriesToContainers.put(category, container);
- }
- container.addBreakpoint(breakpoint);
+
+ // get the breakpoint categories from the organizer
+ IAdaptable[] categories = getCategories(breakpoint, organizer);
+
+ for (int i = 0; i < categories.length; ++i) {
+ ModelDelta childDelta = null;
+ IAdaptable category = categories[i];
+ BreakpointContainer container = findExistingContainer(fChildContainers, category);
+
+ // create a new container if it doesn't exist
+ if (container == null) {
+ IBreakpointOrganizer[] nesting = null;
+ if (fNesting.length > 1) {
+ nesting = new IBreakpointOrganizer[fNesting.length - 1];
+ System.arraycopy(fNesting, 1, nesting, 0, nesting.length);
+ }
+ container = new BreakpointContainer(this, category, organizer, fComparator, nesting);
+ insertChildContainer(container);
+ childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSERTED|IModelDelta.INSTALL, -1);
+
+ } else {
+ childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.STATE, -1);
+ }
+
+ container.addBreakpoint(breakpoint, childDelta);
+ childDelta.setChildCount(container.getChildren().length);
}
+
+ } else {
+ // TODO [pchuong]: There seems to be some kind of problem when the INSERTED flag is used,
+ // there is a additional checkbox added to the end of the tree.
+ // Also the tree seems to have a strange visual affect when using the INSERTED
+ // flag for the child node instead of ADDED flag. Note: all breakpoint delta
+ // is using the ADDED flag in this class.
+ rootDelta.addNode(breakpoint, bpIndex, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
+ // rootDelta.addNode(breakpoint, bpIndex, IModelDelta.INSERTED|IModelDelta.INSTALL, 0);
+
+ rootDelta.setFlags(rootDelta.getFlags() | IModelDelta.EXPAND);
}
}
/**
+ * Remove a breakpoint from the container, additional delta will be added to the root delta.
+ *
+ * @param breakpoint the breakpoint to remove
+ * @param delta the root delta of this container
+ * @see addBreakpoint
+ */
+ public void removeBreakpoint(IBreakpoint breakpoint, ModelDelta rootDelta) {
+ boolean removed = fBreakpoints.remove(breakpoint);
+
+ if (removed) {
+ boolean addRemoveBpDelta = getContainers().length == 0;
+
+ if (removed) {
+ Iterator it = fChildContainers.iterator();
+ while (it.hasNext()) {
+ BreakpointContainer container = (BreakpointContainer) it.next();
+
+ // if the breakpoint contains in the container and it is the only breakpoint,
+ // than remove the container from the collection
+ if (container.contains(breakpoint)) {
+ ModelDelta childDelta = null;
+ if ((!container.isDefaultContainer()) && (container.getBreakpoints().length <= 1)) {
+ it.remove();
+ childDelta = rootDelta.addNode(container, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
+
+ } else {
+ childDelta = rootDelta.addNode(container, IModelDelta.STATE);
+ }
+
+ // remove the breakpoint from the nested containers
+ container.removeBreakpoint(breakpoint, childDelta);
+ }
+ }
+
+ if (addRemoveBpDelta) {
+ rootDelta.addNode(breakpoint, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
+ }
+ }
+ }
+ }
+
+ /**
+ * A helper method to copy the organizers between two containers.
+ *
+ * @param destContainer the destination container
+ * @param sourceContainer the source container
+ */
+ public static void copyOrganizers(BreakpointContainer destContainer, BreakpointContainer sourceContainer) {
+ destContainer.fNesting = sourceContainer.fNesting;
+ destContainer.fOrganizer = sourceContainer.fOrganizer;
+ destContainer.fCategory = sourceContainer.fCategory;
+ }
+
+ /**
+ * A helper method to update the breakpoint cache of the container and it's ancestors.
+ *
+ * @param container the breakpoint container
+ * @param breakpoints the breakpoint to update
+ * @param add true if breakpoint should be added to the cache, otherwise remove the breakpoint from the cache
+ */
+ private static void updateSelfAndAncestorsBreakpointCache(BreakpointContainer container, List breakpoints, boolean add) {
+ if (container != null) {
+ container.fBreakpoints.removeAll(breakpoints);
+ if (add)
+ container.fBreakpoints.addAll(breakpoints);
+ updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, add);
+ }
+ }
+
+ /**
+ * A helper method to add a breakpoint to an existing container.
+ *
+ * @param destContainer the destination container
+ * @param breakpoint the breakpoint to add
+ * @param destContainerDelta the destination container delta, additional delta will be added to this delta
+ */
+ static public void addBreakpoint(BreakpointContainer destContainer, IBreakpoint breakpoint, ModelDelta destContainerDelta) {
+ int index = destContainer.insertBreakpoint(breakpoint);
+ Assert.isTrue(index >= 0);
+
+ List breakpoints = destContainer.fBreakpoints;
+ destContainerDelta.addNode(breakpoint, index/*breakpoints.indexOf(breakpoint)*/, IModelDelta.ADDED|IModelDelta.INSTALL, 0);
+
+ // add the breakpoints to the parent containers.
+ updateSelfAndAncestorsBreakpointCache(destContainer.getParent(), breakpoints, true);
+ }
+
+ /**
+ * A helper method to add a child container to an existing container.
+ *
+ * @param destContainer the destination container
+ * @param sourceContainer the source container
+ * @param destContainerDelta the delta of the destination container, additional delta will be added to this delta
+ */
+ static public void addChildContainer(BreakpointContainer destContainer, BreakpointContainer sourceContainer, ModelDelta destContainerDelta) {
+ destContainer.insertChildContainer(sourceContainer);
+ sourceContainer.fParent = destContainer;
+
+ // add the breakpoints to the parent containers.
+ List breakpoints = Arrays.asList(sourceContainer.getBreakpoints());
+ updateSelfAndAncestorsBreakpointCache(destContainer, breakpoints, true);
+
+ int index = destContainer.fChildContainers.indexOf(sourceContainer);
+ int size = sourceContainer.getChildren().length;
+ ModelDelta childDelta = destContainerDelta.addNode(sourceContainer, index, IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND, size);
+
+ appendContainerDelta(sourceContainer, childDelta);
+ }
+
+ /**
+ * A helper method to append delta to the breakpoint container. This method is used by addContainer only.
+ *
+ * @param container the container to append child delta
+ * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
+ * @see BreakpointContainer.addContainer
+ */
+ static private void appendContainerDelta(BreakpointContainer container, ModelDelta containerDelta) {
+ Object[] children = container.getChildren();
+ for (int i = 0; i < children.length; ++i) {
+ boolean isBreakpoint = children[0] instanceof IBreakpoint;
+ int numChild = isBreakpoint ? 0 : children.length;
+ int flag = isBreakpoint ? IModelDelta.ADDED|IModelDelta.INSTALL
+ : IModelDelta.INSERTED|IModelDelta.INSTALL|IModelDelta.EXPAND;
+ ModelDelta childDelta = containerDelta.addNode(children[i], i, flag, numChild);
+
+ if (children[i] instanceof BreakpointContainer) {
+ BreakpointContainer childContainer = (BreakpointContainer) children[i];
+ appendContainerDelta(childContainer, childDelta);
+ }
+ }
+ }
+
+ /**
+ * A helper method to remove the breakpoint from the container.
+ *
+ * @param container the container to remove the breakpoint
+ * @param breakpoint the breakpoint to remove
+ * @param containerDelta the delta of the breakpoint container, additional delta will be added to this delta
+ */
+ static public void removeBreakpoint(BreakpointContainer container, IBreakpoint breakpoint, ModelDelta containerDelta) {
+ container.removeBreakpoint(breakpoint, containerDelta);
+ List breakpoints = new ArrayList();
+ breakpoints.add(breakpoint);
+ updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
+ }
+
+ /**
+ * Remove all child elements including the given container itself.
+ *
+ * @param container the breakpoint container
+ * @param parentDelta the parent delta
+ */
+ static public void removeAll(BreakpointContainer container, ModelDelta delta) {
+ BreakpointContainer parent = container.getParent();
+ if (parent != null) {
+ parent.fChildContainers.remove(container);
+ delta = delta.addNode(container, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
+ }
+
+ if (container.fChildContainers.size() == 0) {
+ List breakpoints = new ArrayList();
+
+ Iterator iterator = container.fBreakpoints.iterator();
+ while (iterator.hasNext()) {
+ Object obj = iterator.next();
+ breakpoints.add(obj);
+ delta.addNode(obj, IModelDelta.UNINSTALL|IModelDelta.REMOVED);
+ iterator.remove();
+ }
+
+ // remove the breakpoints from the parent containers.
+ updateSelfAndAncestorsBreakpointCache(container.getParent(), breakpoints, false);
+ return;
+ }
+
+ Iterator iterator = container.fChildContainers.iterator();
+ while (iterator.hasNext()) {
+ BreakpointContainer childContainer = (BreakpointContainer) iterator.next();
+ ModelDelta childDelta = delta.addNode(childContainer, IModelDelta.REMOVED|IModelDelta.UNINSTALL);
+ iterator.remove();
+
+ removeAll(childContainer, childDelta);
+ }
+ }
+
+ /**
+ * Returns whether this is the default container.
+ *
+ * @return true if it is a default container
+ */
+ boolean isDefaultContainer() {
+ return fDefaultContainer;
+ }
+
+ /**
* Returns the breakpoints in this container
*
* @return the breakpoints in this container
@@ -117,20 +535,19 @@ public class BreakpointContainer extends PlatformObject {
* @return children as breakpoints or nested containers
*/
public Object[] getChildren() {
- if (fCategoriesToContainers.isEmpty()) {
+ if (fChildContainers.isEmpty()) {
return getBreakpoints();
}
return getContainers();
- }
+ }
/**
* Returns the containers nested in this container, possibly empty.
*
- * @return the containers nested in this container, possibly empty
+ * @return the containers nested in this container, can be empty.
*/
public BreakpointContainer[] getContainers() {
- Collection collection = fCategoriesToContainers.values();
- return (BreakpointContainer[]) collection.toArray(new BreakpointContainer[collection.size()]);
+ return (BreakpointContainer[]) fChildContainers.toArray(new BreakpointContainer[fChildContainers.size()]);
}
/**
@@ -142,52 +559,32 @@ public class BreakpointContainer extends PlatformObject {
return fOrganizer;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) obj;
- return getCategory().equals(container.getCategory());
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getCategory().hashCode();
- }
-
/**
* Returns whether this container contains the given breakpoint.
*
* @param breakpoint
- * @return whether this container contains the given breakpoint
+ * @return true if this container contains the given breakpoint
*/
public boolean contains(IBreakpoint breakpoint) {
return fBreakpoints.contains(breakpoint);
- }
+ }
/**
- * Returns the leaf containers the given breakpoint is contained in, or <code>null</code>
- * if none.
+ * Returns the child containers for the given breakpoint.
*
* @param breakpoint
- * @return leaf containers the given breakpoint is contained in, or <code>null</code>
- * if none
+ * @return child containers
*/
public BreakpointContainer[] getContainers(IBreakpoint breakpoint) {
if (contains(breakpoint)) {
- BreakpointContainer[] containers = getContainers();
+ BreakpointContainer[] containers = getContainers();
if (containers.length == 0) {
return new BreakpointContainer[]{this};
}
- List list = new ArrayList();
+ ArrayList list = new ArrayList();
for (int i = 0; i < containers.length; i++) {
- BreakpointContainer container = containers[i];
- BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
+ BreakpointContainer container = containers[i];
+ BreakpointContainer[] subcontainers = container.getContainers(breakpoint);
if (subcontainers != null) {
for (int j = 0; j < subcontainers.length; j++) {
list.add(subcontainers[j]);
@@ -196,6 +593,63 @@ public class BreakpointContainer extends PlatformObject {
}
return (BreakpointContainer[]) list.toArray(new BreakpointContainer[list.size()]);
}
- return null;
+ return new BreakpointContainer[0];
}
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof BreakpointContainer) {
+
+ BreakpointContainer container = (BreakpointContainer) obj;
+
+ // With Group by "Advanced" the same category can contain a different subset of breakpoints,
+ // therefore to have the same category is not enough to be equal.
+ if (! (fParent != null && container.fParent != null && fParent.equals(container.fParent) ||
+ fParent == null && container.fParent == null) ) {
+ return false;
+ }
+
+ if (getCategory() != null && container.getCategory() != null) {
+ return getCategory().equals(container.getCategory());
+ } else {
+ return true;
+ }
+ }
+ return super.equals(obj);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
+ */
+ protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
+ return getChildren().length;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @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 {
+ return getElements(getChildren(), index, length);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String)
+ */
+ protected boolean supportsContextId(String id) {
+ return id.equals(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
index 2c009db99..a1f3f7e5a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainerWorkbenchAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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,11 +7,13 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.RGB;
@@ -35,14 +37,16 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
* @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
*/
public ImageDescriptor getImageDescriptor(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getImageDescriptor(category);
+ if (category != null) {
+ IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ return adapter.getImageDescriptor(category);
+ }
+ return container.getOrganizer().getImageDescriptor();
}
- return container.getOrganizer().getImageDescriptor();
}
return null;
}
@@ -51,14 +55,16 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
* @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
*/
public String getLabel(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getLabel(category);
+ if (category != null) {
+ IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ return adapter.getLabel(category);
+ }
+ return container.getOrganizer().getLabel();
}
- return container.getOrganizer().getLabel();
}
return IInternalDebugCoreConstants.EMPTY_STRING;
}
@@ -74,8 +80,8 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
* @see org.eclipse.ui.model.IWorkbenchAdapter2#getForeground(java.lang.Object)
*/
public RGB getForeground(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
@@ -89,8 +95,8 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
* @see org.eclipse.ui.model.IWorkbenchAdapter2#getBackground(java.lang.Object)
*/
public RGB getBackground(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
@@ -104,8 +110,8 @@ public class BreakpointContainerWorkbenchAdapter implements IWorkbenchAdapter, I
* @see org.eclipse.ui.model.IWorkbenchAdapter2#getFont(java.lang.Object)
*/
public FontData getFont(Object object) {
- if (object instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) object;
+ if (object instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) object;
IAdaptable category = container.getCategory();
IWorkbenchAdapter2 adapter = (IWorkbenchAdapter2) category.getAdapter(IWorkbenchAdapter2.class);
if (adapter != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
index 3108687a3..fc1385156 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerExtension.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
import org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
index 617ff70c3..529cb606c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointOrganizerManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 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
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
index ef4a7c265..abc8af1fe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
@@ -115,6 +115,16 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if (property.equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) {
+ IWorkingSet defaultWorkingSet = getDefaultWorkingSet();
+ if (defaultWorkingSet != null) {
+ fireCategoryChanged(new WorkingSetCategory(defaultWorkingSet));
+ } else {
+ fireCategoryChanged(null);
+ }
+ }
+
IWorkingSet set = null;
Object newValue = event.getNewValue();
if (newValue instanceof IWorkingSet) {
@@ -126,7 +136,6 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
if(set == null) {
return;
}
- String property = event.getProperty();
//fix for bug 103731
if (property.equals(IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE)) {
if (newValue.equals(fDefaultWorkingSet)) {
@@ -151,14 +160,6 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
if (set != null && IDebugUIConstants.BREAKPOINT_WORKINGSET_ID.equals(set.getId())) {
fireCategoryChanged(new WorkingSetCategory(set));
}
- if (property.equals(IInternalDebugUIConstants.MEMENTO_BREAKPOINT_WORKING_SET_NAME)) {
- IWorkingSet defaultWorkingSet = getDefaultWorkingSet();
- if (defaultWorkingSet != null) {
- fireCategoryChanged(new WorkingSetCategory(defaultWorkingSet));
- } else {
- fireCategoryChanged(null);
- }
- }
}
/*
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
index bc7e5fbc0..1bb0901f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetElementAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 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
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetElementAdapter;
@@ -32,8 +33,8 @@ public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAda
*/
public IAdaptable[] adaptElements(IWorkingSet ws, IAdaptable[] elements) {
for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (!(adaptable instanceof IBreakpoint)) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
+ if (breakpoint != null) {
return selectBreakpoints(elements);
}
}
@@ -43,9 +44,9 @@ public class BreakpointWorkingSetElementAdapter implements IWorkingSetElementAda
private IAdaptable[] selectBreakpoints(IAdaptable[] elements) {
List breakpoints = new ArrayList(elements.length);
for (int i = 0; i < elements.length; i++) {
- IAdaptable adaptable = elements[i];
- if (adaptable instanceof IBreakpoint) {
- breakpoints.add(adaptable);
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(elements[i], IBreakpoint.class);
+ if (breakpoint != null) {
+ breakpoints.add(breakpoint);
}
}
return (IAdaptable[]) breakpoints.toArray(new IAdaptable[breakpoints.size()]);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
index aa8f8a789..19879e841 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -164,8 +164,9 @@ public class BreakpointWorkingSetPage extends WizardPage implements IWorkingSetP
ArrayList elements = new ArrayList();
//weed out non-breakpoint elements since 3.2
for(int i = 0; i < adaptable.length; i++) {
- if(adaptable[i] instanceof IBreakpoint) {
- elements.add(adaptable[i]);
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(adaptable[i], IBreakpoint.class);
+ if(breakpoint != null) {
+ elements.add(breakpoint);
}//end if
}//end for
if (fWorkingSet == null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
index 88644a7a7..8ae412723 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -18,6 +18,8 @@ import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
index 8b547e7ee..ae4273452 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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,12 +7,16 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.util.TransferDragSourceListener;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceAdapter;
import org.eclipse.swt.dnd.DragSourceEvent;
@@ -28,8 +32,11 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe
/**
* the associated viewer for the adapter
*/
- private BreakpointsViewer fViewer;
+ private AbstractTreeViewer fViewer;
private Item[] fItems = null;
+
+ private BreakpointsView fView;
+ private TreePath[] fTreePaths = null;
/**
* Constructor
@@ -39,6 +46,11 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe
Assert.isNotNull(viewer);
fViewer = viewer;
}
+ public BreakpointsDragAdapter(AbstractTreeViewer viewer, BreakpointsView view) {
+ Assert.isNotNull(view);
+ fViewer = viewer;
+ fView = view;
+ }
/**
* @see TransferDragSourceListener#getTransfer
@@ -54,8 +66,18 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe
ISelection selection = fViewer.getSelection();
LocalSelectionTransfer.getInstance().setSelection(selection);
LocalSelectionTransfer.getInstance().setSelectionSetTime(event.time & 0xFFFFFFFFL);
- event.doit = fViewer.canDrag(fViewer.getSelectedItems());
- fItems = fViewer.getSelectedItems();
+ if (fViewer instanceof BreakpointsViewer) {
+ BreakpointsViewer viewer = (BreakpointsViewer)fViewer;
+ fItems = viewer.getSelectedItems();
+ event.doit = viewer.canDrag(fItems);
+ } else {
+ if (selection instanceof ITreeSelection) {
+ fTreePaths = ((ITreeSelection) selection).getPaths();
+ } else {
+ fTreePaths = new TreePath[0];
+ }
+ event.doit = fView.canDrag(fTreePaths);
+ }
}
/* non Java-doc
@@ -74,7 +96,12 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe
public void dragFinished(DragSourceEvent event) {
if (event.detail == DND.DROP_MOVE) {
// remove from source on move operation
- fViewer.performDrag(fItems);
+ if (fViewer instanceof BreakpointsViewer) {
+ BreakpointsViewer viewer = (BreakpointsViewer)fViewer;
+ viewer.performDrag(fItems);
+ } else {
+ fView.performDrag(fTreePaths);
+ }
}
fItems = null;
LocalSelectionTransfer.getInstance().setSelection(null);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
index cd4096d9e..1cf985096 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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,14 +7,23 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
/**
@@ -23,20 +32,38 @@ import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
public class BreakpointsDropAdapter extends ViewerDropAdapter {
private Item fTarget = null;
+ private TreePath fPath = null;
+ private BreakpointsView fView;
/**
* @param viewer
*/
- protected BreakpointsDropAdapter(BreakpointsViewer viewer) {
+ protected BreakpointsDropAdapter(TreeViewer viewer) {
super(viewer);
setFeedbackEnabled(false);
}
+ protected BreakpointsDropAdapter(TreeViewer viewer, BreakpointsView view) {
+ this(viewer);
+ fView = view;
+ }
+
/**
* @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
*/
public boolean performDrop(Object data) {
- return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
+ // This is temporary
+ if (getViewer() instanceof BreakpointsViewer) {
+ return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
+ } else if (fView != null) {
+ ISelection selection = LocalSelectionTransfer.getInstance().getSelection();
+ if (fPath != null && selection instanceof ITreeSelection) {
+ if (selection instanceof ITreeSelection) {
+ return fView.performDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getInstance().getSelection());
+ }
+ }
+ }
+ return false;
}
/**
@@ -44,6 +71,17 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter {
*/
protected Object determineTarget(DropTargetEvent event) {
fTarget = (Item) event.item;
+ if (fTarget instanceof TreeItem) {
+ List list = new ArrayList();
+ TreeItem item = (TreeItem)fTarget;
+ while (item != null) {
+ list.add(item.getData());
+ item = item.getParentItem();
+ }
+ fPath = new TreePath(list.toArray());
+ } else {
+ fPath = null;
+ }
return fTarget;
}
@@ -51,6 +89,17 @@ public class BreakpointsDropAdapter extends ViewerDropAdapter {
* @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
*/
public boolean validateDrop(Object target, int operation, TransferData transferType) {
- return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
+ // This is temporary
+ if (getViewer() instanceof BreakpointsViewer) {
+ return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
+ } else {
+ ISelection selection = LocalSelectionTransfer.getInstance().getSelection();
+ if (fPath != null && selection instanceof ITreeSelection) {
+ if (selection instanceof ITreeSelection) {
+ return fView.canDrop(fPath, (ITreeSelection) LocalSelectionTransfer.getInstance().getSelection());
+ }
+ }
+ }
+ return false;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
index 17e8cf0b8..a032a73bc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java
@@ -1,383 +1,381 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+/*****************************************************************
+ * 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:
- * IBM Corporation - initial API and implementation
- * Brock Janiczak - bug 78494
- *******************************************************************************/
+ * Patrick Chuong (Texas Instruments) - Initial API and implementation (Bug 238956)
+ * IBM Corporation - ongoing enhancements and bug fixing
+ *****************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
-
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
-import com.ibm.icu.text.MessageFormat;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
+import org.eclipse.debug.internal.ui.VariablesViewModelPresentation;
+import org.eclipse.debug.internal.ui.actions.breakpointGroups.CopyBreakpointsAction;
+import org.eclipse.debug.internal.ui.actions.breakpointGroups.PasteBreakpointsAction;
+import org.eclipse.debug.internal.ui.actions.breakpointGroups.RemoveFromWorkingSetAction;
+import org.eclipse.debug.internal.ui.actions.breakpoints.OpenBreakpointMarkerAction;
+import org.eclipse.debug.internal.ui.actions.breakpoints.ShowTargetBreakpointsAction;
+import org.eclipse.debug.internal.ui.actions.breakpoints.SkipAllBreakpointsAction;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
+import org.eclipse.debug.internal.ui.elements.adapters.DefaultBreakpointManagerInput;
+import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
+import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
+import org.eclipse.debug.internal.ui.views.variables.VariablesView;
+import org.eclipse.debug.internal.ui.views.variables.details.AvailableDetailPanesAction;
+import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
+import org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.Viewer;
-
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener2;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchCommandConstants;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.XMLMemento;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManagerListener;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.LazyModelPresentation;
-import org.eclipse.debug.internal.ui.actions.breakpointGroups.CopyBreakpointsAction;
-import org.eclipse.debug.internal.ui.actions.breakpointGroups.PasteBreakpointsAction;
-import org.eclipse.debug.internal.ui.actions.breakpointGroups.RemoveFromWorkingSetAction;
-import org.eclipse.debug.internal.ui.actions.breakpoints.OpenBreakpointMarkerAction;
-import org.eclipse.debug.internal.ui.actions.breakpoints.ShowSupportedBreakpointsAction;
-import org.eclipse.debug.internal.ui.actions.breakpoints.SkipAllBreakpointsAction;
-import org.eclipse.debug.internal.ui.views.DebugUIViewsMessages;
-
-import org.eclipse.debug.ui.AbstractDebugView;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.debug.ui.IDebugUIConstants;
-
/**
- * This view shows the breakpoints registered with the breakpoint manager
+ * This class implements the breakpoints view.
*/
-public class BreakpointsView extends AbstractDebugView implements ISelectionListener, IBreakpointManagerListener, IPerspectiveListener2 {
+public class BreakpointsView extends VariablesView implements ISelectionListener {
+ private static final String ACTION_GOTO_MARKER = "GotoMarker"; //$NON-NLS-1$
+ private static final String ACTION_SKIP_BREAKPOINTS = "SkipBreakpoints"; //$NON-NLS-1$
+ private static final String ACTION_SHOW_MODEL_BREAKPOINT = "ShowBreakpointsForModel";//$NON-NLS-1$
+ private static final String ACTION_REMOVE_FROM_GROUP = "RemoveFromGroup"; //$NON-NLS-1$
+
+
+ private static final String KEY_IS_TRACKING_SELECTION = "isTrackingSelection"; //$NON-NLS-1$
+ private static final String KEY_VALUE = "value"; //$NON-NLS-1$
- private BreakpointsViewEventHandler fEventHandler;
- private ICheckStateListener fCheckListener= new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object source = event.getElement();
- if (source instanceof BreakpointContainer) {
- handleContainerChecked(event, (BreakpointContainer) source);
- } else if (source instanceof IBreakpoint) {
- handleBreakpointChecked(event, (IBreakpoint) source);
- }
- }
- };
- private boolean fIsTrackingSelection= false;
- // Persistence constants
- private static String KEY_IS_TRACKING_SELECTION= "isTrackingSelection"; //$NON-NLS-1$
- private static String KEY_VALUE="value"; //$NON-NLS-1$
- private static final String ACTION_REMOVE_FROM_GROUP = "RemoveFromGroup"; //$NON-NLS-1$
- private BreakpointsContentProvider fContentProvider;
- private Clipboard fClipboard;
- private IContextActivation fActivatedContext;
-
- /**
- * This memento allows the Breakpoints view to save and restore state
- * when it is closed and opened within a session. A different
- * memento is supplied by the platform for persistence at
- * workbench shutdown.
+ private boolean fIsTrackingSelection = false;
+
+ private Clipboard fClipboard;
+ private IBreakpointOrganizer[] fOrganizers;
+ private IStructuredSelection fFilterSelection;
+
+ public void dispose() {
+ if (fClipboard != null)
+ fClipboard.dispose();
+ super.dispose();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getDetailPanePreferenceKey()
*/
- private static IMemento fgMemento;
+ protected String getDetailPanePreferenceKey() {
+ return IDebugPreferenceConstants.BREAKPOINTS_DETAIL_PANE_ORIENTATION;
+ }
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getHelpContextId()
*/
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this);
- getSite().getWorkbenchWindow().addPerspectiveListener(this);
+ protected String getHelpContextId() {
+ return IDebugHelpContextIds.BREAKPOINT_VIEW;
}
- /**
- * @see AbstractDebugView#createViewer(Composite)
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getViewerStyle()
*/
- protected Viewer createViewer(Composite parent) {
- fContentProvider= new BreakpointsContentProvider();
- CheckboxTreeViewer viewer = new BreakpointsViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK));
- setViewer(viewer);
- viewer.setUseHashlookup(true);
- viewer.setContentProvider(fContentProvider);
- viewer.setComparator(new BreakpointsComparator());
- viewer.setInput(DebugPlugin.getDefault().getBreakpointManager());
- viewer.addCheckStateListener(fCheckListener);
- viewer.addTreeListener(new ITreeViewerListener() {
- public void treeExpanded(TreeExpansionEvent event) {
- ((BreakpointsViewer)getViewer()).updateCheckedState(event.getElement());
- }
- public void treeCollapsed(TreeExpansionEvent event) {
- }
- });
- viewer.setLabelProvider(new BreakpointsLabelProvider());
- // Necessary so that the PropertySheetView hears about selections in this view
- getSite().setSelectionProvider(viewer);
- initIsTrackingSelection();
- initBreakpointOrganizers();
- setEventHandler(new BreakpointsViewEventHandler(this));
- initDragAndDrop();
+ protected int getViewerStyle() {
+ return SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.CHECK;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createViewer(org.eclipse.swt.widgets.Composite)
+ */
+ public Viewer createViewer(Composite parent) {
+ TreeModelViewer viewer = (TreeModelViewer) super.createViewer(parent);
+
+ initBreakpointOrganizers(getMemento());
+ initIsTrackingSelection(getMemento());
+
return viewer;
}
-
- /**
- * Initializes drag and drop for the breakpoints viewer
- */
- private void initDragAndDrop() {
- BreakpointsViewer viewer = (BreakpointsViewer) getViewer();
- int ops = DND.DROP_MOVE | DND.DROP_COPY;
- // drop
- viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDropAdapter(viewer));
- // Drag
- viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDragAdapter(viewer));
- }
-
- /**
- * Initializes whether this view tracks selection in the
- * debug view from the persisted state.
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getModelPresentation()
*/
- private void initIsTrackingSelection() {
- IMemento memento= getMemento();
- if (memento != null) {
- IMemento node= memento.getChild(KEY_IS_TRACKING_SELECTION);
- if (node != null) {
- setTrackSelection(Boolean.valueOf(node.getString(KEY_VALUE)).booleanValue());
- return;
- }
+ protected IDebugModelPresentation getModelPresentation() {
+ if (fModelPresentation == null) {
+ fModelPresentation = new VariablesViewModelPresentation() {
+ /**
+ * Undo double slashes.
+ */
+ public String getText(Object element) {
+ IDebugModelPresentation lp= getConfiguredPresentation(element);
+ if (lp != null) {
+ return lp.getText(element);
+ }
+ return getDefaultText(element);
+ }
+ };
}
- setTrackSelection(false);
+ return fModelPresentation;
}
/**
- * Initializes the persisted breakpoints organizers
+ * Returns the tree model viewer.
+ * @return
*/
- private void initBreakpointOrganizers() {
- IMemento memento = getMemento();
- if (memento != null) {
- IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- if (node == null) {
- fContentProvider.setOrganizers(null);
- } else {
- String value = node.getString(KEY_VALUE);
- if (value != null) {
- String[] ids = value.split(","); //$NON-NLS-1$
- BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault();
- List organziers= new ArrayList();
- for (int i = 0; i < ids.length; i++) {
- IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]);
- if (organizer != null) {
- organziers.add(organizer);
- }
- }
- fContentProvider.setOrganizers((IBreakpointOrganizer[]) organziers.toArray(new IBreakpointOrganizer[organziers.size()]));
- }
- }
- }
+ public TreeModelViewer getTreeModelViewer() {
+ return (TreeModelViewer) getViewer();
}
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.AbstractDebugView#getMemento()
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
+ */
+ protected void configureToolBar(IToolBarManager tbm) {
+ tbm.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
+ tbm.add(getAction(ACTION_SHOW_MODEL_BREAKPOINT));
+ tbm.add(getAction(ACTION_GOTO_MARKER));
+ tbm.add(getAction(ACTION_SKIP_BREAKPOINTS));
+ tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
- protected IMemento getMemento() {
- if (fgMemento != null) {
- return fgMemento;
+ protected void fillContextMenu(IMenuManager menu) {
+ updateObjects();
+ menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
+ menu.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP));
+ menu.add(getAction(ACTION_GOTO_MARKER));
+ menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP));
+ menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
+ menu.add(getAction(ActionFactory.COPY.getCommandId()));
+ menu.add(getAction(ActionFactory.PASTE.getCommandId()));
+ IAction action = getAction(ACTION_REMOVE_FROM_GROUP);
+ if (action != null && action.isEnabled()) {
+ menu.add(action);
}
- return super.getMemento();
+ menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
+ action = new AvailableDetailPanesAction(this);
+ if (isDetailPaneVisible() && action.isEnabled()) {
+ menu.add(action);
+ }
+ menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP_GROUP));
+
+ menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
-
- /**
- * Update the checked state up the given element and all of its children.
- *
- * @param element
- */
- public void updateCheckedState(Object element) {
- ((BreakpointsViewer)getViewer()).updateCheckedState(element);
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#createActions()
+ */
+ protected void createActions() {
+ IAction action = new OpenBreakpointMarkerAction(getViewer());
+ setAction(ACTION_GOTO_MARKER, action);
+ setAction(DOUBLE_CLICK_ACTION, action);
+ setAction(ACTION_SHOW_MODEL_BREAKPOINT, new ShowTargetBreakpointsAction(this));
+ setAction(ACTION_SKIP_BREAKPOINTS, new SkipAllBreakpointsAction(this));
+
+ fClipboard = new Clipboard(getSite().getShell().getDisplay());
+
+ PasteBreakpointsAction paste = new PasteBreakpointsAction(this);
+ configure(paste, ActionFactory.PASTE.getCommandId(), ActionFactory.PASTE.getCommandId(), ISharedImages.IMG_TOOL_PASTE);
+ SelectionListenerAction copy = new CopyBreakpointsAction(this, fClipboard, paste);
+ configure(copy, ActionFactory.COPY.getCommandId(), ActionFactory.COPY.getCommandId(), ISharedImages.IMG_TOOL_COPY);
+
+ SelectionListenerAction remove = new RemoveFromWorkingSetAction(this);
+ setAction(ACTION_REMOVE_FROM_GROUP, remove);
+ getViewer().addSelectionChangedListener(remove);
}
-
- /**
- * Returns this view's viewer as a checkbox tree viewer.
- * @return this view's viewer as a checkbox tree viewer
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.debug.internal.ui.views.variables.VariablesView#getToggleActionLabel()
*/
- public CheckboxTreeViewer getCheckboxViewer() {
- return (CheckboxTreeViewer) getViewer();
+ protected String getToggleActionLabel() {
+ return DebugUIViewsMessages.BreakpointsView_12;
}
-
- /**
- * Returns this view's content provider as a tree content provider.
- * @return this view's content provider as a tree content provider
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#getPresentationContextId()
*/
- public ITreeContentProvider getTreeContentProvider() {
- return fContentProvider;
+ protected String getPresentationContextId() {
+ return IDebugUIConstants.ID_BREAKPOINT_VIEW;
}
- /**
- * A breakpoint has been checked/unchecked. Update the group
- * element's checked/grayed state as appropriate.
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#contextActivated(org.eclipse.jface.viewers.ISelection)
*/
- private void handleBreakpointChecked(final CheckStateChangedEvent event, final IBreakpoint breakpoint) {
- final boolean enable= event.getChecked();
- String jobName = enable ? DebugUIViewsMessages.BreakpointsView_0 : DebugUIViewsMessages.BreakpointsView_1; //
- new Job(jobName) {
- protected IStatus run(IProgressMonitor monitor) {
- try {
- breakpoint.setEnabled(enable);
- return Status.OK_STATUS;
- } catch (final CoreException e) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- String titleState= enable ? DebugUIViewsMessages.BreakpointsView_6 : DebugUIViewsMessages.BreakpointsView_7; //
- String messageState= enable ? DebugUIViewsMessages.BreakpointsView_8 : DebugUIViewsMessages.BreakpointsView_9; //
- DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), MessageFormat.format(DebugUIViewsMessages.BreakpointsView_10, new String[] { titleState }), MessageFormat.format(DebugUIViewsMessages.BreakpointsView_11, new String[] { messageState }), e); //
- // If the breakpoint fails to update, reset its check state.
- getCheckboxViewer().removeCheckStateListener(fCheckListener);
- event.getCheckable().setChecked(breakpoint, !event.getChecked());
- getCheckboxViewer().addCheckStateListener(fCheckListener);
- }
- });
- }
- return Status.CANCEL_STATUS;
- }
- }.schedule();
- }
+ protected void contextActivated(ISelection selection) {
+ if (selection == null || selection.isEmpty()) {
+ Object input = new DefaultBreakpointManagerInput(getTreeModelViewer().getPresentationContext());
+ super.contextActivated(new StructuredSelection(input));
+ } else {
+ super.contextActivated(selection);
+ }
+ if (isAvailable() && isVisible()) {
+ updateAction("ContentAssist"); //$NON-NLS-1$
+ }
+ }
- /**
- * A group has been checked or unchecked. Enable/disable all of the
- * breakpoints in that group to match.
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#setViewerInput(java.lang.Object)
*/
- private void handleContainerChecked(CheckStateChangedEvent event, BreakpointContainer container) {
- final IBreakpoint[] breakpoints = container.getBreakpoints();
- final boolean enable= event.getChecked();
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- breakpoint.setEnabled(enable);
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- }
- };
- // TODO: should use scheduling rule
- IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
- try {
- progressService.busyCursorWhile(runnable);
+ protected void setViewerInput(Object context) {
+ Object current = getViewer().getInput();
+ if (current == null && context == null) {
+ return;
+ }
+
+ if (current != null && current.equals(context)) {
+ return;
+ }
+
+ final TreeModelViewer viewer = getTreeModelViewer();
+ final IPresentationContext presentationContext = viewer.getPresentationContext();
+
+ // set the view organizer - if there is an organizer override per input, than set the organizer to null
+ Object organizerInputAdapter = null;
+ if (context instanceof IAdaptable) {
+ organizerInputAdapter = ((IAdaptable) context).getAdapter(IBreakpointOrganizerInputProvider.class);
+ }
+ presentationContext.setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS, organizerInputAdapter != null ? null : fOrganizers);
+
+ // set the view filter selection
+ presentationContext.setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION, fFilterSelection);
+
+ // set the element comparator
+ presentationContext.setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR, new ElementComparator(presentationContext));
+
+ showViewer();
+ getViewer().setInput(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#viewerInputUpdateComplete(org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate)
+ */
+ protected void viewerInputUpdateComplete(IViewerInputUpdate update) {
+ // handles non-standard debug model
+ if (update.getElement() != null) {
+ setViewerInput(update.getInputElement());
+ } else {
+ setViewerInput(new DefaultBreakpointManagerInput(getTreeModelViewer().getPresentationContext()));
}
- catch (InvocationTargetException e) {}
- catch (InterruptedException e) {}
}
-
+
+
/**
- * @see AbstractDebugView#getHelpContextId()
+ * Returns whether this view is currently tracking the selection from the debug view.
+ *
+ * @return whether this view is currently tracking the debug view's selection
*/
- protected String getHelpContextId() {
- return IDebugHelpContextIds.BREAKPOINT_VIEW;
+ public boolean isTrackingSelection() {
+ return fIsTrackingSelection;
}
/**
- * @see IWorkbenchPart#dispose()
+ * Sets whether this view should track the selection from the debug view.
+ *
+ * @param trackSelection whether or not this view should track the debug view's selection.
*/
- public void dispose() {
- disposeAction(IWorkbenchCommandConstants.EDIT_COPY);
- disposeAction(IWorkbenchCommandConstants.EDIT_PASTE);
- disposeAction(ACTION_REMOVE_FROM_GROUP);
-
- if (getCheckboxViewer() != null) {
- getCheckboxViewer().removeCheckStateListener(fCheckListener);
- }
- IAction action= getAction("ShowBreakpointsForModel"); //$NON-NLS-1$
- if (action != null) {
- ((ShowSupportedBreakpointsAction)action).dispose();
+ public void setTrackSelection(boolean trackSelection) {
+ fIsTrackingSelection = trackSelection;
+ if (trackSelection) {
+ getSite().getPage().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
+ } else {
+ getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
}
- getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(this);
- super.dispose();
- if (getEventHandler() != null) {
- getEventHandler().dispose();
+ // set the track selection property for non-standard model to track the debug context
+ final TreeModelViewer viewer = getTreeModelViewer();
+ if (viewer != null) {
+ viewer.getPresentationContext().setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_TRACK_SELECTION, new Boolean(fIsTrackingSelection));
}
-
- if (fClipboard != null) {
- fClipboard.dispose();
- }
-
- getSite().getWorkbenchWindow().removePerspectiveListener(this);
}
-
+
/**
- * @see AbstractDebugView#createActions()
+ * Initializes the persisted breakpoints organizers.
*/
- protected void createActions() {
- IAction action = new OpenBreakpointMarkerAction(getViewer());
- setAction("GotoMarker", action); //$NON-NLS-1$
- setAction(DOUBLE_CLICK_ACTION, action);
- setAction("ShowBreakpointsForModel", new ShowSupportedBreakpointsAction(getStructuredViewer(),this)); //$NON-NLS-1$
- setAction("SkipBreakpoints", new SkipAllBreakpointsAction(this)); //$NON-NLS-1$
-
- fClipboard= new Clipboard(getSite().getShell().getDisplay());
-
- PasteBreakpointsAction paste = new PasteBreakpointsAction(this);
- configure(paste, ActionFactory.PASTE.getCommandId(), ActionFactory.PASTE.getId(), ISharedImages.IMG_TOOL_PASTE);
- SelectionListenerAction copy = new CopyBreakpointsAction(this, fClipboard, paste);
- configure(copy, ActionFactory.COPY.getCommandId(), ActionFactory.COPY.getId(), ISharedImages.IMG_TOOL_COPY);
-
- SelectionListenerAction remove = new RemoveFromWorkingSetAction(this);
- setAction(ACTION_REMOVE_FROM_GROUP, remove);
- getViewer().addSelectionChangedListener(remove);
+ private void initBreakpointOrganizers(IMemento memento) {
+ if (memento != null) {
+ IMemento node = memento.getChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
+ if (node == null) {
+ fOrganizers = null;
+ } else {
+ String value = node.getString(KEY_VALUE);
+ if (value != null) {
+ String[] ids = value.split(","); //$NON-NLS-1$
+ BreakpointOrganizerManager manager = BreakpointOrganizerManager.getDefault();
+ List organziers= new ArrayList();
+ for (int i = 0; i < ids.length; i++) {
+ IBreakpointOrganizer organizer = manager.getOrganizer(ids[i]);
+ if (organizer != null) {
+ organziers.add(organizer);
+ }
+ }
+ fOrganizers = (IBreakpointOrganizer[]) organziers.toArray(new IBreakpointOrganizer[organziers.size()]);
+
+ for (int i = 0; i < fOrganizers.length; i++)
+ fOrganizers[i].addPropertyChangeListener(this);
+ }
+ }
+ }
}
-
+
/**
* Configures the action to override the global action, registers
* the action for selection change notification, and registers
* the action with this view.
*
- * @param sla action
+ * @param action selection action
* @param defId action definition id
* @param globalId global action id
* @param imgId image identifier
@@ -389,314 +387,187 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
getViewer().addSelectionChangedListener(action);
action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(imgId));
}
-
- /**
- * Cleans up selection listener action
- *
- * @param id action id
- */
- private void disposeAction(String id) {
- IAction action = getAction(id);
- if (action instanceof SelectionListenerAction) {
- SelectionListenerAction sla = (SelectionListenerAction) action;
- if (getViewer() != null) {
- getViewer().removeSelectionChangedListener(sla);
- }
- }
- }
-
- /**
- * Adds items to the context menu.
- *
- * @param menu The menu to contribute to
- */
- protected void fillContextMenu(IMenuManager menu) {
- updateObjects();
- menu.add(new Separator(IDebugUIConstants.EMPTY_NAVIGATION_GROUP));
- menu.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP));
- menu.add(getAction("GotoMarker")); //$NON-NLS-1$
- menu.add(new Separator(IDebugUIConstants.EMPTY_BREAKPOINT_GROUP));
- menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
- menu.add(getAction(IWorkbenchCommandConstants.EDIT_COPY));
- menu.add(getAction(IWorkbenchCommandConstants.EDIT_PASTE));
- IAction action = getAction(ACTION_REMOVE_FROM_GROUP);
- if (action.isEnabled()) {
- menu.add(action);
- }
- menu.add(new Separator(IDebugUIConstants.EMPTY_RENDER_GROUP));
- menu.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP_GROUP));
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
/**
- * @see AbstractDebugView#configureToolBar(IToolBarManager)
+ * Initializes whether this view tracks selection in the debug view from the persisted state.
*/
- protected void configureToolBar(IToolBarManager tbm) {
- tbm.add(new Separator(IDebugUIConstants.BREAKPOINT_GROUP));
- tbm.add(getAction("ShowBreakpointsForModel")); //$NON-NLS-1$
- tbm.add(getAction("GotoMarker")); //$NON-NLS-1$
- tbm.add(getAction("SkipBreakpoints")); //$NON-NLS-1$
- tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
+ private void initIsTrackingSelection(IMemento memento) {
+ if (memento != null) {
+ IMemento node = memento.getChild(KEY_IS_TRACKING_SELECTION);
+ if (node != null) {
+ setTrackSelection(Boolean.valueOf(node.getString(KEY_VALUE)).booleanValue());
+ return;
+ }
+ }
+ setTrackSelection(false);
}
- /**
- * Returns this view's event handler
- *
- * @return a breakpoint view event handler
- */
- protected BreakpointsViewEventHandler getEventHandler() {
- return fEventHandler;
- }
-
- /**
- * Sets this view's event handler.
- *
- * @param eventHandler a breakpoint view event handler
- */
- private void setEventHandler(BreakpointsViewEventHandler eventHandler) {
- fEventHandler = eventHandler;
- }
- /**
- * @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
+ /**
+ * Initializes drag and drop for the breakpoints viewer
+ */
+ protected void initDragAndDrop(TreeModelViewer viewer) {
+ int ops = DND.DROP_MOVE | DND.DROP_COPY;
+ // drop
+ viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDropAdapter(viewer, this));
+ // Drag
+ viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDragAdapter(viewer, this));
+ // Drag only
+// viewer.addDragSupport(DND.DROP_COPY, new Transfer[] {LocalSelectionTransfer.getTransfer()}, new SelectionDragAdapter(viewer));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#saveViewerState(org.eclipse.ui.IMemento)
*/
- protected void becomesVisible() {
- super.becomesVisible();
- CheckboxTreeViewer viewer = getCheckboxViewer();
- ISelection selection = viewer.getSelection();
- viewer.getControl().setRedraw(false);
- ((BreakpointsContentProvider)viewer.getContentProvider()).reorganize();
- viewer.setSelection(new StructuredSelection(selection));
- viewer.getControl().setRedraw(true);
+ public void saveViewerState(IMemento memento) {
+ IMemento node = memento.createChild(KEY_IS_TRACKING_SELECTION);
+ node.putString(KEY_VALUE, String.valueOf(fIsTrackingSelection));
+
+ StringBuffer buffer = new StringBuffer();
+ if (fOrganizers != null) {
+ for (int i = 0; i < fOrganizers.length; i++) {
+ IBreakpointOrganizer organizer = fOrganizers[i];
+ buffer.append(organizer.getIdentifier());
+ if (i < (fOrganizers.length - 1)) {
+ buffer.append(',');
+ }
+ }
+ node = memento.createChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
+ node.putString(KEY_VALUE, buffer.toString());
+ }
+ super.saveViewerState(memento);
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IWorkbenchPart part, ISelection sel) {
if (sel.isEmpty() || !isTrackingSelection()) {
return;
}
- IStructuredSelection selection= (IStructuredSelection) sel;
- Iterator iter= selection.iterator();
- Object firstElement= iter.next();
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Iterator iter = selection.iterator();
+ Object firstElement = iter.next();
if (firstElement == null || iter.hasNext()) {
return;
}
- IThread thread= null;
+ IThread thread = null;
if (firstElement instanceof IStackFrame) {
- thread= ((IStackFrame) firstElement).getThread();
+ thread = ((IStackFrame) firstElement).getThread();
} else if (firstElement instanceof IThread) {
- thread= (IThread) firstElement;
+ thread = (IThread) firstElement;
} else {
return;
}
- IBreakpoint[] breakpoints= thread.getBreakpoints();
- getViewer().setSelection(new StructuredSelection(breakpoints), true);
+
+ IBreakpoint[] breakpoints = thread.getBreakpoints();
+ Viewer viewer = getViewer();
+ if (viewer != null)
+ viewer.setSelection(new StructuredSelection(breakpoints), true);
}
-
+
/**
- * Returns whether this view is currently tracking the
- * selection from the debug view.
+ * Preserves the selection.
*
- * @return whether this view is currently tracking the
- * debug view's selection
+ * @param selection the selection
*/
- public boolean isTrackingSelection() {
- return fIsTrackingSelection;
+ public void preserveSelection(IStructuredSelection selection) {
+ if (selection instanceof ITreeSelection && !selection.isEmpty()) {
+ TreePath path = ((ITreeSelection) selection).getPaths()[0];
+ TreeItem item = (TreeItem) ((TreeModelViewer) getViewer()).findItem(path);
+ Object toselect = null;
+ if (item != null) {
+ TreeItem parent = item.getParentItem();
+ if (parent != null) {
+ int idx = 0;
+ if (parent.getItemCount() == 1) {
+ toselect = parent.getData();
+ }
+ idx = parent.indexOf(item);
+ if (idx == 0) {
+ if (parent.getItemCount() > 1) {
+ toselect = parent.getItem(1).getData();
+ } else {
+ toselect = parent.getItem(0).getData();
+ }
+ }
+ if (idx > 0) {
+ toselect = parent.getItem(idx - 1).getData();
+ }
+ } else {
+ Tree tree = item.getParent();
+ TreeItem[] items = tree.getItems();
+ if (items.length > 1) {
+ for (int i = 0; i < items.length; i++) {
+ if (item.equals(items[i])) {
+ if (i + 1 >= items.length) {
+ toselect = items[i - 1].getData();
+ break;
+ } else {
+ toselect = items[i + 1].getData();
+ break;
+ }
+
+ }
+ }
+ }
+ }
+ }
+ if (toselect != null) {
+ getViewer().setSelection(new StructuredSelection(toselect),true);
+ }
+ }
}
-
+
/**
- * Sets whether this view should track the selection from
- * the debug view.
+ * Sets the breakpoint organizers for this view.
*
- * @param trackSelection whether or not this view should
- * track the debug view's selection.
+ * @param organizers the organizers, can be <code>null</code>.
*/
- public void setTrackSelection(boolean trackSelection) {
- fIsTrackingSelection= trackSelection;
- if (trackSelection) {
- getSite().getPage().addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- } else {
- getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
+ public void setBreakpointOrganizers(IBreakpointOrganizer[] organizers) {
+ if (fOrganizers != null) {
+ for (int i = 0; fOrganizers != null && i < fOrganizers.length; i++)
+ fOrganizers[i].removePropertyChangeListener(this);
}
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
- IMemento node= memento.createChild(KEY_IS_TRACKING_SELECTION);
- node.putString(KEY_VALUE, String.valueOf(fIsTrackingSelection));
- StringBuffer buffer= new StringBuffer();
- IBreakpointOrganizer[] organizers = fContentProvider.getOrganizers();
- if (organizers != null) {
- for (int i = 0; i < organizers.length; i++) {
- IBreakpointOrganizer organizer = organizers[i];
- buffer.append(organizer.getIdentifier());
- if (i < (organizers.length - 1)) {
- buffer.append(',');
- }
- }
- node = memento.createChild(IDebugUIConstants.EXTENSION_POINT_BREAKPOINT_ORGANIZERS);
- node.putString(KEY_VALUE, buffer.toString());
- }
+ fOrganizers = organizers;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
- */
- public void breakpointManagerEnablementChanged(boolean enabled) {
- DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
- public void run() {
- IAction action = getAction("SkipBreakpoints"); //$NON-NLS-1$
- if (action != null) {
- ((SkipAllBreakpointsAction) action).updateActionCheckedState();
- }
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
- */
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection= (IStructuredSelection) event.getSelection();
- if (selection.size() == 1) {
- Object element = selection.getFirstElement();
- if (element instanceof BreakpointContainer) {
- getCheckboxViewer().setExpandedState(element, !getCheckboxViewer().getExpandedState(element));
- return;
- }
- }
- super.doubleClick(event);
+ for (int i = 0; fOrganizers != null && i < fOrganizers.length; i++)
+ fOrganizers[i].addPropertyChangeListener(this);
+
+ TreeModelViewer viewer = getTreeModelViewer();
+ if (viewer != null) {
+ // update the presentation context organizer
+ viewer.getPresentationContext().setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS, fOrganizers);
+ }
}
/**
- * @param selectedContainers
+ * Sets the breakpoint filter for this view.
+ *
+ * @param ss the selection, can be <code>null</code>.
*/
- public void setBreakpointOrganizers(IBreakpointOrganizer[] organizers) {
- Viewer viewer = getViewer();
- ISelection selection = viewer.getSelection();
- fContentProvider.setOrganizers(organizers);
- viewer.setSelection(selection);
+ public void setFilterSelection(IStructuredSelection ss) {
+ fFilterSelection = ss;
+
+ TreeModelViewer viewer = getTreeModelViewer();
+ if (viewer != null) {
+ // update the presentation context filter
+ viewer.getPresentationContext().setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_FILTER_SELECTION, fFilterSelection);
+ }
}
/**
- * returns the complete listing of breakpoints organizers
- * @return the complete listing of breakpoint organizers
+ * Returns the breakpoint organizers for this view.
+ *
+ * @return the breakpoint organizers.
*/
public IBreakpointOrganizer[] getBreakpointOrganizers() {
- return fContentProvider.getOrganizers();
+ return fOrganizers;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener2#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, org.eclipse.ui.IWorkbenchPartReference, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, IWorkbenchPartReference partRef, String changeId) {
- if (partRef instanceof IViewReference && changeId.equals(IWorkbenchPage.CHANGE_VIEW_HIDE)) {
- String id = ((IViewReference) partRef).getId();
- if (id.equals(getViewSite().getId())) {
- // BreakpointsView closed. Persist settings.
- fgMemento= XMLMemento.createWriteRoot("BreakpointsViewMemento"); //$NON-NLS-1$
- saveState(fgMemento);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveActivated(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor)
- */
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveListener#perspectiveChanged(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IPerspectiveDescriptor, java.lang.String)
- */
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.IDebugView#getPresentation(java.lang.String)
- */
- public IDebugModelPresentation getPresentation(String id) {
- if (getViewer() instanceof StructuredViewer) {
- IBaseLabelProvider lp = ((StructuredViewer)getViewer()).getLabelProvider();
- if (lp instanceof BreakpointsLabelProvider) {
- BreakpointsLabelProvider blp = (BreakpointsLabelProvider) lp;
- lp = blp.getPresentation();
- }
- if (lp instanceof DelegatingModelPresentation) {
- return ((DelegatingModelPresentation)lp).getPresentation(id);
- }
- if (lp instanceof LazyModelPresentation) {
- if (((LazyModelPresentation)lp).getDebugModelIdentifier().equals(id)) {
- return (IDebugModelPresentation)lp;
- }
- }
- }
- return null;
- }
-
- /**
- * This method is used solely to preserve the selection state of the viewer in the event that the current selection is to be removed
- * @param selection the selection to be removed
- *
- * @since 3.3
- */
- public void preserveSelection(IStructuredSelection selection) {
- if(selection != null && !selection.isEmpty()) {
- TreeItem item = (TreeItem) ((BreakpointsViewer)getCheckboxViewer()).searchItem(selection.getFirstElement());
- Object toselect = null;
- if(item != null) {
- TreeItem parent = item.getParentItem();
- if(parent != null) {
- int idx = 0;
- if(parent.getItemCount() == 1) {
- toselect = parent.getData();
- }
- idx = parent.indexOf(item);
- if(idx == 0) {
- if(parent.getItemCount() > 1) {
- toselect = parent.getItem(1).getData();
- }
- else {
- toselect = parent.getItem(0).getData();
- }
- }
- if(idx > 0) {
- toselect = parent.getItem(idx-1).getData();
- }
- }
- else {
- Tree tree = item.getParent();
- TreeItem[] items = tree.getItems();
- if (items.length > 1){
- for(int i = 0; i < items.length; i++) {
- if(item.equals(items[i])) {
- if(i+1 >= items.length){
- toselect = items[i-1].getData();
- break;
- } else {
- toselect = items[i+1].getData();
- break;
- }
-
- }
- }
- }
- }
- }
- if(toselect != null) {
- getViewer().setSelection(new StructuredSelection(toselect), true);
- }
- }
- }
-
- /**
+
+ /**
* Returns whether the given selection can be pasted into the given target.
* <p>
* Scheme:
@@ -711,81 +582,282 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
* @param selection the selection to paste
* @return whether the given selection can be pasted into the given target
*
- * TODO Remove in favour of using <code>TreeItem</code>s and <code>TreePath</code>s to determine paste targets
+ * TODO Remove in favor of using <code>TreeItem</code>s and <code>TreePath</code>s to determine paste targets
*/
public boolean canPaste(Object target, ISelection selection) {
- if(!(target instanceof BreakpointContainer)) {
+ if(!(target instanceof IBreakpointContainer) || !(selection instanceof IStructuredSelection)) {
return false;
}
- if(selection.isEmpty()) {
+ if(selection == null || selection.isEmpty()) {
return false;
}
IStructuredSelection ss = (IStructuredSelection) selection;
- BreakpointContainer container = (BreakpointContainer) target;
- IBreakpoint breakpoint = null;
- Object element = null;
+ IBreakpointContainer container = (IBreakpointContainer) target;
for(Iterator iter = ss.iterator(); iter.hasNext();) {
- element = iter.next();
- if(!(element instanceof IBreakpoint)) {
- return false;
- }
- breakpoint = (IBreakpoint) element;
- if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
+ if (breakpoint == null || container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
return false;
}
}
return true;
- }
+ }
- /**
+ /**
* Pastes the selection into the given target
*
- * @param target target of the paste, either a BreakpointContainer,
- * or a Breakpoint within a BreakpointContainer
+ * @param target target of the paste, either a IBreakpointContainer,
+ * or a Breakpoint within a IBreakpointContainer
* @param selection breakpoints
* @return whether successful
*
- * TODO remove in favour of using <code>TreeItem</code> as paste target
+ * TODO remove in favor of using <code>TreeItem</code> as paste target
*/
public boolean performPaste(Object target, ISelection selection) {
- if (target instanceof BreakpointContainer && selection instanceof IStructuredSelection) {
- BreakpointContainer container = (BreakpointContainer) target;
+ if (target instanceof IBreakpointContainer && selection instanceof IStructuredSelection) {
+ IBreakpointContainer container = (IBreakpointContainer) target;
Object[] objects = ((IStructuredSelection)selection).toArray();
for (int i = 0; i < objects.length; i++) {
- container.getOrganizer().addBreakpoint((IBreakpoint)objects[i], container.getCategory());
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(objects[i], IBreakpoint.class);
+ if (breakpoint != null) {
+ container.getOrganizer().addBreakpoint(breakpoint, container.getCategory());
+ }
}
return true;
}
return false;
}
- /**
- * Returns if the breakpoints view is currently showing groups or not
- * @return true of the breakpoints view showing groups, false otherwise
+ /**
+ * Returns the container from within the specified path that is the container the breakpoint can be removed from
+ * @param breakpoint the breakpoint to get the container for
+ * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
+ * @since 3.3
*/
- public boolean isShowingGroups() {
- return fContentProvider.isShowingGroups();
+ public IBreakpointContainer getRemovableContainer(TreePath path) {
+ if (path != null) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(path.getLastSegment(), IBreakpoint.class);
+ if (breakpoint != null) {
+ IBreakpointContainer container = null;
+ for(int i = path.getSegmentCount()-2; i > -1; i--) {
+ Object segment = path.getSegment(i);
+ if (segment instanceof IBreakpointContainer) {
+ container = (IBreakpointContainer) segment;
+ if(container.contains(breakpoint) &&
+ container.getOrganizer() != null &&
+ container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ }
+ return null;
}
+ /**
+ * Returns the addable breakpoint container of the specified tree path
+ * @param breakpoint the breakpoint to get the container for
+ * @return the first found addable container for the specified tree path or <code>null</code> if none found
+ * @since 3.3
+ */
+ protected IBreakpointContainer getAddableContainer(TreePath path) {
+ if (path != null) {
+ Object element = path.getLastSegment();
+ if (element instanceof IBreakpointContainer) {
+ return (IBreakpointContainer)element;
+ }
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(element, IBreakpoint.class);
+ if (breakpoint != null) {
+ IBreakpointContainer container = null;
+ for (int i = path.getSegmentCount()-2; i > -1; i--) {
+ Object segment = path.getSegment(i);
+ if (segment instanceof IBreakpointContainer) {
+ container = (IBreakpointContainer) segment;
+ if (container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
/**
- * @see org.eclipse.ui.part.PageBookView#partActivated(org.eclipse.ui.IWorkbenchPart)
+ * This method is used to determine if there is an addable parent container available for the specified drop target.
+ * <p>
+ * A drop target can be either a <code>IBreakpointContainer</code> or an <code>IBreakpoint</code>. This method always checks the entire heirarchy
+ * of the tree path for the specified target in the event one of the parent element does not support dropping.
+ * </p>
+ * @param target
+ * @param breakpoint
+ * @return
*/
- public void partActivated(IWorkbenchPart part) {
- if (part.equals(this)) {
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- fActivatedContext = contextService.activateContext(IDebugUIConstants.ID_BREAKPOINT_VIEW);
+ private boolean checkAddableParentContainers(TreePath path, IBreakpoint breakpoint) {
+ if (path != null) {
+ Object element = null;
+ for (int i = path.getSegmentCount()-1; i > -1; i--) {
+ element = path.getSegment(i);
+ if (element instanceof IBreakpointContainer) {
+ IBreakpointContainer container = (IBreakpointContainer) element;
+ if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return false;
+ }
+ }
+ }
}
- super.partActivated(part);
+ return true;
}
+
+ /**
+ * Returns if the selected item in the tree can be dragged
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>breakpoint containers cannot be dragged</li>
+ * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
+ * </ul>
+ * </p>
+ * @param element the element to test if it can be dragged
+ * @return true if the selected element can be dragged, false otherwise
+ * @since 3.3
+ */
+ boolean canDrag(TreePath[] items) {
+ if(items == null) {
+ return false;
+ }
+ if (items.length == 0) {
+ return false;
+ }
+ for (int i = 0; i < items.length; i++) {
+ if (getRemovableContainer(items[i]) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
+ * @param selection the selection of breakpoints involved in the drag
+ * @since 3.3
+ */
+ void performDrag(TreePath[] paths) {
+ if (paths == null) {
+ return;
+ }
+ Map containersToBreakpoints = new HashMap();
+ for (int i = 0; i < paths.length; i++) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(paths[i].getLastSegment(), IBreakpoint.class);
+ if (breakpoint != null) {
+ IBreakpointContainer container = getRemovableContainer(paths[i]);
+ if(container != null) {
+ List list = (List) containersToBreakpoints.get(container);
+ if (list == null) {
+ list = new ArrayList();
+ containersToBreakpoints.put(container, list);
+ }
+ list.add(breakpoint);
+ }
+ }
+ }
+ Iterator iterator = containersToBreakpoints.entrySet().iterator();
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+ IBreakpointContainer container = (IBreakpointContainer) entry.getKey();
+ List list = (List) entry.getValue();
+ IBreakpointOrganizer organizer = container.getOrganizer();
+ IBreakpoint[] breakpoints = (IBreakpoint[]) list.toArray(new IBreakpoint[list.size()]);
+ if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
+ IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
+ extension.removeBreakpoints(breakpoints, container.getCategory());
+ } else {
+ for (int i = 0; i < breakpoints.length; i++) {
+ organizer.removeBreakpoint(breakpoints[i], container.getCategory());
+ }
+ }
+ }
+ }
+
/**
- * @see org.eclipse.ui.part.PageBookView#partDeactivated(org.eclipse.ui.IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- if (part.equals(this)) {
- IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- contextService.deactivateContext(fActivatedContext);
+ * Performs the actual addition of the selected breakpoints to the specified target
+ * @param target the target to add the selection of breakpoints to
+ * @param selection the selection of breakpoints
+ * @return true if the drop occurred, false otherwise
+ * @since 3.3
+ */
+ protected boolean performDrop(TreePath target, ITreeSelection selection) {
+ if(target == null || selection == null) {
+ return false;
+ }
+ IBreakpointContainer container = getAddableContainer(target);
+ if (container == null) {
+ return false;
}
- super.partDeactivated(part);
- }
+
+ IBreakpointOrganizer organizer = container.getOrganizer();
+ List breakpoints = new ArrayList(selection.size());
+ for (Iterator iter = selection.iterator(); iter.hasNext();) {
+ IBreakpoint breakpoint = (IBreakpoint) DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
+ if (breakpoint != null) {
+ breakpoints.add(breakpoint);
+ }
+ }
+ if (organizer instanceof IBreakpointOrganizerDelegateExtension) {
+ IBreakpointOrganizerDelegateExtension extension = (IBreakpointOrganizerDelegateExtension) organizer;
+ extension.addBreakpoints(
+ (IBreakpoint[])breakpoints.toArray(new IBreakpoint[breakpoints.size()]),
+ container.getCategory());
+ } else {
+ for (int i = 0; i < breakpoints.size(); i++) {
+ organizer.addBreakpoint((IBreakpoint)breakpoints.get(i), container.getCategory());
+ }
+ }
+ // TODO expandToLevel(target.getData(), ALL_LEVELS);
+
+ return true;
+ }
+
+ /**
+ * Determines if the specified element can be dropped into the specified target
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>Breakpoints can be dropped into working sets</li>
+ * <li>Breakpoints can be dropped into breakpoints, provided there is a drop-able parent of the target breakpoint</li>
+ * </ul>
+ * </p>
+ * @param target the target for the drop
+ * @param element the element we want to drop
+ * @return true if the specified element can be dropped into the specified target, false otherwise
+ * @since 3.3
+ */
+ boolean canDrop(TreePath target, ITreeSelection selection) {
+ if (selection == null || target == null) {
+ return false;
+ }
+ for(Iterator iter = selection.iterator(); iter.hasNext();) {
+ IBreakpoint breakpoint = (IBreakpoint)DebugPlugin.getAdapter(iter.next(), IBreakpoint.class);
+
+ if (breakpoint == null || !checkAddableParentContainers(target, breakpoint)){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.internal.ui.views.variables.VariablesView#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+
+ if (event.getProperty().equals(IBreakpointOrganizerDelegate.P_CATEGORY_CHANGED)) {
+ final TreeModelViewer viewer = getTreeModelViewer();
+ if (viewer != null) {
+ setBreakpointOrganizers(fOrganizers);
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java
deleted file mode 100644
index 300bc1a55..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewEventHandler.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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
- * Brock Janiczak - bug 57999
- * Michael Fraenkel - bug 84385
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.views.breakpoints;
-
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.IBreakpointManagerListener;
-import org.eclipse.debug.core.IBreakpointsListener;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.ActivityManagerEvent;
-import org.eclipse.ui.activities.IActivityManagerListener;
-import org.eclipse.ui.activities.IWorkbenchActivitySupport;
-
-/**
- * Handles breakpoint events and activity manager events (which can affect grouping),
- * updating the breakpoints view and viewer.
- */
-public class BreakpointsViewEventHandler implements IBreakpointsListener, IActivityManagerListener, IBreakpointManagerListener {
-
- private BreakpointsView fView;
-
- /**
- * Constructs an event handler for the breakpoints view.
- */
- public BreakpointsViewEventHandler(BreakpointsView view) {
- fView= view;
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- breakpointManager.addBreakpointListener(this);
- breakpointManager.addBreakpointManagerListener(this);
- IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport();
- if (activitySupport != null) {
- activitySupport.getActivityManager().addActivityManagerListener(this);
- }
- }
-
- /**
- * When this event handler is disposed, remove it as a listener.
- */
- public void dispose() {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- breakpointManager.removeBreakpointListener(this);
- breakpointManager.removeBreakpointManagerListener(this);
- IWorkbenchActivitySupport activitySupport = PlatformUI.getWorkbench().getActivitySupport();
- if (activitySupport != null) {
- activitySupport.getActivityManager().removeActivityManagerListener(this);
- }
- }
-
- /**
- * @see IBreakpointsListener#breakpointsAdded(IBreakpoint[])
- */
- public void breakpointsAdded(final IBreakpoint[] breakpoints) {
- if (fView.isAvailable() && fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- if (fView.isAvailable()) {
- CheckboxTreeViewer viewer = fView.getCheckboxViewer();
- viewer.getControl().setRedraw(false);
- BreakpointsContentProvider provider = (BreakpointsContentProvider)viewer.getContentProvider();
- provider.reorganize();
-
- // This code is left in as a test case for platform bug 77075
- //for (int i = 0; i < breakpoints.length; i++) {
- //viewer.expandToLevel(breakpoints[i], AbstractTreeViewer.ALL_LEVELS);
- //}
- // expand as required
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- BreakpointContainer[] roots = provider.getRoots(breakpoint);
- if (roots != null) {
- for (int j = 0; j < roots.length; j++) {
- viewer.expandToLevel(roots[j], AbstractTreeViewer.ALL_LEVELS);
- }
- }
- }
- fView.getViewer().refresh();
- viewer.setSelection(new StructuredSelection(breakpoints));
- viewer.getControl().setRedraw(true);
- fView.updateObjects();
- }
- }
- });
- }
- }
-
- /**
- * @see IBreakpointsListener#breakpointsRemoved(IBreakpoint[], IMarkerDelta[])
- */
- public void breakpointsRemoved(final IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- if (fView.isAvailable() && fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- if (fView.isAvailable()) {
- CheckboxTreeViewer viewer= (CheckboxTreeViewer)fView.getViewer();
- viewer.getControl().setRedraw(false);
- ((BreakpointsContentProvider)viewer.getContentProvider()).reorganize();
- viewer.getControl().setRedraw(true);
- fView.updateObjects();
- }
- }
- });
- }
- }
-
- /**
- * @see IBreakpointsListener#breakpointsChanged(IBreakpoint[], IMarkerDelta[])
- */
- public void breakpointsChanged(final IBreakpoint[] breakpoints, final IMarkerDelta[] deltas) {
- if (fView.isAvailable() & fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- if (fView.isAvailable()) {
- CheckboxTreeViewer viewer = (CheckboxTreeViewer)fView.getViewer();
- viewer.getControl().setRedraw(false);
- BreakpointsContentProvider provider = (BreakpointsContentProvider) viewer.getContentProvider();
- Set updates = new HashSet();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- viewer.update(breakpoint, null);
- BreakpointContainer[] containers = provider.getContainers(breakpoint);
- if (containers != null) {
- for (int j = 0; j < containers.length; j++ ) {
- updates.add(containers[j]);
- }
- } else {
- updates.add(breakpoint);
- }
- }
- Object[] objects = updates.toArray();
- for (int i = 0; i < objects.length; i++) {
- fView.updateCheckedState(objects[i]);
- }
- viewer.getControl().setRedraw(true);
- fView.updateObjects();
- }
- }
- });
- }
- }
-
- /**
- * When new activities are added or enabled, refresh the view contents to add/remove
- * breakpoints related to the affected activities.
- */
- public void activityManagerChanged(final ActivityManagerEvent activityManagerEvent) {
- if (fView.isAvailable() & fView.isVisible() && activityManagerEvent.haveEnabledActivityIdsChanged()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- fView.getViewer().refresh();
- }
- });
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean)
- */
- public void breakpointManagerEnablementChanged(boolean enabled) {
- if (fView.isAvailable() & fView.isVisible()) {
- fView.asyncExec(new Runnable() {
- public void run() {
- fView.getViewer().refresh();
- }
- });
- }
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
index 97604e2d2..5445a4787 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
@@ -22,6 +23,8 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
import org.eclipse.debug.ui.IBreakpointOrganizerDelegateExtension;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -129,7 +132,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
* @since 3.3
*/
- public BreakpointContainer getRemovableContainer(Item item) {
+ public IBreakpointContainer getRemovableContainer(Item item) {
if(item == null) {
return null;
}
@@ -137,9 +140,9 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
TreePath path = getTreePathFromItem(item);
if(path != null) {
IBreakpoint breakpoint = (IBreakpoint) path.getLastSegment();
- BreakpointContainer container = null;
+ IBreakpointContainer container = null;
for(int i = path.getSegmentCount()-2; i > -1; i--) {
- container = (BreakpointContainer) path.getSegment(i);
+ container = (IBreakpointContainer) path.getSegment(i);
if(container.contains(breakpoint) && container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
return container;
}
@@ -155,15 +158,15 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* @return the first found addable container for the specified breakpoint or <code>null</code> if none found
* @since 3.3
*/
- public BreakpointContainer getAddableContainer(Item item) {
+ public IBreakpointContainer getAddableContainer(Item item) {
TreePath path = getTreePathFromItem(item);
if(path != null) {
Object element = path.getLastSegment();
if(element instanceof IBreakpoint) {
- BreakpointContainer container = null;
+ IBreakpointContainer container = null;
IBreakpoint breakpoint = (IBreakpoint) element;
for(int i = path.getSegmentCount()-2; i > -1; i--) {
- container = (BreakpointContainer) path.getSegment(i);
+ container = (IBreakpointContainer) path.getSegment(i);
if(container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
return container;
}
@@ -211,7 +214,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
return;
}
Map containersToBreakpoints = new HashMap();
- BreakpointContainer container = null;
+ IBreakpointContainer container = null;
IBreakpoint breakpoint = null;
for(int i = 0; i < items.length; i++) {
if(!items[i].isDisposed()) {
@@ -230,7 +233,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
Iterator iterator = containersToBreakpoints.entrySet().iterator();
while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();
- container = (BreakpointContainer) entry.getKey();
+ container = (IBreakpointContainer) entry.getKey();
List list = (List) entry.getValue();
IBreakpointOrganizer organizer = container.getOrganizer();
IBreakpoint[] breakpoints = (IBreakpoint[]) list.toArray(new IBreakpoint[list.size()]);
@@ -283,14 +286,14 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
* @return
*/
private boolean checkAddableParentContainers(Item target, IBreakpoint breakpoint) {
- BreakpointContainer container = null;
+ IBreakpointContainer container = null;
TreePath path = getTreePathFromItem(target);
if(path != null) {
Object element = null;
for(int i = path.getSegmentCount()-1; i > -1; i--) {
element = path.getSegment(i);
- if(element instanceof BreakpointContainer) {
- container = (BreakpointContainer) element;
+ if(element instanceof IBreakpointContainer) {
+ container = (IBreakpointContainer) element;
if(container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
return false;
}
@@ -313,7 +316,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
}
IBreakpoint breakpoint = null;
Object element = target.getData();
- BreakpointContainer container = (element instanceof BreakpointContainer ? (BreakpointContainer)element : getAddableContainer(target));
+ IBreakpointContainer container = (element instanceof IBreakpointContainer ? (IBreakpointContainer)element : getAddableContainer(target));
if(container == null) {
return false;
}
@@ -411,8 +414,8 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
} catch (CoreException e) {
DebugUIPlugin.log(e);
}
- } else if (element instanceof BreakpointContainer) {
- IBreakpoint[] breakpoints = ((BreakpointContainer) element).getBreakpoints();
+ } else if (element instanceof IBreakpointContainer) {
+ IBreakpoint[] breakpoints = ((IBreakpointContainer) element).getBreakpoints();
int enabledChildren= 0;
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java
new file mode 100644
index 000000000..5120e20e4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java
@@ -0,0 +1,160 @@
+/*****************************************************************
+ * 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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.views.breakpoints;
+
+import java.util.Comparator;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext;
+
+/**
+ * Breakpoint element comparator.
+ *
+ * @since 3.6
+ */
+public class ElementComparator implements Comparator {
+ final private static String SPACE = " "; //$NON-NLS-1$
+
+ protected DebugModelPresentationContext fContext;
+
+ public ElementComparator(IPresentationContext context) {
+ if (context instanceof DebugModelPresentationContext)
+ fContext = (DebugModelPresentationContext) context;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(Object arg0, Object arg1) {
+ IBreakpoint bp0 = (IBreakpoint)DebugPlugin.getAdapter(arg0, IBreakpoint.class);
+ IBreakpoint bp1 = (IBreakpoint)DebugPlugin.getAdapter(arg1, IBreakpoint.class);
+ if (bp0 != null && bp1 != null) {
+ return compare(bp0, bp1);
+ } else if (arg0 instanceof IBreakpointContainer && arg1 instanceof IBreakpointContainer) {
+ return compare((IBreakpointContainer) arg0, (IBreakpointContainer) arg1);
+ } else {
+ return -1; // just return -1 if the two objects are not IBreakpoint type
+ }
+ }
+
+ /**
+ * Compares two breakpoint containers.
+ *
+ * @param c1
+ * @param c2
+ * @return
+ */
+ private int compare(IBreakpointContainer c1, IBreakpointContainer c2) {
+ if (fContext != null) {
+ String name1 = fContext.getModelPresentation().getText(c1);
+ String name2 = fContext.getModelPresentation().getText(c2);
+
+ return name1.compareTo(name2);
+ }
+
+ return -1;
+ }
+
+ /**
+ * Compares two breakpoints.
+ *
+ * @param b1
+ * @param b2
+ * @return
+ */
+ private int compare(IBreakpoint b1, IBreakpoint b2) {
+ String text1 = IInternalDebugCoreConstants.EMPTY_STRING;
+ String text2 = IInternalDebugCoreConstants.EMPTY_STRING;
+
+ text1 += b1.getModelIdentifier();
+ text2 += b2.getModelIdentifier();
+
+ IMarker marker1 = b1.getMarker();
+ IMarker marker2 = b2.getMarker();
+ try {
+ if (marker1.exists() && marker2.exists()) {
+ text1 += SPACE + marker1.getType();
+ text2 += SPACE + marker2.getType();
+ }
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+
+ int result = text1.compareTo(text2);
+ if (result != 0) {
+ return result;
+ }
+
+ // model and type are the same
+ if (fContext != null) {
+ String name1 = fContext.getModelPresentation().getText(b1);
+ String name2 = fContext.getModelPresentation().getText(b2);
+
+ boolean lineBreakpoint = false;
+ try {
+ lineBreakpoint = marker1.isSubtypeOf(IBreakpoint.LINE_BREAKPOINT_MARKER);
+ } catch (CoreException ce) {
+ }
+ if (lineBreakpoint) {
+ return compareLineBreakpoints(b1, b2, name1,name2);
+ }
+
+ return name1.compareTo(name2);
+ }
+
+ return result;
+ }
+
+ /**
+ * Compares two line breakpoints.
+ *
+ * @param b1
+ * @param b2
+ * @param name1
+ * @param name2
+ * @return
+ */
+ private int compareLineBreakpoints(IBreakpoint b1, IBreakpoint b2, String name1, String name2) {
+ int colon1 = name1.indexOf(':');
+ if (colon1 != -1) {
+ int colon2 = name2.indexOf(':');
+ if (colon2 != -1) {
+ String upToColon1 = name1.substring(0, colon1);
+ if (name2.startsWith(upToColon1)) {
+ int l1 = 0;
+ int l2 = 0;
+ try {
+ l1 = ((ILineBreakpoint)b1).getLineNumber();
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ try {
+ l2 = ((ILineBreakpoint)b2).getLineNumber();
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ return l1 - l2;
+ }
+ }
+ }
+ return name1.compareTo(name2);
+ }
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizerInputProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizerInputProvider.java
new file mode 100644
index 000000000..4c744a8e0
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/IBreakpointOrganizerInputProvider.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 238956)
+ *****************************************************************/
+package org.eclipse.debug.internal.ui.views.breakpoints;
+
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
+import org.eclipse.swt.widgets.Menu;
+
+/**
+ * This interface can be implement by the breakpoint manager input to overrides the standard
+ * breakpoint group local menu in the breakpoints view.
+ *
+ * @since 3.6
+ */
+public interface IBreakpointOrganizerInputProvider {
+
+ /**
+ * Fill the menu for the view input. The action is responsible to fire the model delta
+ * for update.
+ *
+ * @param input the view input.
+ * @param context the presentation context.
+ * @param menu the menu to file the action.
+ */
+ void fillMenu(Object input, IPresentationContext context, Menu menu);
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
index 99293d41f..79519b1b5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/WorkingSetCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -133,5 +133,9 @@ public class WorkingSetCategory extends PlatformObject implements IWorkbenchAdap
private boolean isDefault() {
return fWorkingSet.equals(BreakpointSetOrganizer.getDefaultWorkingSet());
}
+
+ public String toString() {
+ return fWorkingSet.getName();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
index bdd9de2b0..a9a0f80f4 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java
@@ -37,6 +37,7 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
@@ -101,7 +102,7 @@ public class ExpressionView extends VariablesView {
*/
protected void contextActivated(ISelection selection) {
if (selection == null || selection.isEmpty()) {
- setViewerInput(DebugPlugin.getDefault().getExpressionManager());
+ super.contextActivated(new StructuredSelection(DebugPlugin.getDefault().getExpressionManager()));
} else {
super.contextActivated(selection);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
index 00620344c..d95b7e5fc 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
* Wind River Systems - support for alternative expression view content providers
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.launch;
@@ -15,6 +16,7 @@ import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.IExpressionManager;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IExpression;
@@ -25,7 +27,9 @@ import org.eclipse.debug.core.model.IRegisterGroup;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.elements.adapters.AsynchronousDebugLabelAdapter;
+import org.eclipse.debug.internal.ui.elements.adapters.DefaultBreakpointManagerInput;
import org.eclipse.debug.internal.ui.elements.adapters.DefaultViewerInputProvider;
import org.eclipse.debug.internal.ui.elements.adapters.MemoryBlockContentAdapter;
import org.eclipse.debug.internal.ui.elements.adapters.MemoryBlockLabelAdapter;
@@ -34,6 +38,13 @@ import org.eclipse.debug.internal.ui.elements.adapters.MemorySegmentLabelAdapter
import org.eclipse.debug.internal.ui.elements.adapters.StackFrameSourceDisplayAdapter;
import org.eclipse.debug.internal.ui.elements.adapters.StackFrameViewerInputProvider;
import org.eclipse.debug.internal.ui.elements.adapters.VariableColumnFactoryAdapter;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointContainerLabelProvider;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointContainerMementoProvider;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointContentProvider;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointLabelProvider;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointManagerContentProvider;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointManagerInputMementoProvider;
+import org.eclipse.debug.internal.ui.model.elements.BreakpointMementoProvider;
import org.eclipse.debug.internal.ui.model.elements.DebugElementLabelProvider;
import org.eclipse.debug.internal.ui.model.elements.DebugTargetContentProvider;
import org.eclipse.debug.internal.ui.model.elements.ExpressionContentProvider;
@@ -89,8 +100,9 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
private static IElementLabelProvider fgLPVariable = new VariableLabelProvider();
private static IElementLabelProvider fgLPExpression = new ExpressionLabelProvider();
private static IElementLabelProvider fgLPRegisterGroup = new RegisterGroupLabelProvider();
- private static IElementLabelProvider fgLPMemoryBlock = new MemoryBlockLabelProvider();
-
+ private static IElementLabelProvider fgLPMemoryBlock = new MemoryBlockLabelProvider();
+ private static IElementLabelProvider fgLPBreakpoint = new BreakpointLabelProvider();
+ private static IElementLabelProvider fgLPBreakpointContainer = new BreakpointContainerLabelProvider();
private static IElementEditor fgEEVariable = new VariableEditor();
private static IAsynchronousContentAdapter fgAsyncMemoryRetrieval = new MemoryRetrievalContentAdapter();
@@ -102,11 +114,13 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
private static IElementContentProvider fgCPThread = new ThreadContentProvider();
private static IElementContentProvider fgCPFrame = new StackFrameContentProvider();
private static IElementContentProvider fgCPVariable = new VariableContentProvider();
- private static IElementContentProvider fgCPExpressionManager = new ExpressionManagerContentProvider();
+ private static IElementContentProvider fgCPExpressionManager = new ExpressionManagerContentProvider();
private static IElementContentProvider fgCPExpression = new ExpressionContentProvider();
private static IElementContentProvider fgCPRegisterGroup = new RegisterGroupContentProvider();
private static IElementContentProvider fgCPMemoryRetrieval = new MemoryRetrievalContentProvider();
- private static IElementContentProvider fgCPMemoryBlock = new MemoryBlockContentProvider();
+ private static IElementContentProvider fgCPMemoryBlock = new MemoryBlockContentProvider();
+ private static IElementContentProvider fgCPBreakpointManager = new BreakpointManagerContentProvider();
+ private static IElementContentProvider fgCPBreakpoint = new BreakpointContentProvider();
private static IElementMementoProvider fgMPFrame = new StackFrameMementoProvider();
private static IElementMementoProvider fgMPVariable = new VariableMementoProvider();
@@ -114,6 +128,9 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
private static IElementMementoProvider fgMPRegisterGroup = new RegisterGroupMementoProvider();
private static IElementMementoProvider fgMPExpressionManager = new ExpressionManagerMementoProvider();
private static IElementMementoProvider fgMPMemory = new MemoryViewElementMementoProvider();
+ private static IElementMementoProvider fgMPBreakpointManagerInput = new BreakpointManagerInputMementoProvider();
+ private static IElementMementoProvider fgMPBreakpointContainer = new BreakpointContainerMementoProvider();
+ private static IElementMementoProvider fgMPBreakpoint = new BreakpointMementoProvider();
private static IColumnPresentationFactory fgVariableColumnFactory = new VariableColumnFactoryAdapter();
@@ -162,7 +179,7 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
}
if (adaptableObject instanceof IExpressionManager) {
return fgCPExpressionManager;
- }
+ }
if (adaptableObject instanceof IExpression) {
return fgCPExpression;
}
@@ -171,6 +188,12 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
}
if (adaptableObject instanceof IMemoryBlock) {
return fgCPMemoryBlock;
+ }
+ if (adaptableObject instanceof DefaultBreakpointManagerInput) {
+ return fgCPBreakpointManager;
+ }
+ if (adaptableObject instanceof IBreakpoint) {
+ return fgCPBreakpoint;
}
}
@@ -197,7 +220,13 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
}
if (adaptableObject instanceof IMemoryBlock) {
return fgLPMemoryBlock;
+ }
+ if (adaptableObject instanceof IBreakpoint) {
+ return fgLPBreakpoint;
}
+ if (adaptableObject instanceof IBreakpointContainer) {
+ return fgLPBreakpointContainer;
+ }
return fgLPDebugElement;
}
@@ -206,7 +235,10 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
adaptableObject instanceof IProcess || adaptableObject instanceof ILaunchManager ||
adaptableObject instanceof IStackFrame || adaptableObject instanceof IExpressionManager ||
adaptableObject instanceof IExpression || adaptableObject instanceof IMemoryBlockRetrieval ||
- adaptableObject instanceof IMemoryBlock)
+ adaptableObject instanceof IMemoryBlock ||
+ adaptableObject instanceof DefaultBreakpointManagerInput ||
+ adaptableObject instanceof IBreakpoint ||
+ adaptableObject instanceof IBreakpointContainer)
return fgModelProxyFactoryAdapter;
}
@@ -247,6 +279,15 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
if (adaptableObject instanceof IMemoryBlockRetrieval) {
return fgMPMemory;
}
+ if (adaptableObject instanceof IBreakpoint) {
+ return fgMPBreakpoint;
+ }
+ if (adaptableObject instanceof IBreakpointContainer) {
+ return fgMPBreakpointContainer;
+ }
+ if (adaptableObject instanceof DefaultBreakpointManagerInput) {
+ return fgMPBreakpointManagerInput;
+ }
}
if (adapterType.equals(IElementEditor.class)) {
@@ -261,7 +302,7 @@ public class DebugElementAdapterFactory implements IAdapterFactory {
} else {
return fgDefaultViewerInputProvider;
}
- }
+ }
return null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
index 7e03edb9f..d43f4c76f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
@@ -13,6 +13,7 @@
* Wind River - Pawel Piech - NPE when closing the Variables view (Bug 213719)
* Wind River - Pawel Piech - Fix viewer input race condition (Bug 234908)
* Wind River - Anton Leherbauer - Fix selection provider (Bug 254442)
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables;
@@ -204,7 +205,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* The model presentation used as the label provider for the tree viewer,
* and also as the detail information provider for the detail pane.
*/
- private VariablesViewModelPresentation fModelPresentation;
+ protected VariablesViewModelPresentation fModelPresentation;
/**
* The UI construct that provides a sliding sash between the variables tree
@@ -447,7 +448,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
// create the sash form that will contain the tree viewer & text viewer
fSashForm = new SashForm(parent, SWT.NONE);
- fModelPresentation = new VariablesViewModelPresentation();
+ getModelPresentation();
DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
JFaceResources.getFontRegistry().addListener(this);
@@ -1093,7 +1094,7 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
* @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden()
*/
protected void becomesHidden() {
- fInputService.resolveViewerInput(null);
+ fInputService.resolveViewerInput(ViewerInputService.NULL_INPUT);
super.becomesHidden();
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
index 7b55abc0c..421605ed9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPane.java
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640)
* Wind River - Anton Leherbauer - Fix selection provider (Bug 254442)
+ * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956)
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.variables.details;
@@ -16,7 +17,7 @@ import java.util.Iterator;
import java.util.ResourceBundle;
import org.eclipse.core.commands.operations.IUndoContext;
-
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -24,6 +25,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IExpression;
import org.eclipse.debug.core.model.IValue;
@@ -37,6 +39,7 @@ import org.eclipse.debug.internal.ui.VariablesViewModelPresentation;
import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneAssignValueAction;
import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneMaxLengthAction;
import org.eclipse.debug.internal.ui.actions.variables.details.DetailPaneWordWrapAction;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants;
import org.eclipse.debug.internal.ui.views.variables.IndexedValuePartition;
import org.eclipse.debug.ui.IDebugModelPresentation;
@@ -92,11 +95,11 @@ import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.console.actions.TextViewerAction;
import org.eclipse.ui.handlers.IHandlerActivation;
import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.operations.OperationHistoryActionHandler;
import org.eclipse.ui.operations.RedoActionHandler;
import org.eclipse.ui.operations.UndoActionHandler;
import org.eclipse.ui.progress.WorkbenchJob;
-
import org.eclipse.ui.texteditor.FindReplaceAction;
import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -198,6 +201,20 @@ public class DefaultDetailPane extends AbstractDetailPane implements IDetailPane
}
} else if (element instanceof IExpression) {
val = ((IExpression)element).getValue();
+ } else if (element instanceof IBreakpoint) {
+ IBreakpoint bp = (IBreakpoint) element;
+ message = bp.getMarker().getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ } else if (element instanceof IBreakpointContainer) {
+ IBreakpointContainer c = (IBreakpointContainer) element;
+ IAdaptable category = c.getCategory();
+ if (category != null) {
+ IWorkbenchAdapter adapter = (IWorkbenchAdapter) category.getAdapter(IWorkbenchAdapter.class);
+ if (adapter != null) {
+ message = adapter.getLabel(category);
+ } else {
+ message = c.getOrganizer().getLabel();
+ }
+ }
}
// When selecting a index partition, clear the pane
if (val instanceof IndexedValuePartition) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java
index 438180c23..8c1b2ad45 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -16,7 +16,7 @@ import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.views.breakpoints.OtherBreakpointCategory;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java
index 32e60a036..1ce0c4672 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -106,4 +106,8 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin
public Object getParent(Object o) {
return null;
}
+
+ public String toString() {
+ return fName;
+ }
}

Back to the top