Search in sources :

Example 11 with RulePriority

use of net.sourceforge.pmd.RulePriority in project pmd-eclipse-plugin by pmd.

the class GeneralPreferencesPage method selectedPriorities.

private static void selectedPriorities(List<RulePriority> items, ShapePicker<Shape> ssc, ColorSelector colorPicker, Text nameField) {
    if (items.size() != 1) {
        ssc.setSelection((Shape) null);
        nameField.setText("");
        return;
    }
    RulePriority priority = items.get(0);
    PriorityDescriptor desc = PriorityDescriptorCache.INSTANCE.descriptorFor(priority);
    ssc.setSelection(desc.shape.shape);
    nameField.setText(desc.label);
    colorPicker.setColorValue(desc.shape.rgbColor);
}
Also used : PriorityDescriptor(net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor) RulePriority(net.sourceforge.pmd.RulePriority)

Example 12 with RulePriority

use of net.sourceforge.pmd.RulePriority in project pmd-eclipse-plugin by pmd.

the class PriorityDescriptorCache method storeInPreferences.

public void storeInPreferences() {
    IPreferencesManager mgr = preferencesManager();
    IPreferences prefs = mgr.loadPreferences();
    for (Map.Entry<RulePriority, PriorityDescriptor> entry : uiDescriptorsByPriority.entrySet()) {
        prefs.setPriorityDescriptor(entry.getKey(), entry.getValue());
    }
    mgr.storePreferences(prefs);
}
Also used : IPreferencesManager(net.sourceforge.pmd.eclipse.runtime.preferences.IPreferencesManager) IPreferences(net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences) RulePriority(net.sourceforge.pmd.RulePriority) Map(java.util.Map) HashMap(java.util.HashMap)

Example 13 with RulePriority

use of net.sourceforge.pmd.RulePriority in project pmd-eclipse-plugin by pmd.

the class PriorityDescriptorCache method hasChanges.

public boolean hasChanges() {
    IPreferences preferences = preferencesManager().reloadPreferences();
    for (RulePriority rp : UISettings.currentPriorities(true)) {
        PriorityDescriptor newOne = uiDescriptorsByPriority.get(rp);
        PriorityDescriptor currentOne = preferences.getPriorityDescriptor(rp);
        if (newOne.equals(currentOne)) {
            continue;
        }
        return true;
    }
    return false;
}
Also used : IPreferences(net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences) RulePriority(net.sourceforge.pmd.RulePriority)

Aggregations

RulePriority (net.sourceforge.pmd.RulePriority)13 HashMap (java.util.HashMap)5 Map (java.util.Map)4 PriorityDescriptor (net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor)3 IPreferences (net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences)2 PriorityFilterAction (net.sourceforge.pmd.eclipse.ui.views.actions.PriorityFilterAction)2 GridData (org.eclipse.swt.layout.GridData)2 VBox (javafx.scene.layout.VBox)1 Text (javafx.scene.text.Text)1 TextFlow (javafx.scene.text.TextFlow)1 HBox (jfxtras.scene.layout.HBox)1 Rule (net.sourceforge.pmd.Rule)1 IPreferencesManager (net.sourceforge.pmd.eclipse.runtime.preferences.IPreferencesManager)1 LabelProvider (net.sourceforge.pmd.eclipse.ui.LabelProvider)1 ShapePicker (net.sourceforge.pmd.eclipse.ui.ShapePicker)1 PriorityDescriptorCache (net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptorCache)1 DisableRuleAction (net.sourceforge.pmd.eclipse.ui.views.actions.DisableRuleAction)1 QuickFixAction (net.sourceforge.pmd.eclipse.ui.views.actions.QuickFixAction)1 RemoveViolationAction (net.sourceforge.pmd.eclipse.ui.views.actions.RemoveViolationAction)1 ReviewAction (net.sourceforge.pmd.eclipse.ui.views.actions.ReviewAction)1