1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

On behalf of Alex Ruiz.

This commit is contained in:
Sergey Prigogin 2011-02-23 00:09:54 +00:00
parent 9684ae54d1
commit 3974422239
5 changed files with 13 additions and 99 deletions

View file

@ -168,56 +168,6 @@ where xxx what checker would post as an argument for the problem.
</appinfo>
</annotation>
</attribute>
<attribute name="exampleParam0" type="string">
<annotation>
<documentation>
Example parameter for &apos;messagePattern&apos; (with position 0.) This value is used only in the &quot;Code Analysis&quot; Preference UI to provide some context to the message shown for a particular problem.
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="exampleParam1" type="string">
<annotation>
<documentation>
Example parameter for &apos;messagePattern&apos; (with position 1.) This value is used only in the &quot;Code Analysis&quot; Preference UI to provide some context to the message shown for a particular problem.
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="exampleParam2" type="string">
<annotation>
<documentation>
Example parameter for &apos;messagePattern&apos; (with position 2.) This value is used only in the &quot;Code Analysis&quot; Preference UI to provide some context to the message shown for a particular problem.
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="exampleParam3" type="string">
<annotation>
<documentation>
Example parameter for &apos;messagePattern&apos; (with position 3.) This value is used only in the &quot;Code Analysis&quot; Preference UI to provide some context to the message shown for a particular problem.
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="exampleParam4" type="string">
<annotation>
<documentation>
Example parameter for &apos;messagePattern&apos; (with position 4.) This value is used only in the &quot;Code Analysis&quot; Preference UI to provide some context to the message shown for a particular problem.
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="description" type="string">
<annotation>
<documentation>

View file

@ -68,15 +68,6 @@ public interface IProblem extends IProblemElement {
*/
String getMessagePattern();
/**
* Returns the example parameters to use with {@link #getMessagePattern()}.
* These parameters are used only in the "Code Analysis" Preference UI.
*
* @return example parameters
* @since 2.0
*/
public String[] getExampleMessageParameters();
/**
* Returns root preference descriptor or null if not defined (used by UI to
* generate user controls for changing parameters)

View file

@ -193,13 +193,6 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
String enab = getAtt(configurationElement, "defaultEnabled", false); //$NON-NLS-1$
String sev = getAtt(configurationElement, "defaultSeverity", false); //$NON-NLS-1$
String patt = getAtt(configurationElement, "messagePattern", false); //$NON-NLS-1$
ArrayList<String> exampleParams = new ArrayList<String>();
for (int i = 0; ; i++) {
String param = configurationElement.getAttribute("exampleParam" + i); //$NON-NLS-1$
if (param == null)
break;
exampleParams.add(param);
}
String desc = getAtt(configurationElement, "description", false); //$NON-NLS-1$
String markerType = getAtt(configurationElement, "markerType", false); //$NON-NLS-1$
if (enab != null) {
@ -213,9 +206,6 @@ public class CheckersRegistry implements Iterable<IChecker>, ICheckersRegistry {
if (patt != null) {
p.setMessagePattern(patt);
}
if (!exampleParams.isEmpty()) {
p.setExampleMessageParameters(exampleParams.toArray(new String[exampleParams.size()]));
}
if (markerType != null) {
p.setMarkerType(markerType);
}

View file

@ -29,7 +29,6 @@ public class CodanProblem implements IProblemWorkingCopy, Cloneable {
private boolean frozen;
private String description;
private String markerType = IProblemReporter.GENERIC_CODE_ANALYSIS_MARKER_TYPE;
private String[] exampleParams = { "X", "Y", "Z", "U", "V" }; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
public CodanSeverity getSeverity() {
return severity;
@ -163,25 +162,4 @@ public class CodanProblem implements IProblemWorkingCopy, Cloneable {
public void setMarkerType(String markerType) {
this.markerType = markerType;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.codan.core.model.IProblem#getExampleParameters()
*/
public String[] getExampleMessageParameters() {
return exampleParams.clone();
}
/**
* Sets an example message parameter to use with {@link #getMessagePattern()}.
*
* @param exampleParameters - the example message parameters to set,
* e.g. { "&lt;variable_name&gt;" }.
* @see #getExampleMessageParameters()
*/
public void setExampleMessageParameters(String[] exampleParameters) {
checkSet();
this.exampleParams = exampleParameters;
}
}

View file

@ -55,6 +55,9 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
* preferences can be accessed directly via the preference store.
*/
public class CodanPreferencePage extends FieldEditorOverlayPage implements IWorkbenchPreferencePage {
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final String SINGLE_PLACEHOLDER_ONLY = "{0}"; //$NON-NLS-1$
private IProblemProfile profile;
private ISelectionChangedListener problemSelectionListener;
private IProblem selectedProblem;
@ -208,7 +211,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
private void saveWidgetValues() {
CodanUIActivator.getDefault().getDialogSettings().put(getWidgetId(),
selectedProblem == null ? "" : selectedProblem.getId()); //$NON-NLS-1$
selectedProblem == null ? EMPTY_STRING : selectedProblem.getId());
}
private void restoreWidgetValues() {
@ -230,21 +233,23 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements IWork
private void updateProblemInfo() {
if (selectedProblem == null) {
infoMessage.setText(""); //$NON-NLS-1$
infoDesc.setText(""); //$NON-NLS-1$
infoMessage.setText(EMPTY_STRING);
infoDesc.setText(EMPTY_STRING);
// infoParams.setText(""); //$NON-NLS-1$
infoButton.setEnabled(false);
} else {
String description = selectedProblem.getDescription();
if (description == null)
description = CodanUIMessages.CodanPreferencePage_NoInfo;
String messageToShow = CodanUIMessages.CodanPreferencePage_NoInfo;
String messagePattern = selectedProblem.getMessagePattern();
if (messagePattern != null) {
Object[] exampleParams = selectedProblem.getExampleMessageParameters();
messageToShow = MessageFormat.format(messagePattern, exampleParams);
String message = CodanUIMessages.CodanPreferencePage_NoInfo;
if (SINGLE_PLACEHOLDER_ONLY.equals(messagePattern)) {
message = EMPTY_STRING;
}
infoMessage.setText(messageToShow);
else if (messagePattern != null) {
message = MessageFormat.format(messagePattern, "X", "Y", "Z"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
infoMessage.setText(message);
infoDesc.setText(description);
// IProblemPreference pref = selectedProblem.getPreference();
// infoParams.setText(pref == null ?