Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2012-02-09 21:52:36 +0000
committerEugene Tarassov2012-02-09 23:39:43 +0000
commite4e74401b7da4c4e862f77ca240d363f4ee7a795 (patch)
tree6881b49679721531e70ada04ac78ee6e6f6e131b /plugins/org.eclipse.tcf.cdt.ui/src
parentac959b43d69906fd97f083bd77448fd2ff8e0c2a (diff)
downloadorg.eclipse.tcf-e4e74401b7da4c4e862f77ca240d363f4ee7a795.tar.gz
org.eclipse.tcf-e4e74401b7da4c4e862f77ca240d363f4ee7a795.tar.xz
org.eclipse.tcf-e4e74401b7da4c4e862f77ca240d363f4ee7a795.zip
TCF Debugger: added usage of IWorkspaceRunnable when setting a marker attribute.
Diffstat (limited to 'plugins/org.eclipse.tcf.cdt.ui/src')
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java44
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFThreadFilterEditor.java9
2 files changed, 26 insertions, 27 deletions
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 c247f81f3..d73845682 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. 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,15 +13,16 @@ package org.eclipse.tcf.internal.cdt.ui.breakpoints;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspace;
+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.tcf.internal.cdt.ui.Activator;
-import org.eclipse.tcf.internal.debug.model.ITCFConstants;
-import org.eclipse.tcf.services.IBreakpoints;
+import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
- static final String ATTR_CONTEXT_IDS = ITCFConstants.ID_TCF_DEBUG_MODEL + '.' + IBreakpoints.PROP_CONTEXTIDS;
-
private String[] fContextIds;
private ICBreakpoint fBreakpoint;
@@ -29,40 +30,42 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
fBreakpoint = breakpoint;
IMarker m = breakpoint.getMarker();
if (m != null && m.exists()) {
- String contextIdAttr = m.getAttribute(ATTR_CONTEXT_IDS, null);
- if (contextIdAttr != null) {
- fContextIds = contextIdAttr.split(",\\s*");
- }
+ String contextIdAttr = m.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, null);
+ if (contextIdAttr != null) fContextIds = contextIdAttr.split(",\\s*");
}
}
public void setThreadFilter(String[] threadIds) {
fContextIds = threadIds;
- if (fBreakpoint == null) {
- return;
- }
- IMarker m = fBreakpoint.getMarker();
- if (m == null || !m.exists()) {
- return;
- }
+ if (fBreakpoint == null) return;
+ final IMarker m = fBreakpoint.getMarker();
+ if (m == null || !m.exists()) return;
String contextIdAttr = null;
if (threadIds != null) {
if (threadIds.length == 0) {
// empty string is filtered out in TCFBreakpointsModel
contextIdAttr = " ";
- } else {
+ }
+ else {
StringBuilder buf = new StringBuilder();
- for (int i=0; i < threadIds.length - 1; ++i) {
+ for (int i = 0; i < threadIds.length - 1; i++) {
buf.append(threadIds[i]).append(',');
}
buf.append(threadIds[threadIds.length - 1]);
contextIdAttr = buf.toString();
}
}
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final String IDAttr = contextIdAttr;
+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, IDAttr);
+ }
+ };
try {
- m.setAttribute(ATTR_CONTEXT_IDS, contextIdAttr);
+ workspace.run(runnable, null);
}
- catch (CoreException e) {
+ catch (Exception e) {
Activator.log(e);
}
}
@@ -70,5 +73,4 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
public String[] getThreadFilters() {
return fContextIds;
}
-
}
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 1fa5fd444..b32c5e12a 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
@@ -373,15 +373,13 @@ public class TCFThreadFilterEditor {
}
if (checkedIds.size() == fContexts.size()) {
threadIds = null;
- } else {
+ }
+ else {
threadIds = checkedIds.toArray(new String[checkedIds.size()]);
}
TCFBreakpointScopeExtension filterExtension = fPage.getFilterExtension();
- if (filterExtension == null) {
- return;
- }
+ if (filterExtension == null) return;
filterExtension.setThreadFilter(threadIds);
- DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(fPage.getBreakpoint());
}
private Context[] syncGetContainers(final TCFLaunch launch) {
@@ -461,5 +459,4 @@ public class TCFThreadFilterEditor {
}
return null;
}
-
}

Back to the top