{@link org.eclipse.cdt.core.IErrorParser}
s can be
- * used.
- *
- * @since 5.4
- */
-public class ErrorParserContext {
- public static final int BUILD = 1 << 0;
- public static final int CODAN = 1 << 1;
-
- public static int getValue(String text) {
- if ("build".equals(text)) { //$NON-NLS-1$
- return BUILD;
- }
- if ("codan".equals(text)) { //$NON-NLS-1$
- return CODAN;
- }
- throw new IllegalArgumentException("Unknown context value: " + text); //$NON-NLS-1$
- }
-}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
index eca556d38dc..3dc57672c5e 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java
@@ -11,11 +11,10 @@
* James Blackburn (Broadcom) - Bug 247838
* Andrew Gvozdev (Quoin Inc)
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
+ * Alex Ruiz (Google)
*******************************************************************************/
package org.eclipse.cdt.core;
-import static org.eclipse.cdt.core.ErrorParserContext.BUILD;
-
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
@@ -68,6 +67,11 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
*/
public final static char ERROR_PARSER_DELIMITER = ';';
+ /**
+ * @since 5.4
+ */
+ public static final String BUILD_CONTEXT = "build"; //$NON-NLS-1$
+
private int nOpens;
private int lineCounter=0;
@@ -75,7 +79,7 @@ public class ErrorParserManager extends OutputStream implements IConsoleParser,
private final IMarkerGenerator fMarkerGenerator;
private Map{@link ErrorParserContext}
.
- * @see ErrorParserContext
- * @since 5.4
- */
- public ErrorParserManager(IProject project, URI baseDirectoryURI,
- IMarkerGenerator markerGenerator, String[] parsersIDs, int context) {
fProject = project;
fMarkerGenerator = markerGenerator;
fDirectoryStack = new Vector{@link ErrorParserContext}
.
- * @return cloned copy of error parser or {@code null}.
- * Note that {@link ErrorParserNamedWrapper} returns shallow copy with the same instance
- * of underlying error parser.
- * @see ErrorParserContext
- * @since 5.4
- */
- public static IErrorParserNamed getErrorParserCopy(String id, int context) {
- return ErrorParserExtensionManager.getErrorParserCopy(id, false, context);
- }
-
/**
* @param id - ID of error parser
* @return cloned copy of error parser as defined by its extension point or {@code null}.
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserExtensionManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserExtensionManager.java
index e2ec9d561de..dfdbf9120e4 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserExtensionManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorParserExtensionManager.java
@@ -11,12 +11,14 @@
*******************************************************************************/
package org.eclipse.cdt.internal.errorparsers;
-import static org.eclipse.cdt.core.ErrorParserContext.BUILD;
-
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -25,7 +27,6 @@ import java.util.Set;
import java.util.TreeSet;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ErrorParserContext;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IErrorParser;
import org.eclipse.cdt.core.IErrorParserNamed;
@@ -33,7 +34,6 @@ import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.errorparsers.ErrorParserNamedWrapper;
import org.eclipse.cdt.core.errorparsers.RegexErrorParser;
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
-import org.eclipse.cdt.internal.core.Pair;
import org.eclipse.cdt.internal.core.XmlUtil;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.CoreException;
@@ -71,7 +71,6 @@ public class ErrorParserExtensionManager {
private static final String ATTR_POINT = "point"; //$NON-NLS-1$
private static final String ATTR_TYPE = "type"; //$NON-NLS-1$
-
private static final String ATTR_REGEX = "regex"; //$NON-NLS-1$
private static final String ATTR_SEVERITY = "severity"; //$NON-NLS-1$
private static final String ATTR_FILE = "file-expr"; //$NON-NLS-1$
@@ -85,10 +84,9 @@ public class ErrorParserExtensionManager {
private static final String ATTR_VALUE_INFO = "Info"; //$NON-NLS-1$
private static final String ATTR_VALUE_IGNORE = "Ignore"; //$NON-NLS-1$
- // Key: error parser id. Value: pair of error parser and contexts value
- private static final LinkedHashMap{@link ErrorParserContext}
.
+ * Finds the contexts where an error parser can be used. Clients determine whether the found
+ * context values are valid.
*
+ * @param errorParserId the error parser id.
* @param errorParserElement represents an "errorparser" element in the extension point
* "org.eclipse.cdt.core.ErrorParser".
- * @return the contexts in which an error parser can be used, or
- * {@link ErrorParserContext#BUILD BUILD}
is none is specified.
- * @see ErrorParserContext
*/
- private static int contextTypes(IConfigurationElement errorParserElement) {
+ private static void findContexts(String errorParserId, IConfigurationElement errorParserElement) {
+ Set{@link ErrorParserContext}
.
- * @return cloned copy of error parser. Note that {@link ErrorParserNamedWrapper} returns
- * shallow copy with the same instance of underlying error parser.
- * @see ErrorParserContext
- */
- public static IErrorParserNamed getErrorParserCopy(String id, boolean isExtension,
- int context) {
- Pair+ * If an error parser does not have an explicit context, it is assumed that the error parser + * can be used in the "build" context. + *
+ * @param id the id of the error parser. + * @return the contexts of the error parser with the given ID. + */ + private static Collection