[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] Problem Enabling/Disabling Codan checkers programmatically (Bug?)
|
Hi,
We are working on a plugin which creates a C project for ARM
processors and would like to avoid users having to delve into
preferences. So we have used the following code to modify default code
analysis preferences:
/************** enable/disable code analysis checkers that we need or
don't need... ****************************************/
IEclipsePreferences codanp =
CodanCorePlugin.getDefault().getStorePreferences();
// get pproblem checker keys
String[] keys = null;
try {
keys = codanp.keys();
} catch (org.osgi.service.prefs.BackingStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// first disable all problem checkers...
for (int i=0; i<keys.length; i++) {
String res = codanp.get(keys[i], "");
if (!res.substring(0,1).equals("-")) {
res = "-"+res;
}
if (res.equals("-Error") || res.equals("-Warning") ||
res.equals("-Info")) {
codanp.put(keys[i], res);
}
}
// now enable the checkers we need with either warning or
error...
codanp.put("org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem",
"Warning");
codanp.put("org.eclipse.cdt.codan.checkers.noreturn", "Error");
codanp.put("org.eclipse.cdt.codan.checkers.errnoreturn",
"Error");
codanp.put("org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem",
"Warning");
codanp.put("org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem",
"Warning");
codanp.put("org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem",
"Warning");
//...
**************************************************************************************************************************************/
This worked fine up until I tried it in a fresh workspace, in which case
the instruction:
IEclipsePreferences codanp =
CodanCorePlugin.getDefault().getStorePreferences();
returns a value which provides no keys.
In order to get it to work I must go into code analysis preferences and
click on the "Apply" or "Ok" button.
Is this a bug or have I forgotten something? Is there a work around to
get it to work in a new workspace?
Thanks in advance,
Regards,
Antony