aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-05-15 00:15:49 (EDT)
committerEugene Tarassov2012-05-18 17:06:23 (EDT)
commit3fa7f3caf2d58a71a84fac4615cd54ac358d1893 (patch)
treeaa67292336f13703e1913cb384bce606bd6e33c3
parenta2a04cd35bf629724d974c7aba2fdae3a6bb677e (diff)
downloadorg.eclipse.tcf-3fa7f3caf2d58a71a84fac4615cd54ac358d1893.zip
org.eclipse.tcf-3fa7f3caf2d58a71a84fac4615cd54ac358d1893.tar.gz
org.eclipse.tcf-3fa7f3caf2d58a71a84fac4615cd54ac358d1893.tar.bz2
US3739 - Grouping Breakpoints by Trigger Scope
Added ability to edit scope group.
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/plugin.properties6
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/plugin.xml61
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategory.java106
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategoryPropertiesHandler.java73
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeOrganizer.java72
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/Messages.java5
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java84
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java20
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java8
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/messages.properties4
10 files changed, 371 insertions, 68 deletions
diff --git a/plugins/org.eclipse.tcf.cdt.ui/plugin.properties b/plugins/org.eclipse.tcf.cdt.ui/plugin.properties
index 487daf6..cb00040 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/plugin.properties
+++ b/plugins/org.eclipse.tcf.cdt.ui/plugin.properties
@@ -31,13 +31,19 @@ launchDelegate.attach.name=TCF Attach to Process
launchDelegate.attach.description=Attach to a running local or remote program.
action.addWatchpoint.label=Add Watchpoint (C/C++)...
+action.breakpointScope.label=Scope Properties...
command.addFunctionBreakpoint.name=Add Function Breakpoint (C/C++)
command.addFunctionBreakpoint.desc=Allows to add a new function breakpoint on an arbitrary symbol
command.addWatchpoint.name=Add Watchpoint (C/C++)
command.addWatchpoint.desc=Allows to add a new watchpoint on an arbitrary symbol
+command.scopeProperties.name=Breakpoint Scope Properties
+command.scopeProperties.desc=Edits the breakpoint scope settings of the given group of breakpoints.
+
item.addFunctionBreakpoint.name=Add Function Breakpoint (C/C++)...
item.addWatchpoint.name=Add Watchpoint...
editor.sourceNotFound.name=Source Not Found
+
+breakpointScope.label=Scope
diff --git a/plugins/org.eclipse.tcf.cdt.ui/plugin.xml b/plugins/org.eclipse.tcf.cdt.ui/plugin.xml
index 4df37c0..195c532 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/plugin.xml
+++ b/plugins/org.eclipse.tcf.cdt.ui/plugin.xml
@@ -75,12 +75,25 @@
name="%breakpoints.filterPage.name">
<filter name="debugModelId" value="org.eclipse.tcf.debug"/>
<enabledWhen>
- <and>
- <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
- <not>
- <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
- </not>
- </and>
+ <and>
+ <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
+ <not>
+ <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
+ </not>
+ </and>
+ </enabledWhen>
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.ui.propertyPages">
+ <page class="org.eclipse.tcf.internal.cdt.ui.breakpoints.TCFBreakpointThreadFilterPage"
+ id="org.eclipse.tcf.breakpoint.scope.filtering"
+ name="%breakpoints.filterPage.name">
+ <enabledWhen>
+ <and>
+ <instanceof
+ value="org.eclipse.tcf.internal.cdt.ui.breakpoints.BreakpointScopeCategory"/>
+ </and>
</enabledWhen>
</page>
</extension>
@@ -286,6 +299,12 @@
id="org.eclipse.tcf.cdt.ui.add_watchpoint"
name="%command.addWatchpoint.name">
</command>
+ <command
+ defaultHandler="org.eclipse.tcf.internal.cdt.ui.breakpoints.BreakpointScopeCategoryPropertiesHandler"
+ description="%command.scopeProperties.desc"
+ id="org.eclipse.tcf.cdt.debug.ui.command.breakpointCategoryProperties"
+ name="%command.scopeProperties.name">
+ </command>
</extension>
<extension
@@ -350,7 +369,35 @@
<breakpointOrganizer
class="org.eclipse.tcf.internal.cdt.ui.breakpoints.BreakpointScopeOrganizer"
id="org.eclipse.tcf.cdt.ui.breakpointScopeGroup"
- label="Scope">
+ label="%breakpointScope.label">
</breakpointOrganizer>
</extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.debug.ui.BreakpointView?after=additions">
+ <command
+ commandId="org.eclipse.tcf.cdt.debug.ui.command.breakpointCategoryProperties"
+ helpContextId="breakpoint_scope_category_properties_action_context"
+ id="org.eclipse.tcf.cdt.debug.ui.menu.command.breakpointScopeCategoryProperties"
+ label="%action.breakpointScope.label">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <or>
+ <!--<instanceof value="org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer"/>-->
+ <adapt type="org.eclipse.tcf.internal.cdt.ui.breakpoints.BreakpointScopeCategory"/>
+ </or>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+
+ </extension>
+
+
</plugin>
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategory.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategory.java
index 2b57dff..caecbe3 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategory.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategory.java
@@ -10,30 +10,89 @@
*******************************************************************************/
package org.eclipse.tcf.internal.cdt.ui.breakpoints;
+import java.text.MessageFormat;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.cdt.debug.core.model.ICBreakpoint;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.tcf.internal.cdt.ui.Activator;
import org.eclipse.tcf.internal.cdt.ui.ImageCache;
+import org.eclipse.tcf.internal.debug.model.ITCFConstants;
+import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
import org.eclipse.ui.model.IWorkbenchAdapter;
/**
+ * Element which represents a breakpoint scope grouping in Breakpoints view.
+ * <p>
+ * Scope grouping contains both a filter and context IDs string, however
+ * only one of them can be active on a breakpoint at one time.
*
*/
public class BreakpointScopeCategory extends PlatformObject implements IWorkbenchAdapter {
private static Object[] EMPTY_CHILDREN_ARRAY = new Object[0];
- private final String fFilter;
+ private String fFilter;
+ private String fContextIds;
- public BreakpointScopeCategory(String filter) {
+ public BreakpointScopeCategory(String filter, String contextIds) {
fFilter = filter;
+ fContextIds = contextIds;
}
-
+
public String getFilter() {
return fFilter;
}
+ public String getContextIds() {
+ return fContextIds;
+ }
+
+ /**
+ * Sets the given filter and context strings to all breakpoints which match
+ * the group's current scope settings.
+ */
+ void setFilter(String filter, String contextIds) {
+ final List<ICBreakpoint> bps = findCategoryBreakpoints();
+ fFilter = filter;
+ fContextIds = contextIds;
+
+ if (bps.isEmpty()) return; // No breakpoints to update
+ try {
+ ResourcesPlugin.getWorkspace().run(
+ new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ for (ICBreakpoint bp : bps) {
+ getScopeExtension(bp).setPropertiesFilter(fFilter);
+ getScopeExtension(bp).setRawContextIds(fContextIds);
+ }
+ }
+ },
+ new NullProgressMonitor()
+ );
+ }
+ catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+
public String getLabel(Object o) {
- return "Scope: " + getFilter();
+ if (getFilter() != null) {
+ return MessageFormat.format(Messages.BreakpointScopeCategory_filter_label, new Object[] { getFilter() });
+ } else if (getContextIds() != null) {
+ return MessageFormat.format(Messages.BreakpointScopeCategory_contexts_label, new Object[] { getContextIds() });
+ }
+ return Messages.BreakpointScopeCategory_global_label;
}
public ImageDescriptor getImageDescriptor(Object object) {
@@ -52,12 +111,45 @@ public class BreakpointScopeCategory extends PlatformObject implements IWorkbenc
@Override
public boolean equals(Object obj) {
- return obj instanceof BreakpointScopeCategory &&
- ((BreakpointScopeCategory)obj).getFilter().equals(getFilter());
+ if (obj instanceof BreakpointScopeCategory) {
+ BreakpointScopeCategory other = (BreakpointScopeCategory)obj;
+ return ((getFilter() == null && other.getFilter() == null) ||
+ (getFilter() != null && getFilter().equals(other.getFilter()))) &&
+ ((getContextIds() == null && other.getContextIds() == null) ||
+ (getContextIds() != null && getContextIds().equals(other.getContextIds())));
+ }
+ return false;
}
@Override
public int hashCode() {
- return fFilter.hashCode();
+ return (getFilter() != null ? getFilter().hashCode() : 0) +
+ (getContextIds() != null ? getContextIds().hashCode() : 0);
+ }
+
+ private List<ICBreakpoint> findCategoryBreakpoints() {
+ List<ICBreakpoint> categoryBreakpoints = new LinkedList<ICBreakpoint>();
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
+ for (IBreakpoint bp : breakpoints) {
+ IMarker bpMarker = bp.getMarker();
+ if (bp instanceof ICBreakpoint && bpMarker != null) {
+ String filter = bpMarker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, (String)null);
+ String contextIds = bpMarker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, (String)null);
+ if( ((getFilter() == null && filter == null) ||
+ (getFilter() != null && getFilter().equals(filter))) &&
+ ((getContextIds() == null && contextIds == null) ||
+ (getContextIds() != null && getContextIds().equals(contextIds))) )
+ {
+ categoryBreakpoints.add((ICBreakpoint)bp);
+ }
+ }
+ }
+ return categoryBreakpoints;
}
+
+ private TCFBreakpointScopeExtension getScopeExtension(ICBreakpoint bp) throws CoreException {
+ return (TCFBreakpointScopeExtension) bp.getExtension(
+ ITCFConstants.ID_TCF_DEBUG_MODEL, TCFBreakpointScopeExtension.class);
+ }
+
}
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategoryPropertiesHandler.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategoryPropertiesHandler.java
new file mode 100644
index 0000000..3b78efe
--- /dev/null
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategoryPropertiesHandler.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 QNX Software 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:
+ * QNX Software Systems - Initial API and implementation
+ * Wind River Systems - Converted into a command
+ *******************************************************************************/
+package org.eclipse.tcf.internal.cdt.ui.breakpoints;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Presents a custom properties dialog to configure the attibutes of a C/C++ breakpoint.
+ */
+public class BreakpointScopeCategoryPropertiesHandler extends AbstractHandler {
+
+ /**
+ * Constructor for CBreakpointPropertiesAction.
+ */
+ public BreakpointScopeCategoryPropertiesHandler() {
+ super();
+ }
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
+ final BreakpointScopeCategory category = getScopeCategory(event.getApplicationContext());
+
+ if (part != null && category != null) {
+ PreferenceDialog dlg = PreferencesUtil.createPropertyDialogOn(part.getSite().getShell(), category, null, null, null);
+ if (dlg != null) {
+ dlg.open();
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ setBaseEnabled( getScopeCategory(evaluationContext) != null );
+ }
+
+ private BreakpointScopeCategory getScopeCategory(Object evaluationContext) {
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object s = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
+ if (s instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection)s;
+ if (ss.size() == 1 && ss.getFirstElement() instanceof IBreakpointContainer) {
+ IAdaptable category = ((IBreakpointContainer)ss.getFirstElement()).getCategory();
+ if (category instanceof BreakpointScopeCategory) {
+ return (BreakpointScopeCategory)category;
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeOrganizer.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeOrganizer.java
index 9a82dea..92b7513 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeOrganizer.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeOrganizer.java
@@ -15,21 +15,34 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
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.breakpoints.provisional.IBreakpointContainer;
import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
+import org.eclipse.debug.ui.IBreakpointOrganizerDelegate;
import org.eclipse.tcf.internal.cdt.ui.Activator;
import org.eclipse.tcf.internal.debug.model.ITCFConstants;
import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
/**
+ * Breakpoint organizer which groups breakpoints according to their
+ * breakpoint scope attributes.
*
+ * @see IBreakpointOrganizerDelegate
*/
+@SuppressWarnings("restriction")
public class BreakpointScopeOrganizer extends AbstractBreakpointOrganizerDelegate implements IBreakpointsListener {
- private static IAdaptable[] EMPTY_CATEGORY_ARRAY = new IAdaptable[0];
+ private static IAdaptable[] DEFAULT_CATEGORY_ARRAY = new IAdaptable[] { new BreakpointScopeCategory(null, null) };
+ static
+ {
+ Platform.getAdapterManager().registerAdapters(new BreakpointScopeContainerAdapterFactory(), IBreakpointContainer.class);
+ }
+
public BreakpointScopeOrganizer() {
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
}
@@ -38,11 +51,10 @@ public class BreakpointScopeOrganizer extends AbstractBreakpointOrganizerDelegat
IMarker marker = breakpoint.getMarker();
if (marker != null) {
String filter = marker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, null);
- if (filter != null) {
- return new IAdaptable[] { new BreakpointScopeCategory(filter) };
- }
+ String contextIds = marker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, null);
+ return new IAdaptable[] { new BreakpointScopeCategory(filter, contextIds) };
}
- return EMPTY_CATEGORY_ARRAY;
+ return DEFAULT_CATEGORY_ARRAY;
}
@Override
@@ -55,18 +67,10 @@ public class BreakpointScopeOrganizer extends AbstractBreakpointOrganizerDelegat
}
public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
- boolean changed = false;
-
- for (IBreakpoint breakpoint : breakpoints) {
- IMarker marker = breakpoint.getMarker();
- if (marker != null && marker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, null) != null) {
- changed = true;
- break;
- }
- }
- if (changed) {
- fireCategoryChanged(null);
- }
+ // Using delta's to see which attributes have changed is not reliable.
+ // Therefore we need to force a full refresh of scope categories whenever
+ // we get a breakpoints changed notiifcation.
+ fireCategoryChanged(null);
}
public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) {
@@ -76,6 +80,7 @@ public class BreakpointScopeOrganizer extends AbstractBreakpointOrganizerDelegat
public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) {
if (category instanceof BreakpointScopeCategory && breakpoint instanceof ICBreakpoint) {
String filter = ((BreakpointScopeCategory)category).getFilter();
+ String contextIds = ((BreakpointScopeCategory)category).getContextIds();
ICBreakpoint cBreakpoint = (ICBreakpoint) breakpoint;
TCFBreakpointScopeExtension scopeExtension;
try {
@@ -83,6 +88,7 @@ public class BreakpointScopeOrganizer extends AbstractBreakpointOrganizerDelegat
ITCFConstants.ID_TCF_DEBUG_MODEL, TCFBreakpointScopeExtension.class);
if (scopeExtension != null) {
scopeExtension.setPropertiesFilter(filter);
+ scopeExtension.setRawContextIds(contextIds);
}
}
catch (CoreException e) {
@@ -106,3 +112,35 @@ public class BreakpointScopeOrganizer extends AbstractBreakpointOrganizerDelegat
// Nothing to do, changes handled by add.
}
}
+
+/**
+ * Adapter factory which returns the breakpoint category for a given breakpoint
+ * container element that is shown in Breakpoints view.
+ */
+@SuppressWarnings("restriction")
+class BreakpointScopeContainerAdapterFactory implements IAdapterFactory {
+
+ private static final Class<?>[] fgAdapterList = new Class[] {
+ BreakpointScopeCategory.class
+ };
+
+ public Object getAdapter(Object obj, @SuppressWarnings("rawtypes") Class adapterType) {
+ if ( !(obj instanceof IBreakpointContainer) ) return null;
+
+
+ if ( BreakpointScopeCategory.class.equals(adapterType) ) {
+ IAdaptable category = ((IBreakpointContainer)obj).getCategory();
+ if (category instanceof BreakpointScopeCategory) {
+ return category;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class[] getAdapterList() {
+ return fgAdapterList;
+ }
+}
+
+
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/Messages.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/Messages.java
index e9381d9..9f28014 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/Messages.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/Messages.java
@@ -24,6 +24,11 @@ public class Messages extends NLS {
public static String TCFThreadFilterQueryTreeViewLabel;
public static String TCFThreadFilterEditorFormatError;
+ public static String BreakpointScopeCategory_filter_label;
+ public static String BreakpointScopeCategory_contexts_label;
+ public static String BreakpointScopeCategory_global_label;
+
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java
index 32d5fa8..895669f 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java
@@ -22,7 +22,7 @@ import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
- private String[] fContextIds;
+ private String fContextIds;
private String fProperties;
private ICBreakpoint fBreakpoint;
@@ -30,44 +30,54 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
fBreakpoint = breakpoint;
IMarker m = breakpoint.getMarker();
if (m != null && m.exists()) {
- String contextIdAttr = m.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, null);
- if (contextIdAttr != null) fContextIds = contextIdAttr.split(",\\s*");
+ fContextIds = m.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, null);
fProperties = m.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, null);
}
}
- public void setThreadFilter(String[] threadIds) {
- fContextIds = threadIds;
- if (fBreakpoint == null) return;
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- final IMarker m = fBreakpoint.getMarker();
- if (m == null || !m.exists()) return;
- String attr = null;
- if (fContextIds != null) {
- if (fContextIds.length == 0) {
- // empty string is filtered out in TCFBreakpointsModel
- attr = " ";
- }
- else {
- StringBuilder buf = new StringBuilder();
- for (int i = 0; i < fContextIds.length - 1; i++) {
- buf.append(fContextIds[i]).append(',');
- }
- buf.append(fContextIds[fContextIds.length - 1]);
- attr = buf.toString();
- }
- }
- m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, attr);
- }
- }, null);
+ public void setThreadFilter(final String[] threadIds) {
+ String attr;
+ if (threadIds == null) {
+ attr = null;
}
- catch (Exception e) {
- Activator.log(e);
+ else if (threadIds.length == 0) {
+ // empty string is filtered out in TCFBreakpointsModel
+ attr = " ";
+ }
+ else {
+ StringBuilder buf = new StringBuilder();
+ for (int i = 0; i < threadIds.length - 1; i++) {
+ buf.append(threadIds[i]).append(',');
+ }
+ buf.append(threadIds[threadIds.length - 1]);
+ attr = buf.toString();
}
+ setRawContextIds(attr);
}
+ String getRawContextIds() {
+ return fContextIds;
+ }
+
+ void setRawContextIds(String contextIDs) {
+ fContextIds = contextIDs;
+ if (fBreakpoint != null) {
+ try {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ final IMarker m = fBreakpoint.getMarker();
+ if (m == null || !m.exists()) return;
+
+ m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, fContextIds);
+ }
+ }, null);
+ }
+ catch (Exception e) {
+ Activator.log(e);
+ }
+ }
+ }
+
public void setPropertiesFilter(String properties) {
fProperties = properties;
if (fBreakpoint == null) return;
@@ -76,8 +86,7 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
public void run(IProgressMonitor monitor) throws CoreException {
final IMarker m = fBreakpoint.getMarker();
if (m == null || !m.exists()) return;
- if (fProperties.length() != 0)
- m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, fProperties);
+ m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, fProperties);
}
}, null);
}
@@ -86,7 +95,14 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
}
}
+ public String getPropertiesFilter() {
+ return fProperties;
+ }
+
public String[] getThreadFilters() {
- return fContextIds;
+ if (fContextIds != null) {
+ return fContextIds.split(",\\s*");
+ }
+ return null;
}
}
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java
index 958ba1f..d108550 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java
@@ -26,9 +26,17 @@ import org.eclipse.ui.dialogs.PropertyPage;
public class TCFBreakpointThreadFilterPage extends PropertyPage {
private TCFThreadFilterEditor fThreadFilterEditor;
+ private TCFBreakpointScopeExtension fCategoryScopeExtension;
@Override
protected Control createContents(Composite parent) {
+ BreakpointScopeCategory category = getScopeCategory();
+ if (category != null) {
+ fCategoryScopeExtension = new TCFBreakpointScopeExtension();
+ fCategoryScopeExtension.setPropertiesFilter(category.getFilter());
+ fCategoryScopeExtension.setRawContextIds(category.getContextIds());
+ }
+
noDefaultAndApplyButton();
Composite fieldEditorComposite = new Composite(parent, SWT.NONE);
fieldEditorComposite.setLayout( new GridLayout(1, false));
@@ -41,6 +49,13 @@ public class TCFBreakpointThreadFilterPage extends PropertyPage {
return (ICBreakpoint) getElement().getAdapter(ICBreakpoint.class);
}
+ protected BreakpointScopeCategory getScopeCategory() {
+ if (getElement() instanceof BreakpointScopeCategory) {
+ return (BreakpointScopeCategory)getElement();
+ }
+ return null;
+ }
+
protected TCFBreakpointScopeExtension getFilterExtension() {
ICBreakpoint bp = getBreakpoint();
if (bp != null) {
@@ -54,7 +69,7 @@ public class TCFBreakpointThreadFilterPage extends PropertyPage {
// potential race condition: ignore
}
}
- return null;
+ return fCategoryScopeExtension;
}
protected void createThreadFilterEditor(Composite parent) {
@@ -76,5 +91,8 @@ public class TCFBreakpointThreadFilterPage extends PropertyPage {
*/
protected void doStore() {
fThreadFilterEditor.doStore();
+ if (fCategoryScopeExtension != null) {
+ getScopeCategory().setFilter(fCategoryScopeExtension.getPropertiesFilter(), fCategoryScopeExtension.getRawContextIds());
+ }
}
}
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java
index 6647b46..edd55c2 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java
@@ -357,6 +357,9 @@ public class TCFThreadFilterEditor {
}
}
}
+ if (fPage.getElement() instanceof BreakpointScopeCategory) {
+ expression = ((BreakpointScopeCategory)fPage.getElement()).getFilter();
+ }
return expression;
}
@@ -700,8 +703,8 @@ public class TCFThreadFilterEditor {
TCFBreakpointScopeExtension filterExtension = fPage.getFilterExtension();
if (filterExtension == null) return;
filterExtension.setPropertiesFilter(scopedExpression);
- }
- if (radioBasic.getSelection()) {
+ filterExtension.setThreadFilter(null);
+ } else if (radioBasic.getSelection()) {
CheckboxTreeViewer viewer = getThreadViewer();
Object[] elements = viewer.getCheckedElements();
String[] threadIds;
@@ -723,6 +726,7 @@ public class TCFThreadFilterEditor {
TCFBreakpointScopeExtension filterExtension = fPage.getFilterExtension();
if (filterExtension == null) return;
filterExtension.setThreadFilter(threadIds);
+ filterExtension.setPropertiesFilter(null);
}
}
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/messages.properties b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/messages.properties
index e57f000..3b29d8d 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/messages.properties
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/messages.properties
@@ -16,3 +16,7 @@ TCFThreadFilterQueryButtonEdit=Edit
TCFThreadFilterQueryAdvancedLabel=Breakpoint Scoping Expression:
TCFThreadFilterQueryTreeViewLabel=Restrict to Selected Contexts:
TCFThreadFilterEditorFormatError=Parameters must be name value pairs
+
+BreakpointScopeCategory_filter_label=Filter: {0}
+BreakpointScopeCategory_contexts_label=Contexts: {0}
+BreakpointScopeCategory_global_label=Global (no scope restriction) \ No newline at end of file