Package com.intellij.openapi.fileTypes

Examples of com.intellij.openapi.fileTypes.SyntaxHighlighter


    public TextContentType getContentType() {
        return userValueHolder.getContentType();
    }

    public void setContentType(TextContentType contentType) {
        SyntaxHighlighter syntaxHighlighter = SyntaxHighlighter.PROVIDER.create(contentType.getFileType(), userValueHolder.getProject(), null);
        EditorColorsScheme colorsScheme = editor.getColorsScheme();
        editor.setHighlighter(HighlighterFactory.createHighlighter(syntaxHighlighter, colorsScheme));
        userValueHolder.setContentType(contentType);

    }
View Full Code Here


        } else {
          Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
          if(language != null) type = language.getAssociatedFileType();
            if(type == null) type = StdFileTypes.HTML;
        }
        SyntaxHighlighter outerHighlighter = SyntaxHighlighter.PROVIDER.create(type, project, virtualFile);

        registerLayer(LatteTokenTypes.HTML_TEXT, new LayerDescriptor(outerHighlighter, ""));
    }
View Full Code Here

        document = DocumentUtil.getDocument(selectStatementFile);
        document.createGuardedBlock(0, conditionStartOffset);
        editor = (EditorEx) EditorFactory.getInstance().createEditor(document, project);
        editor.setEmbeddedIntoDialogWrapper(true);

        SyntaxHighlighter syntaxHighlighter = dataset.getLanguageDialect(SQLLanguage.INSTANCE).getSyntaxHighlighter();
        editor.setHighlighter(HighlighterFactory.createHighlighter(syntaxHighlighter, editor.getColorsScheme()));
        editor.getCaretModel().moveToOffset(conditionStartOffset);
        if (!isValidCondition) editor.getSelectionModel().setSelection(conditionStartOffset, document.getTextLength());

        JScrollPane editorScrollPane = editor.getScrollPane();
View Full Code Here

            previewDocument = DocumentUtil.getDocument(selectStatementFile);

            viewer = (EditorEx) EditorFactory.getInstance().createViewer(previewDocument, project);
            viewer.setEmbeddedIntoDialogWrapper(true);
            JScrollPane viewerScrollPane = viewer.getScrollPane();
            SyntaxHighlighter syntaxHighlighter = connectionHandler.getLanguageDialect(SQLLanguage.INSTANCE).getSyntaxHighlighter();
            EditorColorsScheme colorsScheme = viewer.getColorsScheme();
            viewer.setHighlighter(HighlighterFactory.createHighlighter(syntaxHighlighter, colorsScheme));
            viewer.setBackgroundColor(colorsScheme.getColor(ColorKey.find("CARET_ROW_COLOR")));
            viewerScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
            viewerScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
View Full Code Here

                previewDocument = DocumentUtil.getDocument(selectStatementFile);

                viewer = (EditorEx) EditorFactory.getInstance().createViewer(previewDocument, dataset.getProject());
                viewer.setEmbeddedIntoDialogWrapper(true);
                JScrollPane viewerScrollPane = viewer.getScrollPane();
                SyntaxHighlighter syntaxHighlighter = dataset.getLanguageDialect(SQLLanguage.INSTANCE).getSyntaxHighlighter();
                EditorColorsScheme colorsScheme = viewer.getColorsScheme();
                viewer.setHighlighter(HighlighterFactory.createHighlighter(syntaxHighlighter, colorsScheme));
                viewer.setBackgroundColor(colorsScheme.getColor(ColorKey.find("CARET_ROW_COLOR")));
                viewerScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
                viewerScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
View Full Code Here

        return;
      }
      updatePending = true;
    }

    SyntaxHighlighter hl = SyntaxHighlighterFactory.getSyntaxHighlighter(file.getLanguage(), project, file.getVirtualFile());

    nextBuffer = activeBuffer == 0 ? 1 : 0;

    runner.add(new RenderTask(minimaps[nextBuffer], editor.getDocument().getText(), editor.getColorsScheme(), hl, editor.getFoldingModel().getAllFoldRegions(), new Runnable() {
      @Override public void run() {
View Full Code Here

  }

  @Nullable
  @Override
  public Lexer getHighlightingLexer() {
    SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(DartFileType.INSTANCE, null, null);
    return syntaxHighlighter != null ? syntaxHighlighter.getHighlightingLexer() : null;
  }
View Full Code Here

    else {
      Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
      if (language != null) type = language.getAssociatedFileType();
      if (type == null) type = HbLanguage.getDefaultTemplateLang();
    }
    @SuppressWarnings("deprecation") // deprecated in IDEA 12, still needed in IDEA 11 TODO remove when IDEA 11 support is dropped
      SyntaxHighlighter outerHighlighter = SyntaxHighlighter.PROVIDER.create(type, project, virtualFile);

    registerLayer(HbTokenTypes.CONTENT, new LayerDescriptor(outerHighlighter, ""));
  }
View Full Code Here

        return ColorDescriptor.EMPTY_ARRAY;
    }

    @NotNull
    public SyntaxHighlighter getHighlighter() {
        final SyntaxHighlighter highlighter =
            SyntaxHighlighterFactory.getSyntaxHighlighter(
                GoFileType.INSTANCE, null, null);

        assert highlighter != null;
        return highlighter;
View Full Code Here

  public TextChunk[] extractChunks() {
    final int lineStartOffset = myDocument.getLineStartOffset(myLineNumber);
    final int lineEndOffset = lineStartOffset < myDocument.getTextLength() ? myDocument.getLineEndOffset(myLineNumber):0;
    final FileType fileType = myElement.getContainingFile().getFileType();
    SyntaxHighlighter highlighter = fileType.getHighlighter(myElement.getProject(), myElement.getContainingFile().getVirtualFile());
    if (highlighter == null) {
      highlighter = new PlainSyntaxHighlighter();
    }
    return createTextChunks(myDocument.getCharsSequence(), highlighter, lineStartOffset, lineEndOffset);
  }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.fileTypes.SyntaxHighlighter

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.