Search in sources :

Example 1 with ErrorInfo

use of com.intellij.designer.model.ErrorInfo in project intellij-community by JetBrains.

the class ComponentTree method getHighlightDisplayLevel.

@Nullable
private static HighlightDisplayLevel getHighlightDisplayLevel(Project project, RadComponent component) {
    HighlightDisplayLevel displayLevel = null;
    SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(project);
    for (ErrorInfo errorInfo : RadComponent.getError(component)) {
        if (displayLevel == null || severityRegistrar.compare(errorInfo.getLevel().getSeverity(), displayLevel.getSeverity()) > 0) {
            displayLevel = errorInfo.getLevel();
        }
    }
    return displayLevel;
}
Also used : HighlightDisplayLevel(com.intellij.codeHighlighting.HighlightDisplayLevel) ErrorInfo(com.intellij.designer.model.ErrorInfo) SeverityRegistrar(com.intellij.codeInsight.daemon.impl.SeverityRegistrar) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with ErrorInfo

use of com.intellij.designer.model.ErrorInfo in project intellij-community by JetBrains.

the class QuickFixManager method getErrorInfos.

@NotNull
@Override
protected List<ErrorInfo> getErrorInfos() {
    RadPropertyTable component = (RadPropertyTable) myComponent;
    int selectedRow = component.getSelectedRow();
    if (selectedRow < 0 || selectedRow >= component.getRowCount()) {
        return Collections.emptyList();
    }
    ErrorInfo errorInfo = component.getErrorInfoForRow(selectedRow);
    if (errorInfo != null) {
        return Arrays.asList(errorInfo);
    }
    return Collections.emptyList();
}
Also used : ErrorInfo(com.intellij.designer.model.ErrorInfo) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with ErrorInfo

use of com.intellij.designer.model.ErrorInfo in project intellij-community by JetBrains.

the class AbstractQuickFixManager method showHint.

private void showHint() {
    if (!myComponent.isShowing() || !IJSwingUtilities.hasFocus(myComponent)) {
        hideHint();
        return;
    }
    // 1. Hide previous hint (if any)
    hideHint();
    // 2. Found error (if any)
    List<ErrorInfo> infos = getErrorInfos();
    if (!ErrorInfo.haveFixes(infos)) {
        hideHint();
        return;
    }
    boolean error = false;
    for (ErrorInfo errorInfo : infos) {
        if (errorInfo.getLevel() == HighlightDisplayLevel.ERROR) {
            error = true;
            break;
        }
    }
    // 3. Determine position where this hint should be shown
    Rectangle bounds = getErrorBounds();
    if (bounds == null) {
        return;
    }
    // 4. Show light bulb to fix this error
    myHint = new LightweightHint(new InspectionHint(error ? AllIcons.Actions.QuickfixBulb : AllIcons.Actions.IntentionBulb));
    myLastHintBounds = bounds;
    myHint.show(myComponent, bounds.x - AllIcons.Actions.IntentionBulb.getIconWidth() - 4, bounds.y, myComponent, new HintHint(myComponent, bounds.getLocation()));
}
Also used : HintHint(com.intellij.ui.HintHint) ErrorInfo(com.intellij.designer.model.ErrorInfo) LightweightHint(com.intellij.ui.LightweightHint)

Example 4 with ErrorInfo

use of com.intellij.designer.model.ErrorInfo in project intellij-community by JetBrains.

the class AbstractQuickFixManager method showPopup.

private void showPopup() {
    if (myHint == null || !myHint.isVisible()) {
        return;
    }
    List<ErrorInfo> errorInfos = getErrorInfos();
    if (!ErrorInfo.haveFixes(errorInfos)) {
        return;
    }
    ListPopup popup = JBPopupFactory.getInstance().createListPopup(new FirstStep(errorInfos));
    popup.showUnderneathOf(myHint.getComponent());
}
Also used : ErrorInfo(com.intellij.designer.model.ErrorInfo) ListPopup(com.intellij.openapi.ui.popup.ListPopup)

Aggregations

ErrorInfo (com.intellij.designer.model.ErrorInfo)4 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)1 SeverityRegistrar (com.intellij.codeInsight.daemon.impl.SeverityRegistrar)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 HintHint (com.intellij.ui.HintHint)1 LightweightHint (com.intellij.ui.LightweightHint)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1