Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java105
1 files changed, 75 insertions, 30 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
index 9631e55c387..118d1b4b794 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CBreakpointUIContributionFactory.java
@@ -13,7 +13,9 @@
package org.eclipse.cdt.debug.ui.breakpoints;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import org.eclipse.cdt.debug.core.CDIDebugModel;
@@ -31,7 +33,6 @@ import org.eclipse.debug.core.model.IBreakpoint;
public class CBreakpointUIContributionFactory {
private static final String EXTENSION_POINT_NAME = "breakpointContribution"; //$NON-NLS-1$
- private static final String MAIN_ELEMENT = "breakpointLabels"; //$NON-NLS-1$
private static CBreakpointUIContributionFactory instance;
protected ArrayList<ICBreakpointsUIContribution> contributions;
@@ -70,22 +71,28 @@ public class CBreakpointUIContributionFactory {
* @throws CoreException if cannot get marker attributes from bearkpoint
* @since 7.2
*/
- public ICBreakpointsUIContribution[] getBreakpointUIContributions(IBreakpoint breakpoint,
- Map<String, Object> attributes)
- throws CoreException
+ public ICBreakpointsUIContribution[] getBreakpointUIContributions(String[] debugModelIDs, IBreakpoint breakpoint,
+ Map<String, Object> attributes) throws CoreException
{
- String debugModelId = breakpoint.getModelIdentifier();
IMarker bmarker = breakpoint.getMarker();
String markerType = CDIDebugModel.calculateMarkerType(breakpoint);
if (bmarker != null) {
markerType = bmarker.getType();
}
- return getBreakpointUIContributions(debugModelId, markerType, attributes);
+ return getBreakpointUIContributions(debugModelIDs, markerType, attributes);
}
+ /**
+ * Default debug model ID list which will cause only the general UI contributions to be returned.
+ * @since 7.2
+ */
+ public final static String[] DEBUG_MODEL_IDS_DEFAULT = new String[] {};
+
/**
* Calculates the breakpoint UI contributions for the given breakpoint.
*
+ * @param debugModelId The debug model ID of the active debug context for
+ * which to calculate contributions.
* @param breakpoint Breakpoint to find UI contributions for.
* @param markerType Marker type of the breakpoint.
* @param attributes Attributes of the breakpoint
@@ -96,25 +103,54 @@ public class CBreakpointUIContributionFactory {
public ICBreakpointsUIContribution[] getBreakpointUIContributions(String debugModelId, String markerType,
Map<String, Object> attributes)
{
- ArrayList<ICBreakpointsUIContribution> list = new ArrayList<ICBreakpointsUIContribution>();
- for (ICBreakpointsUIContribution con : contributions) {
- try {
- if (debugModelId == null || con.getDebugModelId() == null || debugModelId.equals(con.getDebugModelId())) {
- String contributedMarkerType = con.getMarkerType();
- if (isMarkerSubtypeOf(markerType, contributedMarkerType)) {
- if (attributes == null || con.isApplicable(attributes)) {
- list.add(con);
- }
- }
- }
- } catch (Exception e) {
- CDebugUIPlugin.log(e);
- }
-
- }
- return list.toArray(new ICBreakpointsUIContribution[list.size()]);
+ return getBreakpointUIContributions(
+ debugModelId != null ? new String[] { debugModelId } : DEBUG_MODEL_IDS_DEFAULT,
+ markerType,
+ attributes);
+
}
+ /**
+ * Calculates the breakpoint UI contributions for the given breakpoint.
+ *
+ * @param debugModelId The debug model IDs of the active debug context for
+ * which to calculate contributions.
+ * @param breakpoint Breakpoint to find UI contributions for.
+ * @param markerType Marker type of the breakpoint.
+ * @param attributes Attributes of the breakpoint
+ * @return non-null array of ICBreakpointsUIContribution
+ * @throws CoreException
+ * @throws CoreException if cannot get marker attributes from berakpoint
+ *
+ * @since 7.2
+ */
+ public ICBreakpointsUIContribution[] getBreakpointUIContributions(String[] debugModelIds, String markerType,
+ Map<String, Object> attributes)
+ {
+ List<String> debugModelIdsList = Arrays.asList(debugModelIds);
+ ArrayList<ICBreakpointsUIContribution> list = new ArrayList<ICBreakpointsUIContribution>();
+ for (ICBreakpointsUIContribution con : contributions) {
+ try {
+ if (con.getDebugModelId() == null ||
+ con.getDebugModelId().equals(CDIDebugModel.getPluginIdentifier()) ||
+ debugModelIdsList.contains(con.getDebugModelId()))
+ {
+ String contributedMarkerType = con.getMarkerType();
+ if (isMarkerSubtypeOf(markerType, contributedMarkerType)) {
+ if (attributes == null || con.isApplicable(attributes)) {
+ list.add(con);
+ }
+ }
+ }
+ } catch (Exception e) {
+ CDebugUIPlugin.log(e);
+ }
+
+ }
+ return list.toArray(new ICBreakpointsUIContribution[list.size()]);
+ }
+
+
public boolean isMarkerSubtypeOf(String currentType, String type) throws CoreException {
return getWorkspace().getMarkerManager().isSubtype(currentType, type);
}
@@ -132,15 +168,19 @@ public class CBreakpointUIContributionFactory {
IConfigurationElement[] elements = ep.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
IConfigurationElement configurationElement = elements[i];
- if (configurationElement.getName().equals(MAIN_ELEMENT)) {
+ if (configurationElement.getName().equals(ICBreakpointsUIContribution.BREAKPOINT_LABELS) ||
+ configurationElement.getName().equals(ICBreakpointsUIContribution.BREAKPOINT_EDITORS))
+ {
+ String mainElement = configurationElement.getName();
String modelId = configurationElement.getAttribute("debugModelId"); //$NON-NLS-1$
String markerType = getRequired(configurationElement, "markerType"); //$NON-NLS-1$
if (markerType == null)
continue;
IConfigurationElement[] children = configurationElement.getChildren("attribute"); //$NON-NLS-1$
for (IConfigurationElement att : children) {
-
- DefaultCBreakpointUIContribution adapter = new DefaultCBreakpointUIContribution();
+
+ DefaultCBreakpointUIContribution adapter = new DefaultCBreakpointUIContribution(att);
+ adapter.setMainElement(mainElement);
adapter.setMarkerType(markerType);
adapter.setDebugModelId(modelId);
if (processAttribute(att, adapter) == false)
@@ -152,10 +192,13 @@ public class CBreakpointUIContributionFactory {
}
}
- private boolean processAttribute(IConfigurationElement attrElement, DefaultCBreakpointUIContribution adapter) {
+ private boolean processAttribute(IConfigurationElement attrElement,
+ DefaultCBreakpointUIContribution adapter)
+ {
String attrId = getRequired(attrElement, "name"); //$NON-NLS-1$
String attrLabel = getRequired(attrElement, "label"); //$NON-NLS-1$
- String className = attrElement.getAttribute("fieldEditor"); //$NON-NLS-1$
+ String fieldEditorClass = attrElement.getAttribute("fieldEditor"); //$NON-NLS-1$
+ String fieldEditorFactoryClass = attrElement.getAttribute("fieldEditorFactory"); //$NON-NLS-1$
String type = attrElement.getAttribute("type"); //$NON-NLS-1$
String svisible = attrElement.getAttribute("visible"); //$NON-NLS-1$
@@ -174,7 +217,8 @@ public class CBreakpointUIContributionFactory {
}
adapter.setId(attrId);
adapter.setLabel(attrLabel);
- adapter.setControlClass(className);
+ adapter.setControlClass(fieldEditorClass);
+ adapter.setFieldEditorFactory(fieldEditorFactoryClass);
adapter.setType(type);
adapter.setVisible(visible);
addContribution(adapter);
@@ -196,8 +240,9 @@ public class CBreakpointUIContributionFactory {
adapter.addValue(valueId, valueLabel);
IConfigurationElement[] children = valueElement.getChildren("attribute"); //$NON-NLS-1$
for (IConfigurationElement att : children) {
- DefaultCBreakpointUIContribution adapter2 = new DefaultCBreakpointUIContribution();
+ DefaultCBreakpointUIContribution adapter2 = new DefaultCBreakpointUIContribution(att);
// inherit values
+ adapter2.setMainElement(adapter.getMainElement());
adapter2.setMarkerType(adapter.getMarkerType());
adapter2.setDebugModelId(adapter.getDebugModelId());
adapter2.addContionsAll(adapter.getConditions());

Back to the top