Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-10-11 22:17:07 +0000
committerPawel Piech2012-10-11 22:31:40 +0000
commitc0caf5d23bb66c5dc0920ea81a6617bc1763ca79 (patch)
tree78473c88e39eeb7c9736a671b8ade32bb1aef44c /plugins
parent8af59db4eeed4690656cb59c6bec0e20a858a781 (diff)
downloadorg.eclipse.tcf-c0caf5d23bb66c5dc0920ea81a6617bc1763ca79.tar.gz
org.eclipse.tcf-c0caf5d23bb66c5dc0920ea81a6617bc1763ca79.tar.xz
org.eclipse.tcf-c0caf5d23bb66c5dc0920ea81a6617bc1763ca79.zip
Bug 391612 - [breakpoints] Editing breakpoint scope group in bp view can lead to view refresh problems
Fixed handling of preference store used in new CDT breakpoint properties dialog.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/BreakpointScopeCategory.java28
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java57
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java41
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java7
4 files changed, 63 insertions, 70 deletions
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 f8049c452..ba033e0cd 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
@@ -46,8 +46,8 @@ public class BreakpointScopeCategory extends PlatformObject implements IWorkbenc
private final String fContextIds;
public BreakpointScopeCategory(String filter, String contextIds) {
- fFilter = filter;
- fContextIds = contextIds;
+ fFilter = filter != null ? filter : "";
+ fContextIds = contextIds != null ? contextIds : "";
}
public String getFilter() {
@@ -85,11 +85,11 @@ public class BreakpointScopeCategory extends PlatformObject implements IWorkbenc
}
public String getLabel(Object o) {
- if (getFilter() != null && getContextIds() != null) {
+ if (getFilter().length() != 0 && getContextIds().length() != 0) {
return MessageFormat.format(Messages.BreakpointScopeCategory_filter_and_contexts_label, new Object[] { getFilter(), getContextIds() });
- } else if (getFilter() != null) {
+ } else if (getFilter().length() != 0) {
return MessageFormat.format(Messages.BreakpointScopeCategory_filter_label, new Object[] { getFilter() });
- } else if (getContextIds() != null) {
+ } else if (getContextIds().length() != 0) {
return MessageFormat.format(Messages.BreakpointScopeCategory_contexts_label, new Object[] { getContextIds() });
}
return Messages.BreakpointScopeCategory_global_label;
@@ -113,18 +113,14 @@ public class BreakpointScopeCategory extends PlatformObject implements IWorkbenc
public boolean equals(Object obj) {
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 getFilter().equals(other.getFilter()) && getContextIds().equals(other.getContextIds());
}
return false;
}
@Override
public int hashCode() {
- return (getFilter() != null ? getFilter().hashCode() : 0) +
- (getContextIds() != null ? getContextIds().hashCode() : 0);
+ return getFilter().hashCode() + getContextIds().hashCode();
}
private List<ICBreakpoint> findCategoryBreakpoints() {
@@ -133,13 +129,9 @@ public class BreakpointScopeCategory extends PlatformObject implements IWorkbenc
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))) )
- {
+ String filter = bpMarker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, (String)"");
+ String contextIds = bpMarker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, (String)"");
+ if( (getFilter() != null && getFilter().equals(filter) && getContextIds().equals(contextIds))) {
categoryBreakpoints.add((ICBreakpoint)bp);
}
}
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 a2d1081f6..85380d91e 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
@@ -23,33 +23,21 @@ import org.eclipse.tcf.internal.debug.model.TCFBreakpointsModel;
public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
- private String fContextIds;
- private String fProperties;
private ICBreakpoint fBreakpoint;
private IPreferenceStore fPreferenceStore;
public void initialize(IPreferenceStore prefStore) {
fPreferenceStore = prefStore;
- fContextIds = fPreferenceStore.getString(TCFBreakpointsModel.ATTR_CONTEXTIDS);
- if (fContextIds != null && fContextIds.length() == 0) {
- fContextIds = null;
- }
- fProperties = fPreferenceStore.getString(TCFBreakpointsModel.ATTR_CONTEXT_QUERY);
}
public void initialize(ICBreakpoint breakpoint) throws CoreException {
fBreakpoint = breakpoint;
- IMarker m = fBreakpoint.getMarker();
- if (m != null && m.exists()) {
- fContextIds = m.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, null);
- fProperties = m.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, null);
- }
}
public void setThreadFilter(final String[] threadIds) {
String attr;
if (threadIds == null) {
- attr = null;
+ attr = "";
}
else if (threadIds.length == 0) {
// empty string is filtered out in TCFBreakpointsModel
@@ -67,11 +55,19 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
}
String getRawContextIds() {
- return fContextIds;
+ if (fPreferenceStore != null) {
+ return fPreferenceStore.getString(TCFBreakpointsModel.ATTR_CONTEXTIDS);
+ }
+ if (fBreakpoint != null) {
+ IMarker marker = fBreakpoint.getMarker();
+ if (marker != null) {
+ return marker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, "");
+ }
+ }
+ return "";
}
- void setRawContextIds(String contextIDs) {
- fContextIds = contextIDs;
+ void setRawContextIds(final String contextIDs) {
if (fPreferenceStore!= null) {
fPreferenceStore.setValue(TCFBreakpointsModel.ATTR_CONTEXTIDS, contextIDs);
}
@@ -82,7 +78,7 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
final IMarker m = fBreakpoint.getMarker();
if (m == null || !m.exists()) return;
- m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, fContextIds);
+ m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXTIDS, contextIDs);
}
}, null);
}
@@ -93,9 +89,10 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
}
public void setPropertiesFilter(String properties) {
- fProperties = properties;
+ final String _properties = properties != null ? properties : "";
+
if (fPreferenceStore!= null) {
- fPreferenceStore.setValue(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, properties);
+ fPreferenceStore.setValue(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, _properties);
}
else if (fBreakpoint != null) {
try {
@@ -103,11 +100,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);
- else
- m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, null);
-
+ m.setAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, _properties);
}
}, null);
}
@@ -118,12 +111,22 @@ public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
}
public String getPropertiesFilter() {
- return fProperties;
+ if (fPreferenceStore != null) {
+ return fPreferenceStore.getString(TCFBreakpointsModel.ATTR_CONTEXT_QUERY);
+ }
+ if (fBreakpoint != null) {
+ IMarker marker = fBreakpoint.getMarker();
+ if (marker != null) {
+ return marker.getAttribute(TCFBreakpointsModel.ATTR_CONTEXT_QUERY, "");
+ }
+ }
+ return "";
}
public String[] getThreadFilters() {
- if (fContextIds != null) {
- return fContextIds.split(",\\s*");
+ String contextIds = getRawContextIds();
+ if (contextIds.length() != 0) {
+ return contextIds.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 7ffbee91c..b8d6502dc 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
@@ -13,14 +13,13 @@ package org.eclipse.tcf.internal.cdt.ui.breakpoints;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.ui.breakpoints.ICBreakpointContext;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.tcf.internal.debug.model.ITCFConstants;
import org.eclipse.ui.dialogs.PropertyPage;
/**
@@ -35,9 +34,9 @@ public class TCFBreakpointThreadFilterPage extends PropertyPage {
protected Control createContents(Composite parent) {
BreakpointScopeCategory category = getScopeCategory();
if (category != null) {
- fFilterExtension = new TCFBreakpointScopeExtension();
- fFilterExtension.setPropertiesFilter(category.getFilter());
- fFilterExtension.setRawContextIds(category.getContextIds());
+ TCFBreakpointScopeExtension filterExtension = getFilterExtension();
+ filterExtension.setPropertiesFilter(category.getFilter());
+ filterExtension.setRawContextIds(category.getContextIds());
}
noDefaultAndApplyButton();
@@ -72,18 +71,14 @@ public class TCFBreakpointThreadFilterPage extends PropertyPage {
protected TCFBreakpointScopeExtension getFilterExtension() {
if (fFilterExtension != null) return fFilterExtension;
-
- ICBreakpoint bp = getBreakpoint();
- if (bp != null) {
- try {
- fFilterExtension = bp.getExtension(
- ITCFConstants.ID_TCF_DEBUG_MODEL, TCFBreakpointScopeExtension.class);
- } catch (CoreException e) {
- // potential race condition: ignore
- }
- }
- if (fFilterExtension == null) {
- fFilterExtension = new TCFBreakpointScopeExtension();
+
+ fFilterExtension = new TCFBreakpointScopeExtension();
+ BreakpointScopeCategory category = getScopeCategory();
+ if (category != null) {
+ fFilterExtension.initialize(new PreferenceStore());
+ fFilterExtension.setPropertiesFilter(category.getFilter());
+ fFilterExtension.setRawContextIds(category.getContextIds());
+ } else {
fFilterExtension.initialize(getPreferenceStore());
}
return fFilterExtension;
@@ -109,19 +104,17 @@ public class TCFBreakpointThreadFilterPage extends PropertyPage {
protected void doStore() {
fThreadFilterEditor.doStore();
BreakpointScopeCategory scopeCategory = getScopeCategory();
- if (scopeCategory != null && fFilterExtension != null) {
- scopeCategory.setFilter(fFilterExtension.getPropertiesFilter(), fFilterExtension.getRawContextIds());
+ if (scopeCategory != null) {
+ TCFBreakpointScopeExtension filterExtension = getFilterExtension();
+ scopeCategory.setFilter(filterExtension.getPropertiesFilter(), filterExtension.getRawContextIds());
}
}
@Override
public void setVisible(boolean visible) {
if (visible) {
- if (fFilterExtension != null) {
- fFilterExtension.initialize(getPreferenceStore());
- fThreadFilterEditor.setInitialCheckedState();
- fThreadFilterEditor.setupScopeExpressionCombo();
- }
+ fThreadFilterEditor.setInitialCheckedState();
+ fThreadFilterEditor.setupScopeExpressionCombo();
} else {
doStore();
}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java
index 8dcb19cb2..ac4bd133d 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java
@@ -616,7 +616,12 @@ public class TCFBreakpointsModel {
if (key.startsWith(ITCFConstants.ID_TCF_DEBUG_MODEL)) {
String tcf_key = key.substring(ITCFConstants.ID_TCF_DEBUG_MODEL.length() + 1);
if (IBreakpoints.PROP_CONTEXT_IDS.equals(tcf_key)) {
- val = filterContextIds(channel, ((String)val).split(",\\s*"));
+ String stringVal = (String)val;
+ if (stringVal.length() == 0) continue;
+ val = filterContextIds(channel, stringVal.split(",\\s*"));
+ }
+ else if (IBreakpoints.PROP_CONTEXT_QUERY.equals(tcf_key)) {
+ if (((String)val).length() == 0) continue;
}
else if (IBreakpoints.PROP_CONTEXT_NAMES.equals(tcf_key) ||
IBreakpoints.PROP_STOP_GROUP.equals(tcf_key) ||

Back to the top