use of net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor in project pmd-eclipse-plugin by pmd.
the class PreferencesManagerImpl method storePriorityDescriptors.
private void storePriorityDescriptors() {
for (Map.Entry<RulePriority, String> entry : STORE_KEYS_BY_PRIORITY.entrySet()) {
PriorityDescriptor desc = preferences.getPriorityDescriptor(entry.getKey());
storePreferencesStore.setValue(entry.getValue(), desc.storeString());
}
}
use of net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor in project pmd-eclipse-plugin by pmd.
the class PreferencesManagerImpl method loadRulePriorityDescriptors.
private void loadRulePriorityDescriptors() {
for (Map.Entry<RulePriority, String> entry : STORE_KEYS_BY_PRIORITY.entrySet()) {
PriorityDescriptor desc = defaultDescriptorFor(entry.getKey());
loadPreferencesStore.setDefault(entry.getValue(), desc.storeString());
String storeKey = STORE_KEYS_BY_PRIORITY.get(entry.getKey());
preferences.setPriorityDescriptor(entry.getKey(), PriorityDescriptor.from(loadPreferencesStore.getString(storeKey)));
}
}
use of net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor 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);
}
use of net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor in project pmd-eclipse-plugin by pmd.
the class PriorityFilterAction method setupActionLook.
/**
* Setup the Actions Look by giving the right Image, Text and ToolTip-Text to it, depending on its Priority
*/
private void setupActionLook() {
// ImageDescriptor image = null;
// String text = null;
// String tooltipText = null;
//
// // we set the Look - meaning Image, Text and ToolTip-Text -
// // depending on the Action's Priority
// switch (priority.intValue()) {
// case 1:
// image =
// PMDPlugin.getImageDescriptor(PMDUiConstants.ICON_BUTTON_PRIO1);
// text =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_FILTER_PRIORITY_1);
// tooltipText =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_TOOLTIP_FILTER_PRIORITY_1);
// break;
// case 2:
// image =
// PMDPlugin.getImageDescriptor(PMDUiConstants.ICON_BUTTON_PRIO2);
// text =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_FILTER_PRIORITY_2);
// tooltipText =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_TOOLTIP_FILTER_PRIORITY_2);
// break;
// case 3:
// image =
// PMDPlugin.getImageDescriptor(PMDUiConstants.ICON_BUTTON_PRIO3);
// text =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_FILTER_PRIORITY_3);
// tooltipText =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_TOOLTIP_FILTER_PRIORITY_3);
// break;
// case 4:
// image =
// PMDPlugin.getImageDescriptor(PMDUiConstants.ICON_BUTTON_PRIO4);
// text =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_FILTER_PRIORITY_4);
// tooltipText =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_TOOLTIP_FILTER_PRIORITY_4);
// break;
// case 5:
// image =
// PMDPlugin.getImageDescriptor(PMDUiConstants.ICON_BUTTON_PRIO5);
// text =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_FILTER_PRIORITY_5);
// tooltipText =
// AbstractPMDAction.getString(StringKeys.MSGKEY_VIEW_TOOLTIP_FILTER_PRIORITY_5);
// break;
// }
PriorityDescriptor desc = UISettings.descriptorFor(priority);
setImageDescriptor(ImageDescriptor.createFromImage(desc.getImage(Display.getCurrent())));
setText(desc.label);
String toolTip = String.format(desc.filterText, UISettings.labelFor(priority));
setToolTipText(toolTip);
}
Aggregations