Package com.intellij.lang.annotation

Examples of com.intellij.lang.annotation.Annotation$QuickFixInfo


public class MathematicaHighlightingAnnotator extends MathematicaVisitor implements Annotator {
  private static final Set<String> NAMES = SymbolInformationProvider.getSymbolNames().keySet();
  private AnnotationHolder myHolder = null;

  private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
    final Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setTextAttributes(key);
    annotation.setNeedsUpdateOnTyping(false);
  }
View Full Code Here


    annotation.setTextAttributes(key);
    annotation.setNeedsUpdateOnTyping(false);
  }

  private static void setHighlightingStrict(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
    final Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
    annotation.setEnforcedTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key));
    annotation.setNeedsUpdateOnTyping(false);
  }
View Full Code Here

public class MathematicaReferenceAnnotator extends MathematicaVisitor implements Annotator {
  private static final Set<String> NAMES = SymbolInformationProvider.getSymbolNames().keySet();
  private AnnotationHolder myHolder = null;

  private static void setHighlighting(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
    final Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setTextAttributes(key);
    annotation.setNeedsUpdateOnTyping(false);
  }
View Full Code Here

    annotation.setTextAttributes(key);
    annotation.setNeedsUpdateOnTyping(false);
  }

  private static void setHighlightingStrict(@NotNull PsiElement element, @NotNull AnnotationHolder holder, @NotNull TextAttributesKey key) {
    final Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setEnforcedTextAttributes(TextAttributes.ERASE_MARKER);
    annotation.setEnforcedTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key));
    annotation.setNeedsUpdateOnTyping(false);
  }
View Full Code Here

                LineColRange lcRange = ghcMessage.getRange();
                TextRange range = lcRange.getRange(psiFile);
                String message = ghcMessage.getErrorMessage();
                CompilerMessageCategory category = ghcMessage.getCategory();

                Annotation out = null;
                switch (category) {
                case ERROR:
                    out = annotationHolder.createErrorAnnotation(range, message);
                    break;
                case WARNING:
                    out = annotationHolder.createWarningAnnotation(range, message);
                    break;
                case INFORMATION:
                    out = annotationHolder.createInfoAnnotation(range, message);
                    break;
                case STATISTICS:
                    break;
                }
                if (out != null) {
                    if (message.startsWith("Not in scope")) {
                        Module module = DeclarationPosition.getDeclModule(psiFile);
                        String symbol = psiFile.getText().substring(range.getStartOffset(), range.getEndOffset());
                        int dotIndex = symbol.lastIndexOf('.');
                        String unqualifiedSymbol = dotIndex >= 0 ? symbol.substring(dotIndex + 1) : symbol;
                        if (userImports == null) {
                            userImports = listUserImports(module, Paths.get(path));
                        }
                        List<String> imports = new ArrayList<String>();
                        ImportTrie importTrie = ImportTrie.get(module, path, getAllFiles(module));
                        addImports(imports, userImports, unqualifiedSymbol, importTrie);
                        addStandardImports(module, unqualifiedSymbol, imports, importTrie);
                        if (!imports.isEmpty()) {
                            out.registerFix(new AutoImportIntention(psiFile, range, imports.toArray(new String[imports.size()]), unqualifiedSymbol), range);
                        }
                    }
                    out.setTooltip(out.getTooltip().replaceAll("\\n", "<br/>").replaceAll("`(\\w+?)'", "<b>$1</b>"));
                }
            }
        }
    }
View Full Code Here

    }

    private void annotateToken(TokenPsiElement tokenPsiElement, AnnotationHolder holder) {
        TokenTypeCategory flavor = tokenPsiElement.getElementType().getFlavor();
        if (flavor != null) {
            Annotation annotation = holder.createInfoAnnotation(tokenPsiElement, null);
            switch (flavor) {
                case DATATYPE: annotation.setTextAttributes(SQLTextAttributesKeys.DATA_TYPE); break;
                case FUNCTION: annotation.setTextAttributes(SQLTextAttributesKeys.FUNCTION); break;
                case KEYWORD: annotation.setTextAttributes(SQLTextAttributesKeys.KEYWORD); break;
                case IDENTIFIER: annotation.setTextAttributes(SQLTextAttributesKeys.IDENTIFIER); break;
            }
        }
    }
View Full Code Here

        }
    }

    private void annotateIdentifier(IdentifierPsiElement identifierPsiElement, final AnnotationHolder holder) {
        if (identifierPsiElement.getLanguageDialect().isReservedWord(identifierPsiElement.getText())) {
            Annotation annotation = holder.createInfoAnnotation(identifierPsiElement, null);
            annotation.setTextAttributes(SQLTextAttributesKeys.IDENTIFIER);
        }
        if (identifierPsiElement.isObject()) {
            boolean ensureDataLoaded = DatabaseLoadMonitor.isEnsureDataLoaded();
            DatabaseLoadMonitor.setEnsureDataLoaded(false);
            try {
View Full Code Here

        }
    }

    private void annotateAliasRef(IdentifierPsiElement aliasReference, AnnotationHolder holder) {
        if (aliasReference.resolve() == null &&  aliasReference.getResolveTrialsCount() > 3) {
            Annotation annotation = holder.createWarningAnnotation(aliasReference, "Unknown identifier");
            annotation.setTextAttributes(SQLTextAttributesKeys.UNKNOWN_IDENTIFIER);
        } else {
            Annotation annotation = holder.createInfoAnnotation(aliasReference, null);
            annotation.setTextAttributes(SQLTextAttributesKeys.ALIAS);
        }
    }
View Full Code Here

    private void annotateObject(IdentifierPsiElement objectReference, AnnotationHolder holder) {
        if (!objectReference.isResolving() && !objectReference.isDefinition()) {
            PsiElement reference = objectReference.resolve();
            if (reference == null && checkConnection(objectReference)) {
                if (objectReference.getResolveTrialsCount() > 3) {
                    Annotation annotation = holder.createWarningAnnotation(objectReference.getNode(),
                            "Unknown identifier");
                    annotation.setTextAttributes(SQLTextAttributesKeys.UNKNOWN_IDENTIFIER);
                }
            }
        }
    }
View Full Code Here

    private void annotateExecutable(ExecutablePsiElement executablePsiElement, AnnotationHolder holder) {
        if (!executablePsiElement.isNestedExecutable()) {
            StatementExecutionProcessor executionProcessor = executablePsiElement.getExecutionProcessor();
            if (executionProcessor != null) {
                Annotation annotation = holder.createInfoAnnotation(executablePsiElement, null);
                annotation.setGutterIconRenderer(new StatementGutterRenderer(executionProcessor));
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.intellij.lang.annotation.Annotation$QuickFixInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.