Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2015-03-04 20:09:41 +0000
committerGerrit Code Review @ Eclipse.org2015-03-05 14:19:54 +0000
commit82274d4060c513ae2531860f68d19c743e66d3f8 (patch)
tree432dac7fa3cceeb8ad814b9f900a8bc7bd6eca2c /codan/org.eclipse.cdt.codan.core.cxx
parent6c8408c1d5376b015d199779dbe2127a7ff01db5 (diff)
downloadorg.eclipse.cdt-82274d4060c513ae2531860f68d19c743e66d3f8.tar.gz
org.eclipse.cdt-82274d4060c513ae2531860f68d19c743e66d3f8.tar.xz
org.eclipse.cdt-82274d4060c513ae2531860f68d19c743e66d3f8.zip
added codan marker generator
its required for some cdt classes like console parsers Change-Id: Ibde68774656a15c735dce08d5f3041dc56a7266f Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.cxx')
-rw-r--r--codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF3
-rw-r--r--codan/org.eclipse.cdt.codan.core.cxx/pom.xml2
-rw-r--r--codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/CodanMarkerGenerator.java63
3 files changed, 66 insertions, 2 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF
index 1500dbc3243..880142e5045 100644
--- a/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.core.cxx/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.cdt.codan.core.cxx;singleton:=true
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.codan.core.cxx.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.core,
@@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.cdt.codan.core.cxx,
org.eclipse.cdt.codan.core.cxx.externaltool,
+ org.eclipse.cdt.codan.core.cxx.internal.externaltool,
org.eclipse.cdt.codan.core.cxx.internal.model;x-friends:="org.eclipse.cdt.codan.checkers.ui,org.eclipse.cdt.codan.ui,org.eclipse.cdt.codan.ui.cxx",
org.eclipse.cdt.codan.core.cxx.internal.model.cfg;x-friends:="org.eclipse.cdt.codan.core.test",
org.eclipse.cdt.codan.core.cxx.model
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/pom.xml b/codan/org.eclipse.cdt.codan.core.cxx/pom.xml
index 9d4068b67d7..37ddea34ded 100644
--- a/codan/org.eclipse.cdt.codan.core.cxx/pom.xml
+++ b/codan/org.eclipse.cdt.codan.core.cxx/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.3.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.codan.core.cxx</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/CodanMarkerGenerator.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/CodanMarkerGenerator.java
new file mode 100644
index 00000000000..6bbab47b5ca
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/model/CodanMarkerGenerator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems 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
+ *
+ * Contributors:
+ * Alena Laskavaia - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.cxx.model;
+
+import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.cdt.codan.core.model.IProblemLocation;
+import org.eclipse.cdt.codan.core.model.IProblemLocationFactory;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
+import org.eclipse.cdt.codan.internal.core.model.CodanProblemLocation;
+import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.ProblemMarkerInfo;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+
+/**
+ * Default implementation of IMarkerGenerator for API's that require such thing
+ *
+ * @since 3.3
+ */
+public class CodanMarkerGenerator implements IMarkerGenerator {
+ private final String problemId;
+ private final IProblemReporter reporter;
+
+ public CodanMarkerGenerator(String problemId) {
+ this.problemId = problemId;
+ this.reporter = CodanRuntime.getInstance().getProblemReporter();
+ }
+
+ public CodanMarkerGenerator(String problemId, IProblemReporter reporter) {
+ this.problemId = problemId;
+ this.reporter = reporter;
+ }
+
+ @Deprecated
+ public void addMarker(IResource file, int lineNumber, String description, int severity, String variableName) {
+ addMarker(new ProblemMarkerInfo(file, lineNumber, description, severity, variableName));
+ }
+
+ @Override
+ public void addMarker(ProblemMarkerInfo info) {
+ reporter.reportProblem(getProblemId(info.severity), createProblemLocation(info), info.description, info.variableName);
+ }
+
+ protected String getProblemId(int severity) {
+ return problemId;
+ }
+
+ protected IProblemLocation createProblemLocation(ProblemMarkerInfo info) {
+ IProblemLocationFactory factory = CodanRuntime.getInstance().getProblemLocationFactory();
+ if (info.file instanceof IFile)
+ return factory.createProblemLocation((IFile) info.file, info.startChar, info.endChar, info.lineNumber);
+ else
+ return new CodanProblemLocation(info.file, info.startChar, info.endChar, info.lineNumber);
+ }
+}

Back to the top