use of net.sourceforge.pmd.RulePriority in project Gargoyle by callakrsos.
the class PMDListCell method updateItem.
// public PMDListCell(StringConverter<RuleViolation> stringConverter) {
// this();
// this.defaultStringConverter = stringConverter;
// }
/* (non-Javadoc)
* @see javafx.scene.control.Cell#updateItem(java.lang.Object, boolean)
*/
@Override
protected void updateItem(RuleViolation item, boolean empty) {
super.updateItem(item, empty);
setText("");
if (empty) {
setGraphic(null);
} else {
VBox vBox = new VBox();
HBox hBox = new HBox(5);
Text index = new Text();
TextFlow lineExp = new TextFlow();
Text line = new Text();
Text priority = new Text();
Text fileName = new Text();
Text methodName = new Text();
Text title = new Text();
Text message = new Text();
Text text = new Text("Index :");
text.setStyle("-fx-font-weight:bold;");
lineExp.getChildren().addAll(text, new Text(String.valueOf(getIndex())));
RulePriority prior = item.getRule().getPriority();
hBox.setStyle("-fx-background-color:transparent");
index.setStyle("-fx-fill:black;");
line.setStyle("-fx-fill:black;");
hBox.getChildren().addAll(lineExp, line, vBox);
vBox.getChildren().addAll(priority, fileName, methodName, title, message);
int priorityLevel = prior.getPriority();
priority.setStyle(getPriorityStyle(prior));
priority.setText(String.format("위험도 레벨 : [%d] - %s ", priorityLevel, prior.getName()));
fileName.setText(String.format("파일위치명 : %s", item.getFilename()));
methodName.setText(String.format("메소드명 : %s", item.getMethodName()));
// message.setStyle("-fx-font-style:italic;-fx-font-smoothing-type: lcd;");
title.setText(String.format("룰셋명 : %s 위반사항이름 : %s", item.getRule().getRuleSetName(), item.getRule().getName()));
message.setText(String.format("관련 메세지 : %s", /*item.getRule().getMessage()*/
item.getDescription()));
// item.getRule().
// message.setFont(Font.font(default1.getFamily(), FontWeight.BOLD, default1.getSize()));
line.setText(String.format("Line : %d", item.getBeginLine()));
setGraphic(hBox);
}
}
use of net.sourceforge.pmd.RulePriority in project pmd-eclipse-plugin by pmd.
the class UISettings method createRuleMarkerIcons.
public static void createRuleMarkerIcons(Display display) {
ImageLoader loader = new ImageLoader();
PriorityDescriptorCache pdc = PriorityDescriptorCache.INSTANCE;
for (RulePriority priority : currentPriorities(true)) {
Image image = pdc.descriptorFor(priority).getImage(display, MAX_MARKER_DIMENSION);
loader.data = new ImageData[] { image.getImageData() };
String fullPath = markerFilenameFor(priority);
PMDPlugin.getDefault().logInformation("Writing marker icon to: " + fullPath);
loader.save(fullPath, SWT.IMAGE_PNG);
image.dispose();
}
}
use of net.sourceforge.pmd.RulePriority in project pmd-eclipse-plugin by pmd.
the class RulePanelManager method buildPriorityCombo.
private Combo buildPriorityCombo(Composite parent) {
final Combo combo = new Combo(parent, SWT.READ_ONLY | SWT.BORDER);
// combo.setEditable(false);
final RulePriority[] priorities = RulePriority.values();
for (RulePriority rulePriority : priorities) {
combo.add(UISettings.labelFor(rulePriority));
}
if (rules != null) {
RulePriority priority = RuleUtil.commonPriority(rules);
int index = priority == null ? -1 : priority.getPriority() - 1;
combo.select(index);
}
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setPriority(priorities[combo.getSelectionIndex()]);
validateRuleParams();
}
});
combo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
return combo;
}
use of net.sourceforge.pmd.RulePriority in project pmd-eclipse-plugin by pmd.
the class RulePanelManager method buildPriorityControls.
private void buildPriorityControls(Composite parent) {
Label priorityLabel = buildLabel(parent, StringKeys.PREF_RULEEDIT_LABEL_PRIORITY);
GridData data = new GridData();
data.horizontalSpan = 1;
priorityLabel.setLayoutData(data);
priorityCombo = buildPriorityCombo(parent);
priorityDisplay = new ShapePicker(parent, SWT.NONE, 14);
priorityDisplay.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 4, 1));
priorityDisplay.setShapeMap(UISettings.shapesByPriority());
priorityDisplay.tooltipProvider(new LabelProvider() {
public String labelFor(Object item) {
return UISettings.labelFor((RulePriority) item);
}
});
priorityDisplay.setSize(120, 25);
}
use of net.sourceforge.pmd.RulePriority 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());
}
}
Aggregations