Skip to main content
summaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorAlena Laskavaia2010-05-24 10:09:18 -0400
committerAlena Laskavaia2010-05-24 10:09:18 -0400
commitdab37d2d92b2c82e7fa9364966adc2556041a2c6 (patch)
treed1cf8700083ef2e4a2e82474ff506ebc7715b979 /codan
parent3a426fb5fcecb5fbd59989f0bf7494917bb0b752 (diff)
downloadorg.eclipse.cdt-dab37d2d92b2c82e7fa9364966adc2556041a2c6.tar.gz
org.eclipse.cdt-dab37d2d92b2c82e7fa9364966adc2556041a2c6.tar.xz
org.eclipse.cdt-dab37d2d92b2c82e7fa9364966adc2556041a2c6.zip
Fixed interface to return resource instead of file because in general problem can be on directory too not only file
Diffstat (limited to 'codan')
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java9
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java17
3 files changed, 16 insertions, 14 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java
index 12949abdec..6677ad6c9e 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemLocation.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.codan.core.model;
-import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
/**
* Interface to describe problem location. Usually contains file and linenumber,
@@ -24,7 +24,7 @@ public interface IProblemLocation {
*
* @return File for the problem - absolute full paths
*/
- IFile getFile();
+ IResource getFile();
/**
*
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java
index d6b378fab2..c31eb9d35a 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanApplication.java
@@ -6,8 +6,8 @@ import java.util.Collection;
import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.core.Messages;
import org.eclipse.cdt.codan.internal.core.model.CodanMarkerProblemReporter;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -40,8 +40,8 @@ public class CodanApplication implements IApplication {
runtime.setProblemReporter(new CodanMarkerProblemReporter() {
@Override
public void reportProblem(String id, String markerType,
- int severity, IFile file, int lineNumber, int startChar,
- int endChar, String message) {
+ int severity, IResource file, int lineNumber,
+ int startChar, int endChar, String message) {
System.out.println(file.getLocation() + ":" + lineNumber + ": " //$NON-NLS-1$ //$NON-NLS-2$
+ message);
}
@@ -55,7 +55,8 @@ public class CodanApplication implements IApplication {
log(Messages.CodanApplication_LogRunProject + project);
IProject wProject = root.getProject(project);
if (!wProject.exists()) {
- System.err.println( //
+ System.err
+ .println( //
NLS.bind(
Messages.CodanApplication_Error_ProjectDoesNotExists,
project));
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
index 9a87547381..086b59967b 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
@@ -22,7 +22,6 @@ import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemLocation;
import org.eclipse.cdt.codan.core.model.IProblemReporterPersistent;
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -38,14 +37,14 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
* java.lang.Object[])
*/
public void reportProblem(String id, IProblemLocation loc, Object... args) {
- IFile file = loc.getFile();
+ IResource file = loc.getFile();
int lineNumber = loc.getLineNumber();
if (file == null)
throw new NullPointerException("file"); //$NON-NLS-1$
if (id == null)
throw new NullPointerException("id"); //$NON-NLS-1$
- IProblem problem = CheckersRegistry.getInstance().getResourceProfile(
- file).findProblem(id);
+ IProblem problem = CheckersRegistry.getInstance()
+ .getResourceProfile(file).findProblem(id);
if (problem == null)
throw new IllegalArgumentException("Id is not registered:" + id); //$NON-NLS-1$
if (problem.isEnabled() == false)
@@ -71,7 +70,7 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
* lang.String, org.eclipse.core.resources.IFile, int, java.lang.String)
*/
public void reportProblem(String id, String markerType, int severity,
- IFile file, int lineNumber, int startChar, int endChar,
+ IResource file, int lineNumber, int startChar, int endChar,
String message) {
try {
// Do not put in duplicates
@@ -115,9 +114,11 @@ public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
public void deleteAllProblems() {
try {
- ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(
- GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
- IResource.DEPTH_INFINITE);
+ ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
+ IResource.DEPTH_INFINITE);
} catch (CoreException e) {
CodanCorePlugin.log(e);
}

Back to the top