Search in sources :

Example 1 with RulePriority

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);
    }
}
Also used : HBox(jfxtras.scene.layout.HBox) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow) RulePriority(net.sourceforge.pmd.RulePriority) VBox(javafx.scene.layout.VBox)

Example 2 with RulePriority

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();
    }
}
Also used : PriorityDescriptorCache(net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptorCache) RulePriority(net.sourceforge.pmd.RulePriority) ImageLoader(org.eclipse.swt.graphics.ImageLoader) Image(org.eclipse.swt.graphics.Image)

Example 3 with RulePriority

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;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) Combo(org.eclipse.swt.widgets.Combo) RulePriority(net.sourceforge.pmd.RulePriority)

Example 4 with RulePriority

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);
}
Also used : ShapePicker(net.sourceforge.pmd.eclipse.ui.ShapePicker) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) RulePriority(net.sourceforge.pmd.RulePriority) LabelProvider(net.sourceforge.pmd.eclipse.ui.LabelProvider)

Example 5 with RulePriority

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());
    }
}
Also used : PriorityDescriptor(net.sourceforge.pmd.eclipse.ui.priority.PriorityDescriptor) RulePriority(net.sourceforge.pmd.RulePriority) HashMap(java.util.HashMap) Map(java.util.Map)

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