Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2009-04-21 00:53:33 +0000
committerAlena Laskavaia2009-04-21 00:53:33 +0000
commit5407d0d337ec69ca44fd76c83aee772a3214787d (patch)
treece93d407c51c11100fd488ee1362222f20950487 /codan
parent86a922370c581c24435eb97f6064b194c6cfe80c (diff)
downloadorg.eclipse.cdt-5407d0d337ec69ca44fd76c83aee772a3214787d.tar.gz
org.eclipse.cdt-5407d0d337ec69ca44fd76c83aee772a3214787d.tar.xz
org.eclipse.cdt-5407d0d337ec69ca44fd76c83aee772a3214787d.zip
refactored error reported
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanBuilder.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java3
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ErrorReporter.java)8
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanRuntime.java28
-rw-r--r--codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java2
5 files changed, 37 insertions, 8 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanBuilder.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanBuilder.java
index 045ad426fca..e901b60cc5c 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanBuilder.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/builder/CodanBuilder.java
@@ -14,7 +14,7 @@ import java.util.Map;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
import org.eclipse.cdt.codan.core.model.CheckersRegisry;
-import org.eclipse.cdt.codan.core.model.ErrorReporter;
+import org.eclipse.cdt.codan.core.model.CodanRuntime;
import org.eclipse.cdt.codan.core.model.IChecker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -90,7 +90,7 @@ public class CodanBuilder extends IncrementalProjectBuilder {
// CodanCorePlugin.PLUGIN_ID, "problems", "", null);
// System.err.println("set = " + string);
// delete general markers
- ErrorReporter.deleteMarkers(resource);
+ CodanRuntime.getInstance().getProblemReporter().deleteMarkers(resource);
for (IChecker checker : CheckersRegisry.getInstance()) {
try {
boolean run = false;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java
index e56437dc65e..e0aa16437a7 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java
@@ -25,6 +25,7 @@ public abstract class AbstractChecker implements IChecker {
public void reportProblem(String id, IFile file, int lineNumber,
String message) {
- ErrorReporter.reportProblem(id, file, lineNumber, message);
+ CodanRuntime.getInstance().getProblemReporter().reportProblem(id, file,
+ lineNumber, message);
}
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ErrorReporter.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java
index baff427ae1a..1205eac8bd2 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ErrorReporter.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanProblemReporter.java
@@ -16,10 +16,10 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-public class ErrorReporter {
+public class CodanProblemReporter {
public static final String GENERIC_CODE_ANALYSIS_MARKER_TYPE = "org.eclipse.cdt.codan.core.codanProblem";
- public static void reportProblem(String id, IFile file, int lineNumber,
+ public void reportProblem(String id, IFile file, int lineNumber,
String message) {
try {
if (file == null)
@@ -46,7 +46,7 @@ public class ErrorReporter {
}
}
- public static void deleteMarkers(IResource file) {
+ public void deleteMarkers(IResource file) {
try {
file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, false,
IResource.DEPTH_ZERO);
@@ -54,7 +54,7 @@ public class ErrorReporter {
}
}
- public static void deleteAllMarkers() {
+ public void deleteAllMarkers() {
try {
// TODO delete contributed markers too
ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanRuntime.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanRuntime.java
new file mode 100644
index 00000000000..13f8926afb1
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/CodanRuntime.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Alena Laskavaia
+ * 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.model;
+
+/**
+ * Runtime singleton class to get access to Codan framework parts
+ *
+ */
+public class CodanRuntime {
+ private static CodanRuntime instance = new CodanRuntime();
+ private CodanProblemReporter problemReporter = new CodanProblemReporter();
+
+ public CodanProblemReporter getProblemReporter() {
+ return problemReporter;
+ }
+
+ public static CodanRuntime getInstance() {
+ return instance;
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java
index 08111ffe039..2f2a2de473d 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/BuildPropertyPage.java
@@ -55,7 +55,7 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements
// "Confirmation",
// "Do you want to remove existing problems? If build is disabled they won't be updated anymore.");
// if (openQuestion == true) {
- // ErrorReporter.deleteAllMarkers();
+ // CodanProblemReporter.deleteAllMarkers();
// }
// }
return true;

Back to the top