Show error icon when selected rules have one or more problems

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7269 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Brian Remedios
2011-09-16 06:07:06 +00:00
parent 290cda42aa
commit 44c2477dca
3 changed files with 19 additions and 8 deletions

View File

@ -223,7 +223,7 @@ public abstract class AbstractTableManager<T extends Object> implements SortList
desc.defaultWidth() :
((Integer)widthData).intValue();
WidthChangeThread t = new WidthChangeThread(0, width, cwa);
t.run();
t.start();
}
protected void hide(ColumnDescriptor desc) {
@ -233,7 +233,7 @@ public abstract class AbstractTableManager<T extends Object> implements SortList
cwa.setData("restoredWidth", Integer.valueOf( cwa.width() ));
WidthChangeThread t = new WidthChangeThread(cwa.width(), 0, cwa);
t.run();
t.start();
}
protected boolean isHidden(ColumnDescriptor desc) {

View File

@ -23,6 +23,7 @@ import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
@ -52,6 +53,7 @@ public abstract class AbstractTreeTableManager <T extends Object> extends Abstra
private Button unSelectAllButton;
private ModifyListener modifyListener;
private Label activeCountLabel;
private Label activeCountIssue;
private ChangeRecord<T> changes;
@ -355,16 +357,24 @@ public abstract class AbstractTreeTableManager <T extends Object> extends Abstra
System.out.println("TODO: toggle selected items");
}
protected void buildActiveCountLabel(Composite parent) {
protected void buildActiveCountWidgets(Composite parent) {
activeCountLabel = new Label(parent, 0);
activeCountLabel.setText("---");
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER, GridData.CENTER, true, false, 1, 1);
activeCountLabel.setAlignment(SWT.RIGHT);
activeCountLabel.setLayoutData(data);
activeCountIssue = new Label(parent, 0);
data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER, GridData.CENTER, true, false, 1, 1);
activeCountIssue.setAlignment(SWT.RIGHT);
activeCountIssue.setLayoutData(data);
}
protected void activeCountText(String msg) {
protected void activeCountDetails(String msg, Image image) {
activeCountLabel.setText(msg);
activeCountIssue.setImage(image);
activeCountIssue.getParent().pack();
activeCountLabel.getParent().pack(); // handle changing string length
}

View File

@ -122,13 +122,14 @@ public interface RuleFieldAccessor {
if (sb.length() == 0) sb.append(ruleTypeGeneric[0]);
return sb.toString();
}
final int labelTypeIdx = 0; // just show the letter codes
public String labelFor(Rule rule) {
List<String> types = new ArrayList<String>(3);
if (rule.hasDescriptor(XPathRule.XPATH_DESCRIPTOR)) types.add(ruleTypeXPath[1]);
if (rule.hasDescriptor(XPathRule.XPATH_DESCRIPTOR)) types.add(ruleTypeXPath[labelTypeIdx]);
// if (if (RuleUtil.isXPathRule(rule)) TODO
if (rule.usesDFA()) types.add(ruleTypeDFlow[1]);
if (rule.usesTypeResolution()) types.add(ruleTypeTypeRes[1]);
if (types.isEmpty()) types.add(ruleTypeGeneric[1]);
if (rule.usesDFA()) types.add(ruleTypeDFlow[labelTypeIdx]);
if (rule.usesTypeResolution()) types.add(ruleTypeTypeRes[labelTypeIdx]);
if (types.isEmpty()) types.add(ruleTypeGeneric[labelTypeIdx]);
return Util.asString(types, ", ");
}
};