Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakosyakov2014-07-08 11:56:47 -0400
committerakosyakov2014-07-23 07:27:22 -0400
commited4a5afff53343242837d9fe7f0014d5419fcb81 (patch)
tree084a09c61673ac6d88e6f154330cbee2e5af0da5 /org.eclipse.debug.core
parent6f5ea075142efa6fcb01862036789ecc76ecfe3b (diff)
downloadeclipse.platform.debug-ed4a5afff53343242837d9fe7f0014d5419fcb81.tar.gz
eclipse.platform.debug-ed4a5afff53343242837d9fe7f0014d5419fcb81.tar.xz
eclipse.platform.debug-ed4a5afff53343242837d9fe7f0014d5419fcb81.zip
[bug 438621][debug]: provided step filters extension point
Change-Id: I26b55e35ab210527d52516cefc216ec40576c1d8 Signed-off-by: akosyakov <anton.kosyakov@itemis.de>
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java23
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java48
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java4
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties2
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilter.java73
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java45
-rw-r--r--org.eclipse.debug.core/plugin.properties1
-rw-r--r--org.eclipse.debug.core/plugin.xml1
-rw-r--r--org.eclipse.debug.core/schema/stepFilters.exsd126
9 files changed, 322 insertions, 1 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 44b3e4adc..2a36552e2 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -49,6 +49,7 @@ import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.IDropToFrame;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStep;
+import org.eclipse.debug.core.model.IStepFilter;
import org.eclipse.debug.core.model.IStepFilters;
import org.eclipse.debug.core.model.ISuspendResume;
import org.eclipse.debug.core.model.ITerminate;
@@ -210,6 +211,14 @@ public class DebugPlugin extends Plugin {
public static final String EXTENSION_POINT_BREAKPOINT_IMPORT_PARTICIPANTS = "breakpointImportParticipants"; //$NON-NLS-1$
/**
+ * Simple identifier constant (value <code>"stepFilters"</code>) for the
+ * step filters extension point.
+ *
+ * @since 3.9
+ */
+ public static final String EXTENSION_POINT_STEP_FILTERS = "stepFilters"; //$NON-NLS-1$
+
+ /**
* Status code indicating an unexpected error.
*
* @since 3.4
@@ -1568,6 +1577,20 @@ public class DebugPlugin extends Plugin {
}
/**
+ * Returns any step filters that have been contributed for the given model
+ * identifier.
+ *
+ * @param modelIdentifier the model identifier
+ * @return step filters that have been contributed for the given model
+ * identifier, possibly an empty collection
+ * @since 3.9
+ * @see org.eclipse.debug.core.model.IStepFilter
+ */
+ public static IStepFilter[] getStepFilters(String modelIdentifier) {
+ return getStepFilterManager().getStepFilters(modelIdentifier);
+ }
+
+ /**
* Returns the step filter manager.
*
* @return step filter manager
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java
new file mode 100644
index 000000000..ce1162cb6
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/IStepFilter.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2014 itemis AG (http://www.itemis.eu) 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
+ *******************************************************************************/
+package org.eclipse.debug.core.model;
+
+/**
+ * Provides the ability to filter out steps based on some object. Associated
+ * with a step filter extension.
+ *
+ * <p>
+ * The following is an example of a step filter extension:
+ *
+ * <pre>
+ * &lt;extension point=&quot;org.eclipse.debug.core.stepFilters&quot;&gt;
+ * &lt;stepFilters
+ * class=&quot;com.example.ExampleStepFilters&quot;
+ * modelIdentifier=&quot;com.example.debug.model&quot;&gt;
+ * &lt;/stepFilters&gt;
+ * &lt;/extension&gt;
+ * </pre>
+ *
+ * </p>
+ * In the example above, the specified step filter will be used for the
+ * <code>com.example.debug.model</code> debug model. </p>
+ *
+ * <p>
+ * Clients contributing step filters must implement this interface.
+ * </p>
+ *
+ * @since 3.9
+ * @see org.eclipse.debug.core.model.IStep
+ *
+ */
+public interface IStepFilter {
+
+ /**
+ * Returns whether the step for the given object should be filtered.
+ *
+ * @param object the object to filter
+ * @return whether the step for the given object should be filtered.
+ */
+ public boolean isFiltered(Object object);
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
index c0d7eb8ae..4bdda7c68 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.java
@@ -67,7 +67,7 @@ public class DebugCoreMessages extends NLS {
public static String LogicalStructureProvider_0;
public static String LogicalStructureProvider_1;
public static String LogicalStructureType_1;
- public static String SystemPropertyResolver_0;
+ public static String SystemPropertyResolver_0;
public static String InputStreamMonitor_label;
public static String Launch_terminate_failed;
public static String LaunchConfiguration_Failed_to_delete_launch_configuration__1;
@@ -104,6 +104,8 @@ public class DebugCoreMessages extends NLS {
public static String RefreshingResourcesError;
public static String RefreshUtil_0;
public static String RefreshUtil_1;
+ public static String StepFilter_0;
+ public static String StepFilter_1;
static {
// load message values from bundle file
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
index 11b69f9f5..9a90a2400 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreMessages.properties
@@ -105,3 +105,5 @@ RefreshingResources=Refresh resources...
RefreshingResourcesError=Exception(s) occurred during refresh.
RefreshUtil_0=Unable to restore resource memento: {0}
RefreshUtil_1=Refresh scope refers to non-existent resource {0}
+StepFilter_0=Required attribute modelIdentifier missing for stepFilter extension.
+StepFilter_1=Required attribute class missing for stepFilter extension.
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilter.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilter.java
new file mode 100644
index 000000000..7069a3cde
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilter.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2014 itemis AG (http://www.itemis.eu) 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
+ *******************************************************************************/
+package org.eclipse.debug.internal.core;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IStepFilter;
+
+/**
+ * Manage step filter extensions.
+ *
+ * @see IConfigurationElementConstants
+ */
+public class StepFilter {
+
+ private IConfigurationElement fConfigurationElement;
+
+ private String fModelIdentifier;
+
+ private IStepFilter fDelegate;
+
+ public StepFilter(IConfigurationElement element) throws CoreException {
+ fConfigurationElement = element;
+ fModelIdentifier = fConfigurationElement.getAttribute(IConfigurationElementConstants.MODEL_IDENTIFIER);
+ if (fModelIdentifier == null) {
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.StepFilter_0, null));
+ }
+ String className = fConfigurationElement.getAttribute(IConfigurationElementConstants.CLASS);
+ if (className == null) {
+ throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.ERROR, DebugCoreMessages.StepFilter_1, null));
+ }
+ }
+
+ /**
+ * Returns step filters for the given model identifier.
+ *
+ * @param modelIdentifier the model identifier for which step filters are
+ * requested
+ * @return step filters
+ */
+ public IStepFilter[] getStepFilters(String modelIdentifier) {
+ if (fModelIdentifier.equals(modelIdentifier)) {
+ IStepFilter delegate = getDelegate();
+ return new IStepFilter[] { delegate };
+ }
+ return new IStepFilter[0];
+ }
+
+ /**
+ * Returns the IStepFilter for this extension.
+ *
+ * @return the {@link IStepFilter}
+ */
+ protected IStepFilter getDelegate() {
+ if (fDelegate == null) {
+ try {
+ fDelegate = (IStepFilter) fConfigurationElement.createExecutableExtension(IConfigurationElementConstants.CLASS);
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ return fDelegate;
+ }
+
+}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
index 37f05ced6..12266e2fd 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java
@@ -10,11 +10,18 @@
*******************************************************************************/
package org.eclipse.debug.internal.core;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchListener;
import org.eclipse.debug.core.commands.IStepFiltersHandler;
+import org.eclipse.debug.core.model.IStepFilter;
import org.eclipse.debug.internal.core.commands.DebugCommandRequest;
/**
@@ -88,4 +95,42 @@ public class StepFilterManager implements ILaunchListener {
*/
@Override
public void launchRemoved(ILaunch launch) {}
+
+ /**
+ * Returns any step filters that have been contributed for the given model
+ * identifier.
+ *
+ * @param modelIdentifier the model identifier
+ * @return step filters that have been contributed for the given model
+ * identifier, possibly an empty collection
+ * @since 3.9
+ * @see org.eclipse.debug.core.model.IStepFilter
+ */
+ public IStepFilter[] getStepFilters(String modelIdentifier) {
+ initialize();
+ List<IStepFilter> select = new ArrayList<IStepFilter>();
+ for (StepFilter extension : stepFilters) {
+ for (IStepFilter stepFilter : extension.getStepFilters(modelIdentifier)) {
+ select.add(stepFilter);
+ }
+ }
+ return select.toArray(new IStepFilter[select.size()]);
+ }
+
+ private List<StepFilter> stepFilters = null;
+
+ private synchronized void initialize() {
+ if (stepFilters == null) {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), DebugPlugin.EXTENSION_POINT_STEP_FILTERS);
+ IConfigurationElement[] extensions = point.getConfigurationElements();
+ stepFilters = new ArrayList<StepFilter>();
+ for (IConfigurationElement extension : extensions) {
+ try {
+ stepFilters.add(new StepFilter(extension));
+ } catch (CoreException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ }
+ }
}
diff --git a/org.eclipse.debug.core/plugin.properties b/org.eclipse.debug.core/plugin.properties
index 4cc7b0879..4878f35d1 100644
--- a/org.eclipse.debug.core/plugin.properties
+++ b/org.eclipse.debug.core/plugin.properties
@@ -24,6 +24,7 @@ watchExpressionDelegatesName= Watch Expression Delegates
processFactoriesExtensionPointName=Process Factories
logicalStructureTypesExtensionPointName=Logical Structure Types
logicalStructureProvidersExtensionPointName=Logical Structure Providers
+stepFiltersExtensionPointName=Step Filters
sourceContainerTypesName = Source Container Types
sourcePathComputersName = Source Path Computers
diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml
index 989b29a13..b5ef8fde5 100644
--- a/org.eclipse.debug.core/plugin.xml
+++ b/org.eclipse.debug.core/plugin.xml
@@ -30,6 +30,7 @@
<extension-point id="sourcePathComputers" name="%sourcePathComputersName" schema="schema/sourcePathComputers.exsd"/>
<extension-point id="logicalStructureProviders" name="%logicalStructureProvidersExtensionPointName" schema="schema/logicalStructureProviders.exsd"/>
<extension-point id="breakpointImportParticipants" name="%breakpointImportParticipantsExtensionPoint.name" schema="schema/breakpointImportParticipants.exsd"/>
+ <extension-point id="stepFilters" name="%stepFiltersExtensionPointName" schema="schema/stepFilters.exsd"/>
<!-- Extensions -->
<extension
diff --git a/org.eclipse.debug.core/schema/stepFilters.exsd b/org.eclipse.debug.core/schema/stepFilters.exsd
new file mode 100644
index 000000000..7c10e1105
--- /dev/null
+++ b/org.eclipse.debug.core/schema/stepFilters.exsd
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.debug.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.debug.core" id="stepFilters" name="Step Filters"/>
+ </appInfo>
+ <documentation>
+ This extension point allows contributors to provide multiple step filters for a model identifier.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="stepFilter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="stepFilter">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ fully qualified name of a Java class that implements &lt;code&gt;IStepFilter&lt;/code&gt;.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.debug.core.model.IStepFilter"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="modelIdentifier" type="string" use="required">
+ <annotation>
+ <documentation>
+ identifier of the debug model this step filter is associated with
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.9
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a step filter extension point:
+
+&lt;p&gt;
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.debug.core.stepFilters&quot;&gt;
+ &lt;stepFilter
+ class=&quot;com.example.ExampleStepFilter&quot;
+ modelIdentifier=&quot;com.example.debug.model&quot;&gt;
+ &lt;/stepFilter&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+
+In the example above, the specified step filter will be used for the &lt;code&gt;com.example.debug.model&lt;/code&gt; debug model.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ Value of the attribute &lt;b&gt;class&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.IStepFilter&lt;/b&gt;.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others.&lt;br&gt;
+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
+&lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>

Back to the top