summaryrefslogtreecommitdiffstats
path: root/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model
diff options
context:
space:
mode:
authorElliott Baron <ebaron@fedoraproject.org>2010-06-26 22:27:34 -0400
committerElliott Baron <ebaron@fedoraproject.org>2010-06-26 22:27:34 -0400
commit4e112eca7750a4f530c986be55c178c43c16d3ea (patch)
treedb140c4fe4db9945502398e4869707ca0346353e /org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model
parentaa73b3f2503808e4b4029a73368a75b258d6f0dc (diff)
downloadcodan-4e112eca7750a4f530c986be55c178c43c16d3ea.tar.gz
codan-4e112eca7750a4f530c986be55c178c43c16d3ea.tar.xz
codan-4e112eca7750a4f530c986be55c178c43c16d3ea.zip
Update codan plugins to CDT 7.0.HEADmaster
* org.eclipse.cdt.codan.checkers.ui: Updated. * org.eclipse.cdt.codan.checkers: Updated. * org.eclipse.cdt.codan.core: Updated. * org.eclipse.cdt.codan.ui: Updated. * org.eclipse.cdt.codan.core.cxx: Added. * org.eclipse.cdt.codan.extension/META-INF/MANIFEST.MF: Import org.eclipse.cdt.codan.core.cxx.model. * org.eclipse.cdt.codan.extension/src/org/eclipse/cdt/codan/extension/checkers/AbstractPropSimChecker.java: Superclass moved.
Diffstat (limited to 'org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model')
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries11
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Tag1
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java132
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java87
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java33
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemLocation.java33
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemLocationFactory.java53
-rw-r--r--org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java18
8 files changed, 265 insertions, 103 deletions
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries
index 5f7a029..182ee54 100644
--- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Entries
@@ -1,5 +1,6 @@
-/CodanMarkerProblemReporter.java/1.2/Wed Dec 16 21:48:48 2009//
-/CodanProblem.java/1.1/Sat Aug 22 21:16:48 2009//
-/CodanProblemCategory.java/1.2/Wed Dec 16 21:48:48 2009//
-/ProblemProfile.java/1.1/Wed Sep 23 23:29:36 2009//
-D
+/CodanMarkerProblemReporter.java/1.15/Sun Jun 27 01:30:42 2010//TCDT_7_0_0
+/CodanProblem.java/1.9/Sun Jun 27 01:30:42 2010//TCDT_7_0_0
+/CodanProblemCategory.java/1.4/Sun Jun 27 01:30:42 2010//TCDT_7_0_0
+/CodanProblemLocation.java/1.4/Sun Jun 27 01:30:42 2010//TCDT_7_0_0
+/ProblemLocationFactory.java/1.3/Sun Jun 27 01:30:42 2010//TCDT_7_0_0
+/ProblemProfile.java/1.3/Sun Jun 27 01:30:42 2010//TCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Tag b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Tag
new file mode 100644
index 0000000..49a449a
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CVS/Tag
@@ -0,0 +1 @@
+NCDT_7_0_0
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
index a4599c5..51a4794 100644
--- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanMarkerProblemReporter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -11,39 +11,40 @@
package org.eclipse.cdt.codan.internal.core.model;
import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.cdt.codan.core.CodanCorePlugin;
+import org.eclipse.cdt.codan.core.CodanRuntime;
+import org.eclipse.cdt.codan.core.model.IChecker;
+import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemLocation;
-import org.eclipse.cdt.codan.core.model.IProblemReporter;
-import org.eclipse.cdt.codan.internal.core.CheckersRegisry;
-import org.eclipse.core.resources.IFile;
+import org.eclipse.cdt.codan.core.model.IProblemReporterPersistent;
+import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
-public class CodanMarkerProblemReporter implements IProblemReporter {
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
- * lang.String, org.eclipse.cdt.codan.core.model.IProblemLocation,
- * java.lang.Object[])
- */
+/**
+ * Problem reported that created eclipse markers
+ */
+public class CodanMarkerProblemReporter implements IProblemReporterPersistent {
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");
+ throw new NullPointerException("file"); //$NON-NLS-1$
if (id == null)
- throw new NullPointerException("id");
- IProblem problem = CheckersRegisry.getInstance().getResourceProfile(
- file).findProblem(id);
+ throw new NullPointerException("id"); //$NON-NLS-1$
+ IProblem problem = CheckersRegistry.getInstance()
+ .getResourceProfile(file).findProblem(id);
if (problem == null)
- throw new IllegalArgumentException("Id is not registered");
+ throw new IllegalArgumentException("Id is not registered:" + id); //$NON-NLS-1$
if (problem.isEnabled() == false)
return; // skip
int severity = problem.getSeverity().intValue();
@@ -53,25 +54,31 @@ public class CodanMarkerProblemReporter implements IProblemReporter {
if (args != null && args.length > 0 && args[0] instanceof String)
message = (String) args[0];
} else {
- MessageFormat.format(messagePattern, args);
+ message = MessageFormat.format(messagePattern, args);
}
- reportProblem(id, severity, file, lineNumber, loc.getStartingChar(),
- loc.getEndingChar(), message);
+ reportProblem(id, problem.getMarkerType(), severity, file, lineNumber,
+ loc.getStartingChar(), loc.getEndingChar(), message);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.cdt.codan.core.model.IProblemReporter#reportProblem(java.
- * lang.String, org.eclipse.core.resources.IFile, int, java.lang.String)
+ /**
+ * @param id - problem id
+ * @param markerType - marker id
+ * @param severity - marker severity
+ * @param file - resource
+ * @param lineNumber - line number for error
+ * @param startChar - start char (offset in charts from the begging of the
+ * document)
+ * @param endChar - end char (offset in charts from the begging of the
+ * document, exclusive)
+ * @param message - marker message
*/
- public void reportProblem(String id, int severity, IFile file,
- int lineNumber, int startChar, int endChar, String message) {
+ public void reportProblem(String id, String markerType, int severity,
+ IResource file, int lineNumber, int startChar, int endChar,
+ String message) {
try {
// Do not put in duplicates
- IMarker[] cur = file.findMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE,
- false, IResource.DEPTH_ZERO);
+ IMarker[] cur = file.findMarkers(markerType, false,
+ IResource.DEPTH_ZERO);
if (cur != null) {
for (IMarker element : cur) {
int line = ((Integer) element
@@ -86,37 +93,72 @@ public class CodanMarkerProblemReporter implements IProblemReporter {
}
}
}
- IMarker marker = file
- .createMarker(GENERIC_CODE_ANALYSIS_MARKER_TYPE);
+ IMarker marker = file.createMarker(markerType);
marker.setAttribute(IMarker.MESSAGE, message);
marker.setAttribute(IMarker.SEVERITY, severity);
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
marker.setAttribute(IMarker.PROBLEM, id);
marker.setAttribute(IMarker.CHAR_END, endChar);
marker.setAttribute(IMarker.CHAR_START, startChar);
+ marker.setAttribute("org.eclipse.cdt.core.problem", 42); //$NON-NLS-1$
} catch (CoreException e) {
e.printStackTrace();
}
}
- public void deleteMarkers(IResource file) {
+ public void deleteProblems(IResource file) {
try {
- file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, false,
+ file.deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
IResource.DEPTH_ZERO);
} catch (CoreException ce) {
ce.printStackTrace();
}
}
- public void deleteAllMarkers() {
+ public void deleteAllProblems() {
try {
- // TODO delete contributed markers too
- ResourcesPlugin.getWorkspace().getRoot().deleteMarkers(
- GENERIC_CODE_ANALYSIS_MARKER_TYPE, false,
- IResource.DEPTH_INFINITE);
+ ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .deleteMarkers(GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
+ IResource.DEPTH_INFINITE);
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ CodanCorePlugin.log(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.IProblemReporterPersistent#deleteProblems
+ * (org.eclipse.core.resources.IResource,
+ * org.eclipse.cdt.codan.core.model.IChecker)
+ */
+ public void deleteProblems(final IResource file, final IChecker checker) {
+ try {
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ IMarker[] markers = file.findMarkers(
+ GENERIC_CODE_ANALYSIS_MARKER_TYPE, true,
+ IResource.DEPTH_INFINITE);
+ ICheckersRegistry reg = CodanRuntime.getInstance()
+ .getChechersRegistry();
+ for (int i = 0; i < markers.length; i++) {
+ IMarker m = markers[i];
+ String id = m.getAttribute(IMarker.PROBLEM, ""); //$NON-NLS-1$
+ Collection<IProblem> problems = reg.getRefProblems(checker);
+ for (Iterator<IProblem> iterator = problems.iterator(); iterator
+ .hasNext();) {
+ IProblem iProblem = iterator.next();
+ if (iProblem.getId().equals(id))
+ m.delete();
+ }
+ }
+ }
+ }, null, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ CodanCorePlugin.log(e);
}
}
}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
index a094cc1..56b43c5 100644
--- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -10,20 +10,21 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.model;
-import java.util.Collection;
-import java.util.HashMap;
-
import org.eclipse.cdt.codan.core.model.CodanSeverity;
-import org.eclipse.cdt.codan.core.model.IProblem;
-import org.eclipse.cdt.codan.core.model.IProblemCategory;
+import org.eclipse.cdt.codan.core.model.IProblemReporter;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
+import org.eclipse.cdt.codan.core.param.IProblemPreference;
-public class CodanProblem implements IProblem {
+public class CodanProblem implements IProblemWorkingCopy {
private String id;
private String name;
private String message;
private CodanSeverity severity = CodanSeverity.Warning;
private boolean enabled = true;
- private HashMap<Object, Object> properties = new HashMap<Object, Object>(0);
+ private IProblemPreference preference;
+ private boolean frozen;
+ private String description;
+ private String markerType = IProblemReporter.GENERIC_CODE_ANALYSIS_MARKER_TYPE;
public CodanSeverity getSeverity() {
return severity;
@@ -32,6 +33,7 @@ public class CodanProblem implements IProblem {
public CodanProblem(String problemId, String name) {
this.id = problemId;
this.name = name;
+ this.frozen = false;
}
public String getName() {
@@ -42,11 +44,6 @@ public class CodanProblem implements IProblem {
return id;
}
- public IProblemCategory getCategory() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public String toString() {
return name;
@@ -73,19 +70,19 @@ public class CodanProblem implements IProblem {
*/
@Override
public Object clone() throws CloneNotSupportedException {
- return super.clone();
+ CodanProblem prob = (CodanProblem) super.clone();
+ if (preference != null) {
+ prob.preference = (IProblemPreference) preference.clone();
+ }
+ return prob;
}
- public void setProperty(Object key, Object value) {
- properties.put(key, value);
+ public void setPreference(IProblemPreference value) {
+ preference = value;
}
- public Object getProperty(Object key) {
- return properties.get(key);
- };
-
- public Collection<Object> getPropertyKeys() {
- return properties.keySet();
+ public IProblemPreference getPreference() {
+ return preference;
}
/*
@@ -97,10 +94,54 @@ public class CodanProblem implements IProblem {
return message;
}
+ protected void freeze() {
+ frozen = true;
+ }
+
/**
- * @param message the message to set
+ * @param message
+ * the message to set
*/
public void setMessagePattern(String message) {
+ checkSet();
this.message = message;
}
+
+ protected void checkSet() {
+ if (frozen)
+ throw new IllegalStateException("Object is unmodifieble"); //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.model.IProblem#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.IProblemWorkingCopy#setDescription(java
+ * .lang.String)
+ */
+ public void setDescription(String desc) {
+ this.description = desc;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.codan.core.model.IProblem#getMarkerType()
+ */
+ public String getMarkerType() {
+ return markerType;
+ }
+
+ public void setMarkerType(String type) {
+ markerType = type;
+ }
}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
index fc63480..0156211 100644
--- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemCategory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -41,40 +41,36 @@ public class CodanProblemCategory implements IProblemCategory, Cloneable {
}
public IProblemElement[] getChildren() {
- return (IProblemElement[]) list.toArray(new IProblemElement[list.size()]);
+ return list.toArray(new IProblemElement[list.size()]);
}
public void addChild(IProblemElement p) {
list.add(p);
}
- public IProblem findProblem(String id) {
- Object[] children = this.getChildren();
+ public static IProblem findProblem(IProblemCategory c, String id) {
+ Object[] children = c.getChildren();
for (Object object : children) {
if (object instanceof IProblemCategory) {
IProblemCategory cat = (IProblemCategory) object;
- IProblem found = cat.findProblem(id);
- if (found != null)
- return found;
+ IProblem found = findProblem(cat, id);
+ if (found != null) return found;
} else if (object instanceof IProblem) {
IProblem p = (IProblem) object;
- if (p.getId().equals(id))
- return p;
+ if (p.getId().equals(id)) return p;
}
}
return null;
}
- public IProblemCategory findCategory(String id) {
- if (getId().equals(id))
- return this;
- Object[] children = getChildren();
+ public static IProblemCategory findCategory(IProblemCategory cat, String id) {
+ if (cat.getId().equals(id)) return cat;
+ Object[] children = cat.getChildren();
for (Object object : children) {
if (object instanceof IProblemCategory) {
- IProblemCategory cat = (IProblemCategory) object;
- IProblemCategory found = cat.findCategory(id);
- if (found != null)
- return found;
+ IProblemCategory cat2 = (IProblemCategory) object;
+ IProblemCategory found = findCategory(cat2, id);
+ if (found != null) return found;
}
}
return null;
@@ -90,8 +86,7 @@ public class CodanProblemCategory implements IProblemCategory, Cloneable {
try {
CodanProblemCategory clone = (CodanProblemCategory) super.clone();
clone.list = new ArrayList<IProblemElement>();
- for (Iterator<IProblemElement> iterator = this.list.iterator(); iterator
- .hasNext();) {
+ for (Iterator<IProblemElement> iterator = this.list.iterator(); iterator.hasNext();) {
IProblemElement child = iterator.next();
clone.list.add((IProblemElement) child.clone());
}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemLocation.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemLocation.java
new file mode 100644
index 0000000..ca6bd02
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemLocation.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.internal.core.model;
+
+import org.eclipse.cdt.codan.core.model.AbstractProblemLocation;
+import org.eclipse.core.resources.IFile;
+
+/**
+ * Codan Problem Location, so far same as abstract class
+ *
+ */
+public class CodanProblemLocation extends AbstractProblemLocation {
+ public CodanProblemLocation(IFile file, int startChar, int endChar) {
+ super(file, startChar, endChar);
+ }
+
+ public CodanProblemLocation(IFile file, int startChar, int endChar, int line) {
+ super(file, startChar, endChar);
+ this.line = line;
+ }
+
+ protected CodanProblemLocation(IFile file, int line) {
+ super(file, line);
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemLocationFactory.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemLocationFactory.java
new file mode 100644
index 0000000..835f6bf
--- /dev/null
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemLocationFactory.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 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.internal.core.model;
+
+import org.eclipse.cdt.codan.core.model.IProblemLocation;
+import org.eclipse.cdt.codan.core.model.IProblemLocationFactory;
+import org.eclipse.core.resources.IFile;
+
+/**
+ * Factory class that allows to create problem locations
+ *
+ */
+public class ProblemLocationFactory implements IProblemLocationFactory {
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
+ * createProblemLocation(org.eclipse.core.resources.IFile, int)
+ */
+ public IProblemLocation createProblemLocation(IFile file, int line) {
+ return new CodanProblemLocation(file, line);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
+ * createProblemLocation(org.eclipse.core.resources.IFile, int, int)
+ */
+ public IProblemLocation createProblemLocation(IFile file, int startChar,
+ int endChar) {
+ return new CodanProblemLocation(file, startChar, endChar);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.codan.core.model.IProblemLocationFactory#
+ * createProblemLocation(org.eclipse.core.resources.IFile, int, int, int)
+ */
+ public IProblemLocation createProblemLocation(IFile file, int startChar,
+ int endChar, int line) {
+ return new CodanProblemLocation(file, startChar, endChar, line);
+ }
+}
diff --git a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java
index d2330f1..1eb045b 100644
--- a/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java
+++ b/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Alena Laskavaia
+ * Copyright (c) 2009, 2010 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
@@ -22,8 +22,7 @@ import org.eclipse.cdt.codan.core.model.IProblemProfile;
*
*/
public class ProblemProfile implements IProblemProfile, Cloneable {
- private IProblemCategory rootCategory = new CodanProblemCategory("root",
- "root");
+ private IProblemCategory rootCategory = new CodanProblemCategory("root", "root"); //$NON-NLS-1$ //$NON-NLS-2$
/*
* (non-Javadoc)
@@ -33,7 +32,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
* .String)
*/
public IProblem findProblem(String id) {
- return getRoot().findProblem(id);
+ return CodanProblemCategory.findProblem(getRoot(), id);
}
/*
@@ -51,8 +50,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
* @param root
* @param problems
*/
- protected void collectProblems(IProblemCategory parent,
- Collection<IProblem> problems) {
+ protected void collectProblems(IProblemCategory parent, Collection<IProblem> problems) {
Object[] children = parent.getChildren();
for (Object object : children) {
if (object instanceof IProblemCategory) {
@@ -69,13 +67,12 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
}
public void addProblem(IProblem p, IProblemCategory cat) {
- if (cat == null)
- cat = getRoot();
+ if (cat == null) cat = getRoot();
((CodanProblemCategory) cat).addChild(p);
}
public IProblemCategory findCategory(String id) {
- return getRoot().findCategory(id);
+ return CodanProblemCategory.findCategory(getRoot(), id);
}
/*
@@ -87,8 +84,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
public Object clone() {
try {
ProblemProfile clone = (ProblemProfile) super.clone();
- clone.rootCategory = (IProblemCategory) ((CodanProblemCategory) this.rootCategory)
- .clone();
+ clone.rootCategory = (IProblemCategory) ((CodanProblemCategory) this.rootCategory).clone();
return clone;
} catch (CloneNotSupportedException e) {
return this;