mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 00:36:16 +02:00
Bug 302628: Implement linking of active debug context with selection in Breakpoints view (fixed coding mistake reported by Patrick in comment 14)
This commit is contained in:
parent
75a65c4f96
commit
ba8fbc6c87
1 changed files with 382 additions and 382 deletions
|
@ -1,382 +1,382 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
* Copyright (c) 2006, 2008 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints;
|
package org.eclipse.cdt.dsf.debug.ui.viewmodel.breakpoints;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
import org.eclipse.cdt.dsf.concurrent.DsfRunnable;
|
||||||
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
|
||||||
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
|
||||||
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
import org.eclipse.cdt.dsf.datamodel.DMContexts;
|
||||||
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
import org.eclipse.cdt.dsf.datamodel.IDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
|
||||||
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.IExpressionVMNode;
|
import org.eclipse.cdt.dsf.debug.ui.viewmodel.expression.IExpressionVMNode;
|
||||||
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
import org.eclipse.cdt.dsf.internal.ui.DsfUIPlugin;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter;
|
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMAdapter;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
|
import org.eclipse.cdt.dsf.ui.viewmodel.AbstractVMProvider;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.IVMModelProxy;
|
import org.eclipse.cdt.dsf.ui.viewmodel.IVMModelProxy;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
|
import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||||
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.RootDMVMNode;
|
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.RootDMVMNode;
|
||||||
import org.eclipse.core.resources.IMarkerDelta;
|
import org.eclipse.core.resources.IMarkerDelta;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.IBreakpointsListener;
|
import org.eclipse.debug.core.IBreakpointsListener;
|
||||||
import org.eclipse.debug.core.model.IBreakpoint;
|
import org.eclipse.debug.core.model.IBreakpoint;
|
||||||
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
|
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer;
|
||||||
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
|
import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants;
|
||||||
import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
|
import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
|
||||||
import org.eclipse.debug.internal.ui.elements.adapters.DefaultBreakpointsViewInput;
|
import org.eclipse.debug.internal.ui.elements.adapters.DefaultBreakpointsViewInput;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
|
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.IPresentationContext;
|
||||||
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
|
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
|
import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
|
||||||
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
import org.eclipse.debug.ui.contexts.DebugContextEvent;
|
||||||
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
import org.eclipse.debug.ui.contexts.IDebugContextListener;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.TreePath;
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The expression provider is used to populate the contents of the expressions
|
* The expression provider is used to populate the contents of the expressions
|
||||||
* view. The node hierarchy in this view is a little different than in a typical
|
* view. The node hierarchy in this view is a little different than in a typical
|
||||||
* provider: the expression manager node should be registered as the single child
|
* provider: the expression manager node should be registered as the single child
|
||||||
* of the root node and no nodes should be registered as children of expression node.
|
* of the root node and no nodes should be registered as children of expression node.
|
||||||
* Instead the top level expression nodes should be registered with a call to
|
* Instead the top level expression nodes should be registered with a call to
|
||||||
* {@link #setExpressionNodes(IExpressionVMNode[])}. And each expression node can
|
* {@link #setExpressionNodes(IExpressionVMNode[])}. And each expression node can
|
||||||
* have its own sub-hierarchy of elements as needed. However all nodes configured
|
* have its own sub-hierarchy of elements as needed. However all nodes configured
|
||||||
* with this provider (with the exception of the root and the expression manager)
|
* with this provider (with the exception of the root and the expression manager)
|
||||||
* should implement {@link IExpressionVMNode}.
|
* should implement {@link IExpressionVMNode}.
|
||||||
*
|
*
|
||||||
* @since 2.1
|
* @since 2.1
|
||||||
*/
|
*/
|
||||||
public class BreakpointVMProvider extends AbstractVMProvider
|
public class BreakpointVMProvider extends AbstractVMProvider
|
||||||
{
|
{
|
||||||
private IPropertyChangeListener fPresentationContextListener = new IPropertyChangeListener() {
|
private IPropertyChangeListener fPresentationContextListener = new IPropertyChangeListener() {
|
||||||
public void propertyChange(PropertyChangeEvent event) {
|
public void propertyChange(PropertyChangeEvent event) {
|
||||||
handleEventInExecThread(event);
|
handleEventInExecThread(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private IBreakpointsListener fBreakpointsListener = new IBreakpointsListener() {
|
private IBreakpointsListener fBreakpointsListener = new IBreakpointsListener() {
|
||||||
public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
|
public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
|
||||||
handleEventInExecThread(new BreakpointsChangedEvent(BreakpointsChangedEvent.Type.REMOVED, breakpoints));
|
handleEventInExecThread(new BreakpointsChangedEvent(BreakpointsChangedEvent.Type.REMOVED, breakpoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
|
public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
|
||||||
handleEventInExecThread(new BreakpointsChangedEvent(BreakpointsChangedEvent.Type.CHANGED, breakpoints));
|
handleEventInExecThread(new BreakpointsChangedEvent(BreakpointsChangedEvent.Type.CHANGED, breakpoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void breakpointsAdded(IBreakpoint[] breakpoints) {
|
public void breakpointsAdded(IBreakpoint[] breakpoints) {
|
||||||
handleEventInExecThread(new BreakpointsChangedEvent(BreakpointsChangedEvent.Type.ADDED, breakpoints));
|
handleEventInExecThread(new BreakpointsChangedEvent(BreakpointsChangedEvent.Type.ADDED, breakpoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
|
private IDebugContextListener fDebugContextListener = new IDebugContextListener() {
|
||||||
public void debugContextChanged(final DebugContextEvent event) {
|
public void debugContextChanged(final DebugContextEvent event) {
|
||||||
handleEventInExecThread(event);
|
handleEventInExecThread(event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private class ContainerBreakpointsCache extends DataCache<List<BreakpointOrganizerVMContext>> {
|
private class ContainerBreakpointsCache extends DataCache<List<BreakpointOrganizerVMContext>> {
|
||||||
|
|
||||||
private BreakpointOrganizerVMNode fOrganizerVMNode;
|
private BreakpointOrganizerVMNode fOrganizerVMNode;
|
||||||
private TreePath fParentPath;
|
private TreePath fParentPath;
|
||||||
|
|
||||||
public ContainerBreakpointsCache(BreakpointOrganizerVMNode organizerVMNode, TreePath parentPath) {
|
public ContainerBreakpointsCache(BreakpointOrganizerVMNode organizerVMNode, TreePath parentPath) {
|
||||||
super(getExecutor());
|
super(getExecutor());
|
||||||
fOrganizerVMNode = organizerVMNode;
|
fOrganizerVMNode = organizerVMNode;
|
||||||
fParentPath = parentPath;
|
fParentPath = parentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void retrieve(final DataRequestMonitor<List<BreakpointOrganizerVMContext>> rm) {
|
protected void retrieve(final DataRequestMonitor<List<BreakpointOrganizerVMContext>> rm) {
|
||||||
getNestingCategoryBreakpoints(
|
getNestingCategoryBreakpoints(
|
||||||
fParentPath,
|
fParentPath,
|
||||||
new DataRequestMonitor<IBreakpoint[]>(getExecutor(), rm) {
|
new DataRequestMonitor<IBreakpoint[]>(getExecutor(), rm) {
|
||||||
@SuppressWarnings({ "cast", "unchecked" })
|
@SuppressWarnings({ "cast", "unchecked" })
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
Map<IAdaptable, List<IBreakpoint>> bpsLists = new HashMap<IAdaptable, List<IBreakpoint>>();
|
Map<IAdaptable, List<IBreakpoint>> bpsLists = new HashMap<IAdaptable, List<IBreakpoint>>();
|
||||||
for (IBreakpoint bp : getData()) {
|
for (IBreakpoint bp : getData()) {
|
||||||
IAdaptable[] bpCategories = fOrganizerVMNode.getOrganizer().getCategories(bp);
|
IAdaptable[] bpCategories = fOrganizerVMNode.getOrganizer().getCategories(bp);
|
||||||
if (bpCategories == null || bpCategories.length == 0) {
|
if (bpCategories == null || bpCategories.length == 0) {
|
||||||
bpCategories = OtherBreakpointCategory.getCategories(fOrganizerVMNode.getOrganizer());
|
bpCategories = OtherBreakpointCategory.getCategories(fOrganizerVMNode.getOrganizer());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IAdaptable category : bpCategories) {
|
for (IAdaptable category : bpCategories) {
|
||||||
List<IBreakpoint> categoryBPs = bpsLists.get(category);
|
List<IBreakpoint> categoryBPs = bpsLists.get(category);
|
||||||
if (categoryBPs == null) {
|
if (categoryBPs == null) {
|
||||||
categoryBPs = new ArrayList<IBreakpoint>();
|
categoryBPs = new ArrayList<IBreakpoint>();
|
||||||
bpsLists.put(category, categoryBPs);
|
bpsLists.put(category, categoryBPs);
|
||||||
}
|
}
|
||||||
categoryBPs.add(bp);
|
categoryBPs.add(bp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show the empty containers for the top-level node.
|
// Only show the empty containers for the top-level node.
|
||||||
if (fParentPath.getSegmentCount() == 0) {
|
if (fParentPath.getSegmentCount() == 0) {
|
||||||
final IAdaptable[] independentCategories = fOrganizerVMNode.getOrganizer().getCategories();
|
final IAdaptable[] independentCategories = fOrganizerVMNode.getOrganizer().getCategories();
|
||||||
if (independentCategories != null) {
|
if (independentCategories != null) {
|
||||||
for (IAdaptable category : independentCategories) {
|
for (IAdaptable category : independentCategories) {
|
||||||
if (!bpsLists.containsKey(category)) {
|
if (!bpsLists.containsKey(category)) {
|
||||||
bpsLists.put(category, (List<IBreakpoint>)Collections.EMPTY_LIST);
|
bpsLists.put(category, (List<IBreakpoint>)Collections.EMPTY_LIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BreakpointOrganizerVMContext> vmcs = new ArrayList<BreakpointOrganizerVMContext>(bpsLists.size());
|
List<BreakpointOrganizerVMContext> vmcs = new ArrayList<BreakpointOrganizerVMContext>(bpsLists.size());
|
||||||
for (Map.Entry<IAdaptable, List<IBreakpoint>> entry : bpsLists.entrySet()) {
|
for (Map.Entry<IAdaptable, List<IBreakpoint>> entry : bpsLists.entrySet()) {
|
||||||
List<IBreakpoint> bpsList = entry.getValue();
|
List<IBreakpoint> bpsList = entry.getValue();
|
||||||
IBreakpoint[] bpsArray = bpsList.toArray(new IBreakpoint[bpsList.size()]);
|
IBreakpoint[] bpsArray = bpsList.toArray(new IBreakpoint[bpsList.size()]);
|
||||||
|
|
||||||
vmcs.add(createBreakpointOrganizerVMContext(fOrganizerVMNode, entry.getKey(), bpsArray));
|
vmcs.add(createBreakpointOrganizerVMContext(fOrganizerVMNode, entry.getKey(), bpsArray));
|
||||||
}
|
}
|
||||||
Comparator<Object> comparator = (Comparator<Object>)getPresentationContext().getProperty(
|
Comparator<Object> comparator = (Comparator<Object>)getPresentationContext().getProperty(
|
||||||
IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR);
|
IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR);
|
||||||
if (comparator != null) {
|
if (comparator != null) {
|
||||||
Collections.sort(vmcs, comparator);
|
Collections.sort(vmcs, comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
rm.setData(vmcs);
|
rm.setData(vmcs);
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Map<TreePath, ContainerBreakpointsCache> fContainerBreakpointsCacheMap =
|
private final Map<TreePath, ContainerBreakpointsCache> fContainerBreakpointsCacheMap =
|
||||||
new HashMap<TreePath, ContainerBreakpointsCache>();
|
new HashMap<TreePath, ContainerBreakpointsCache>();
|
||||||
|
|
||||||
private DataCache<IBreakpoint[]> fFilteredBreakpointsCache = new DataCache<IBreakpoint[]>(getExecutor()) {
|
private DataCache<IBreakpoint[]> fFilteredBreakpointsCache = new DataCache<IBreakpoint[]>(getExecutor()) {
|
||||||
@Override
|
@Override
|
||||||
protected void retrieve(org.eclipse.cdt.dsf.concurrent.DataRequestMonitor<IBreakpoint[]> rm) {
|
protected void retrieve(org.eclipse.cdt.dsf.concurrent.DataRequestMonitor<IBreakpoint[]> rm) {
|
||||||
calcFileteredBreakpoints(rm);
|
calcFileteredBreakpoints(rm);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public BreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext context) {
|
public BreakpointVMProvider(AbstractVMAdapter adapter, IPresentationContext context) {
|
||||||
super(adapter, context);
|
super(adapter, context);
|
||||||
|
|
||||||
// Create the top level node which provides the anchor starting point.
|
// Create the top level node which provides the anchor starting point.
|
||||||
// This node is referenced by the BreakpointVMInput element so it
|
// This node is referenced by the BreakpointVMInput element so it
|
||||||
// should not change when the view layout is updated.
|
// should not change when the view layout is updated.
|
||||||
setRootNode(new RootDMVMNode(this));
|
setRootNode(new RootDMVMNode(this));
|
||||||
// Configure the rest of the layout nodes.
|
// Configure the rest of the layout nodes.
|
||||||
configureLayout();
|
configureLayout();
|
||||||
|
|
||||||
context.addPropertyChangeListener(fPresentationContextListener);
|
context.addPropertyChangeListener(fPresentationContextListener);
|
||||||
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(fBreakpointsListener);
|
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(fBreakpointsListener);
|
||||||
IWorkbenchWindow window = context.getWindow();
|
IWorkbenchWindow window = context.getWindow();
|
||||||
if (window != null) {
|
if (window != null) {
|
||||||
DebugUITools.getDebugContextManager().getContextService(window).addDebugContextListener(
|
DebugUITools.getDebugContextManager().getContextService(window).addDebugContextListener(
|
||||||
fDebugContextListener);
|
fDebugContextListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IVMModelProxy createModelProxyStrategy(Object rootElement) {
|
protected IVMModelProxy createModelProxyStrategy(Object rootElement) {
|
||||||
return new BreakpointVMModelProxyStrategy(this, rootElement);
|
return new BreakpointVMModelProxyStrategy(this, rootElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IVMNode createBreakpointVMNode() {
|
protected IVMNode createBreakpointVMNode() {
|
||||||
return new BreakpointVMNode(this);
|
return new BreakpointVMNode(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the nodes of this provider. This method may be over-ridden by
|
* Configures the nodes of this provider. This method may be over-ridden by
|
||||||
* sub classes to create an alternate configuration in this provider.
|
* sub classes to create an alternate configuration in this provider.
|
||||||
*/
|
*/
|
||||||
protected void configureLayout() {
|
protected void configureLayout() {
|
||||||
IBreakpointOrganizer[] organizers = (IBreakpointOrganizer[])
|
IBreakpointOrganizer[] organizers = (IBreakpointOrganizer[])
|
||||||
getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS);
|
getPresentationContext().getProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS);
|
||||||
|
|
||||||
IVMNode parentNode = getRootVMNode();
|
IVMNode parentNode = getRootVMNode();
|
||||||
if (organizers != null) {
|
if (organizers != null) {
|
||||||
for (IBreakpointOrganizer organizer : organizers) {
|
for (IBreakpointOrganizer organizer : organizers) {
|
||||||
IVMNode organizerNode = new BreakpointOrganizerVMNode(this, organizer);
|
IVMNode organizerNode = new BreakpointOrganizerVMNode(this, organizer);
|
||||||
addChildNodes(parentNode, new IVMNode[] {organizerNode});
|
addChildNodes(parentNode, new IVMNode[] {organizerNode});
|
||||||
parentNode = organizerNode;
|
parentNode = organizerNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IVMNode bpsNode = createBreakpointVMNode();
|
IVMNode bpsNode = createBreakpointVMNode();
|
||||||
addChildNodes(parentNode, new IVMNode[] {bpsNode});
|
addChildNodes(parentNode, new IVMNode[] {bpsNode});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
getPresentationContext().removePropertyChangeListener(fPresentationContextListener);
|
getPresentationContext().removePropertyChangeListener(fPresentationContextListener);
|
||||||
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(fBreakpointsListener);
|
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(fBreakpointsListener);
|
||||||
IWorkbenchWindow window = getPresentationContext().getWindow();
|
IWorkbenchWindow window = getPresentationContext().getWindow();
|
||||||
if (window != null) {
|
if (window != null) {
|
||||||
DebugUITools.getDebugContextManager().getContextService(window).addDebugContextListener(
|
DebugUITools.getDebugContextManager().getContextService(window).removeDebugContextListener(
|
||||||
fDebugContextListener);
|
fDebugContextListener);
|
||||||
}
|
}
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
|
public IColumnPresentation createColumnPresentation(IPresentationContext context, Object element) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColumnPresentationId(IPresentationContext context, Object element) {
|
public String getColumnPresentationId(IPresentationContext context, Object element) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(IViewerInputUpdate update) {
|
public void update(IViewerInputUpdate update) {
|
||||||
IDMContext activeDMContext = null;
|
IDMContext activeDMContext = null;
|
||||||
if (update.getElement() instanceof IDMVMContext) {
|
if (update.getElement() instanceof IDMVMContext) {
|
||||||
activeDMContext = ((IDMVMContext)update.getElement()).getDMContext();
|
activeDMContext = ((IDMVMContext)update.getElement()).getDMContext();
|
||||||
activeDMContext = DMContexts.getAncestorOfType(activeDMContext, IBreakpointsTargetDMContext.class);
|
activeDMContext = DMContexts.getAncestorOfType(activeDMContext, IBreakpointsTargetDMContext.class);
|
||||||
}
|
}
|
||||||
if (activeDMContext != null) {
|
if (activeDMContext != null) {
|
||||||
update.setInputElement(new BreakpointVMInput(getRootVMNode(), activeDMContext));
|
update.setInputElement(new BreakpointVMInput(getRootVMNode(), activeDMContext));
|
||||||
} else {
|
} else {
|
||||||
// If no breakpoints target found in active context, delegate the breakpoint
|
// If no breakpoints target found in active context, delegate the breakpoint
|
||||||
// presentation to the default: breakpoint manager.
|
// presentation to the default: breakpoint manager.
|
||||||
update.setInputElement(new DefaultBreakpointsViewInput(update.getPresentationContext()));
|
update.setInputElement(new DefaultBreakpointsViewInput(update.getPresentationContext()));
|
||||||
}
|
}
|
||||||
update.done();
|
update.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getNestingCategoryBreakpoints(TreePath path, final DataRequestMonitor<IBreakpoint[]> rm) {
|
public void getNestingCategoryBreakpoints(TreePath path, final DataRequestMonitor<IBreakpoint[]> rm) {
|
||||||
BreakpointOrganizerVMContext nestingOrganizerVmc = null;
|
BreakpointOrganizerVMContext nestingOrganizerVmc = null;
|
||||||
while (path.getSegmentCount() > 0) {
|
while (path.getSegmentCount() > 0) {
|
||||||
if (path.getLastSegment() instanceof BreakpointOrganizerVMContext) {
|
if (path.getLastSegment() instanceof BreakpointOrganizerVMContext) {
|
||||||
nestingOrganizerVmc = (BreakpointOrganizerVMContext)path.getLastSegment();
|
nestingOrganizerVmc = (BreakpointOrganizerVMContext)path.getLastSegment();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
path = path.getParentPath();
|
path = path.getParentPath();
|
||||||
}
|
}
|
||||||
if (nestingOrganizerVmc == null) {
|
if (nestingOrganizerVmc == null) {
|
||||||
getFileteredBreakpoints(rm);
|
getFileteredBreakpoints(rm);
|
||||||
} else {
|
} else {
|
||||||
final BreakpointOrganizerVMContext _nestingOrganizerVmc = nestingOrganizerVmc;
|
final BreakpointOrganizerVMContext _nestingOrganizerVmc = nestingOrganizerVmc;
|
||||||
getBreakpointOrganizerVMCs(
|
getBreakpointOrganizerVMCs(
|
||||||
(BreakpointOrganizerVMNode)_nestingOrganizerVmc.getVMNode(), path.getParentPath(),
|
(BreakpointOrganizerVMNode)_nestingOrganizerVmc.getVMNode(), path.getParentPath(),
|
||||||
new DataRequestMonitor<List<BreakpointOrganizerVMContext>>(getExecutor(), rm) {
|
new DataRequestMonitor<List<BreakpointOrganizerVMContext>>(getExecutor(), rm) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
int newVmcIdx = getData().indexOf(_nestingOrganizerVmc);
|
int newVmcIdx = getData().indexOf(_nestingOrganizerVmc);
|
||||||
|
|
||||||
if (newVmcIdx >= 0) {
|
if (newVmcIdx >= 0) {
|
||||||
rm.setData(getData().get(newVmcIdx).getBreakpoints());
|
rm.setData(getData().get(newVmcIdx).getBreakpoints());
|
||||||
} else {
|
} else {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Breakpoint category not found", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.INVALID_HANDLE, "Breakpoint category not found", null)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getBreakpointOrganizerVMCs(BreakpointOrganizerVMNode organizerVMNode, TreePath path,
|
public void getBreakpointOrganizerVMCs(BreakpointOrganizerVMNode organizerVMNode, TreePath path,
|
||||||
DataRequestMonitor<List<BreakpointOrganizerVMContext>> rm)
|
DataRequestMonitor<List<BreakpointOrganizerVMContext>> rm)
|
||||||
{
|
{
|
||||||
ContainerBreakpointsCache cache = fContainerBreakpointsCacheMap.get(path);
|
ContainerBreakpointsCache cache = fContainerBreakpointsCacheMap.get(path);
|
||||||
if (cache == null) {
|
if (cache == null) {
|
||||||
cache = new ContainerBreakpointsCache(organizerVMNode, path);
|
cache = new ContainerBreakpointsCache(organizerVMNode, path);
|
||||||
fContainerBreakpointsCacheMap.put(path, cache);
|
fContainerBreakpointsCacheMap.put(path, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.request(rm);
|
cache.request(rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected BreakpointOrganizerVMContext createBreakpointOrganizerVMContext(BreakpointOrganizerVMNode node, IAdaptable category, IBreakpoint[] breakpoints) {
|
protected BreakpointOrganizerVMContext createBreakpointOrganizerVMContext(BreakpointOrganizerVMNode node, IAdaptable category, IBreakpoint[] breakpoints) {
|
||||||
return new BreakpointOrganizerVMContext(node, category, breakpoints);
|
return new BreakpointOrganizerVMContext(node, category, breakpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getFileteredBreakpoints(final DataRequestMonitor<IBreakpoint[]> rm) {
|
public void getFileteredBreakpoints(final DataRequestMonitor<IBreakpoint[]> rm) {
|
||||||
fFilteredBreakpointsCache.request(rm);
|
fFilteredBreakpointsCache.request(rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void calcFileteredBreakpoints(DataRequestMonitor<IBreakpoint[]> rm) {
|
protected void calcFileteredBreakpoints(DataRequestMonitor<IBreakpoint[]> rm) {
|
||||||
rm.setData(DebugPlugin.getDefault().getBreakpointManager().getBreakpoints());
|
rm.setData(DebugPlugin.getDefault().getBreakpointManager().getBreakpoints());
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getBreakpointsForDebugContext(ISelection debugContext, DataRequestMonitor<IBreakpoint[]> rm) {
|
public void getBreakpointsForDebugContext(ISelection debugContext, DataRequestMonitor<IBreakpoint[]> rm) {
|
||||||
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.NOT_SUPPORTED, "Not supported", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleEventInExecThread(final Object event) {
|
public void handleEventInExecThread(final Object event) {
|
||||||
getExecutor().execute(new DsfRunnable() {
|
getExecutor().execute(new DsfRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
handleEvent(event);
|
handleEvent(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Object event, RequestMonitor rm) {
|
public void handleEvent(Object event, RequestMonitor rm) {
|
||||||
if (isPresentationContextEvent(event)) {
|
if (isPresentationContextEvent(event)) {
|
||||||
PropertyChangeEvent propertyEvent = (PropertyChangeEvent)event;
|
PropertyChangeEvent propertyEvent = (PropertyChangeEvent)event;
|
||||||
if (IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS.equals(propertyEvent.getProperty()))
|
if (IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS.equals(propertyEvent.getProperty()))
|
||||||
{
|
{
|
||||||
clearNodes(false);
|
clearNodes(false);
|
||||||
configureLayout();
|
configureLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.handleEvent(event, rm);
|
super.handleEvent(event, rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPresentationContextEvent(Object event) {
|
public static boolean isPresentationContextEvent(Object event) {
|
||||||
return event instanceof PropertyChangeEvent && ((PropertyChangeEvent)event).getSource() instanceof IPresentationContext;
|
return event instanceof PropertyChangeEvent && ((PropertyChangeEvent)event).getSource() instanceof IPresentationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBreakpointOrganizerEvent(Object event) {
|
public static boolean isBreakpointOrganizerEvent(Object event) {
|
||||||
return event instanceof PropertyChangeEvent && ((PropertyChangeEvent)event).getSource() instanceof IBreakpointOrganizerDelegate;
|
return event instanceof PropertyChangeEvent && ((PropertyChangeEvent)event).getSource() instanceof IBreakpointOrganizerDelegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MODEL_DELTA_CHANGE_FLAGS = IModelDelta.STATE | IModelDelta.CONTENT | IModelDelta.ADDED | IModelDelta.REMOVED | IModelDelta.REPLACED | IModelDelta.INSERTED;
|
private static final int MODEL_DELTA_CHANGE_FLAGS = IModelDelta.STATE | IModelDelta.CONTENT | IModelDelta.ADDED | IModelDelta.REMOVED | IModelDelta.REPLACED | IModelDelta.INSERTED;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleEvent(IVMModelProxy proxyStrategy, Object event, RequestMonitor rm) {
|
protected void handleEvent(IVMModelProxy proxyStrategy, Object event, RequestMonitor rm) {
|
||||||
// Before generating a delta, flush the caches.
|
// Before generating a delta, flush the caches.
|
||||||
int deltaFlags = proxyStrategy.getEventDeltaFlags(event);
|
int deltaFlags = proxyStrategy.getEventDeltaFlags(event);
|
||||||
if ((deltaFlags & MODEL_DELTA_CHANGE_FLAGS) != 0) {
|
if ((deltaFlags & MODEL_DELTA_CHANGE_FLAGS) != 0) {
|
||||||
flushCaches();
|
flushCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.handleEvent(proxyStrategy, event, rm);
|
super.handleEvent(proxyStrategy, event, rm);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void flushCaches() {
|
private void flushCaches() {
|
||||||
fFilteredBreakpointsCache.reset();
|
fFilteredBreakpointsCache.reset();
|
||||||
for (DataCache<?> cache : fContainerBreakpointsCacheMap.values()) {
|
for (DataCache<?> cache : fContainerBreakpointsCacheMap.values()) {
|
||||||
cache.reset();
|
cache.reset();
|
||||||
}
|
}
|
||||||
fContainerBreakpointsCacheMap.clear();
|
fContainerBreakpointsCacheMap.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue