mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 12:45:41 +02:00
Bug 345614 - restore default button in codan preferences
This commit is contained in:
parent
ce2c732090
commit
2b1951b4cd
1 changed files with 4 additions and 1 deletions
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.codan.internal.ui.preferences;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.codan.core.CodanRuntime;
|
||||||
import org.eclipse.cdt.codan.core.PreferenceConstants;
|
import org.eclipse.cdt.codan.core.PreferenceConstants;
|
||||||
import org.eclipse.cdt.codan.core.model.CodanSeverity;
|
import org.eclipse.cdt.codan.core.model.CodanSeverity;
|
||||||
import org.eclipse.cdt.codan.core.model.IProblem;
|
import org.eclipse.cdt.codan.core.model.IProblem;
|
||||||
|
@ -332,16 +333,18 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
|
||||||
@Override
|
@Override
|
||||||
protected void doLoadDefault() {
|
protected void doLoadDefault() {
|
||||||
if (getTreeControl() != null) {
|
if (getTreeControl() != null) {
|
||||||
|
CodanPreferencesLoader defaultPreferences = new CodanPreferencesLoader(CodanRuntime.getInstance().getCheckersRegistry().getDefaultProfile());
|
||||||
IProblem[] probs = codanPreferencesLoader.getProblems();
|
IProblem[] probs = codanPreferencesLoader.getProblems();
|
||||||
for (int i = 0; i < probs.length; i++) {
|
for (int i = 0; i < probs.length; i++) {
|
||||||
String id = probs[i].getId();
|
String id = probs[i].getId();
|
||||||
String s = getPreferenceStore().getDefaultString(id);
|
String s = getPreferenceStore().getDefaultString(id);
|
||||||
if (s == null || s.length() == 0) {
|
if (s == null || s.length() == 0) {
|
||||||
s = codanPreferencesLoader.getProperty(id);
|
s = defaultPreferences.getProperty(id);
|
||||||
}
|
}
|
||||||
codanPreferencesLoader.setProperty(id, s);
|
codanPreferencesLoader.setProperty(id, s);
|
||||||
}
|
}
|
||||||
getViewer().setInput(codanPreferencesLoader.getInput());
|
getViewer().setInput(codanPreferencesLoader.getInput());
|
||||||
|
setPresentsDefaultValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue