Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.ui.prefs54
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java85
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java33
3 files changed, 154 insertions, 18 deletions
diff --git a/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.ui.prefs b/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..2117213dd56
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,54 @@
+#Fri Nov 20 13:57:56 EST 2009
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
index 64141f31882..56616224f36 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CheckersRegisry.java
@@ -44,6 +44,7 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
private Collection<IChecker> checkers = new ArrayList<IChecker>();
private static CheckersRegisry instance;
private HashMap<Object, IProblemProfile> profiles = new HashMap<Object, IProblemProfile>();
+ private HashMap<IChecker, Collection<IProblem>> problemList = new HashMap<IChecker, Collection<IProblem>>();
private CheckersRegisry() {
instance = this;
@@ -135,7 +136,9 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
}
}
if (!hasRef) {
- addProblem(new CodanProblem(id, name), null);
+ CodanProblem p = new CodanProblem(id, name);
+ addProblem(p, null);
+ addRefProblem(checkerObj, p);
}
}
} catch (Exception e) {
@@ -183,7 +186,9 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
return elementValue;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#iterator()
*/
public Iterator<IChecker> iterator() {
@@ -196,15 +201,23 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse.cdt.codan.core.model.IChecker)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#addChecker(org.eclipse
+ * .cdt.codan.core.model.IChecker)
*/
public void addChecker(IChecker checker) {
checkers.add(checker);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse.cdt.codan.core.model.IProblem, java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#addProblem(org.eclipse
+ * .cdt.codan.core.model.IProblem, java.lang.String)
*/
public void addProblem(IProblem p, String category) {
IProblemCategory cat = getDefaultProfile().findCategory(category);
@@ -213,8 +226,12 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
((ProblemProfile) getDefaultProfile()).addProblem(p, cat);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse.cdt.codan.core.model.IProblemCategory, java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#addCategory(org.eclipse
+ * .cdt.codan.core.model.IProblemCategory, java.lang.String)
*/
public void addCategory(IProblemCategory p, String category) {
IProblemCategory cat = getDefaultProfile().findCategory(category);
@@ -223,21 +240,46 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
((ProblemProfile) getDefaultProfile()).addCategory(p, cat);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#addRefProblem(org.eclipse.cdt.codan.core.model.IChecker, org.eclipse.cdt.codan.core.model.IProblem)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#addRefProblem(org.
+ * eclipse.cdt.codan.core.model.IChecker,
+ * org.eclipse.cdt.codan.core.model.IProblem)
*/
public void addRefProblem(IChecker c, IProblem p) {
+ Collection<IProblem> plist = problemList.get(c);
+ if (plist == null) {
+ plist = new ArrayList<IProblem>();
+ problemList.put(c, plist);
+ }
+ plist.add(p);
+ }
+
+ /**
+ * Returns list of problems registered for given checker
+ * @return collection of problems or null
+ */
+ public Collection<IProblem> getRefProblems(IChecker checker) {
+ return problemList.get(checker);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#getDefaultProfile()
*/
public IProblemProfile getDefaultProfile() {
return profiles.get(DEFAULT);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#getWorkspaceProfile()
*/
public IProblemProfile getWorkspaceProfile() {
IProblemProfile wp = profiles.get(ResourcesPlugin.getWorkspace());
@@ -261,8 +303,12 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
profiles.put(element, profile);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile(org.eclipse.core.resources.IResource)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfile
+ * (org.eclipse.core.resources.IResource)
*/
public IProblemProfile getResourceProfile(IResource element) {
IProblemProfile prof = profiles.get(element);
@@ -295,8 +341,11 @@ public class CheckersRegisry implements Iterable<IChecker>, ICheckersRegistry {
return prof;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.codan.core.model.ICheckersRegistry#getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.cdt.codan.core.model.ICheckersRegistry#
+ * getResourceProfileWorkingCopy(org.eclipse.core.resources.IResource)
*/
public IProblemProfile getResourceProfileWorkingCopy(IResource element) {
if (element instanceof IProject) {
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java
index 7d5835157f3..56916b857dc 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/CodanBuilder.java
@@ -12,6 +12,8 @@ package org.eclipse.cdt.codan.internal.core;
import java.io.File;
import java.net.URI;
+import java.util.Collection;
+import java.util.Iterator;
import java.util.Map;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
@@ -20,6 +22,8 @@ import org.eclipse.cdt.codan.core.model.ICAstChecker;
import org.eclipse.cdt.codan.core.model.IChecker;
import org.eclipse.cdt.codan.core.model.ICodanAstReconciler;
import org.eclipse.cdt.codan.core.model.ICodanBuilder;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemProfile;
import org.eclipse.cdt.codan.core.model.IProblemReporter;
import org.eclipse.cdt.codan.internal.core.model.CodanMarkerProblemReporter;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@@ -122,6 +126,8 @@ public class CodanBuilder extends IncrementalProjectBuilder implements
boolean run = false;
if (checker.enabledInContext(resource))
run = true;
+ if (areProblemsForCheckerEnabled(checker, resource))
+ run = true;
if (run)
checker.processResource(resource);
} catch (Throwable e) {
@@ -161,6 +167,9 @@ public class CodanBuilder extends IncrementalProjectBuilder implements
boolean run = false;
if (checker.enabledInContext(resource))
run = true;
+ if (areProblemsForCheckerEnabled(checker, resource)) {
+ run = true;
+ }
if (run && checker instanceof ICAstChecker
&& checker.runInEditor())
((ICAstChecker) checker).processAst(ast);
@@ -171,6 +180,30 @@ public class CodanBuilder extends IncrementalProjectBuilder implements
}
}
+ /**
+ * @param checker
+ * @param resource
+ * @return
+ */
+ private boolean areProblemsForCheckerEnabled(IChecker checker,
+ IResource resource) {
+ IProblemProfile resourceProfile = CheckersRegisry.getInstance()
+ .getResourceProfile(resource);
+ Collection<IProblem> refProblems = CheckersRegisry.getInstance()
+ .getRefProblems(checker);
+ for (Iterator iterator = refProblems.iterator(); iterator.hasNext();) {
+ IProblem p = (IProblem) iterator.next();
+ // we need to check problem enablement in particular profile
+ IProblem problem = resourceProfile.findProblem(p.getId());
+ if (problem == null)
+ throw new IllegalArgumentException("Id is not registered");
+ if (problem.isEnabled())
+ return true;
+ }
+ // no problem is enabled for this checker, skip the checker
+ return false;
+ }
+
protected void fullBuild(final IProgressMonitor monitor)
throws CoreException {
try {

Back to the top