Search in sources :

Example 1 with RuleLabelProvider

use of net.sourceforge.pmd.eclipse.ui.preferences.br.RuleLabelProvider in project pmd-eclipse-plugin by pmd.

the class RuleSetSelectionDialog method setupRuleTable.

private void setupRuleTable() {
    Table tbl = ruleTable.getTable();
    tbl.setLinesVisible(true);
    tbl.setHeaderVisible(true);
    ruleTable.setContentProvider(new IStructuredContentProvider() {

        public Object[] getElements(Object inputElement) {
            RuleSet rs = selectedRuleset();
            return rs == null ? new Object[0] : rs.getRules().toArray();
        }

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }
    });
    ruleTable.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            ruleChecked();
        }
    });
    createCheckBoxColumn(tbl);
    for (int i = 0; i < columns.length; i++) {
        columns[i].newTableColumnFor(tbl, i + 1, null, null);
    }
    ruleTable.setLabelProvider(new RuleLabelProvider(columns));
}
Also used : RuleSet(net.sourceforge.pmd.RuleSet) Table(org.eclipse.swt.widgets.Table) RuleLabelProvider(net.sourceforge.pmd.eclipse.ui.preferences.br.RuleLabelProvider) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) Viewer(org.eclipse.jface.viewers.Viewer) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent)

Aggregations

RuleSet (net.sourceforge.pmd.RuleSet)1 RuleLabelProvider (net.sourceforge.pmd.eclipse.ui.preferences.br.RuleLabelProvider)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTableViewer (org.eclipse.jface.viewers.CheckboxTableViewer)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)1 Viewer (org.eclipse.jface.viewers.Viewer)1 Table (org.eclipse.swt.widgets.Table)1