Java 类com.intellij.openapi.fileTypes.PlainSyntaxHighlighter 实例源码

项目:intellij-ce-playground    文件:ChunkExtractor.java   
private ChunkExtractor(@NotNull PsiFile file) {
  myColorsScheme = UsageTreeColorsScheme.getInstance().getScheme();

  Project project = file.getProject();
  myDocument = PsiDocumentManager.getInstance(project).getDocument(file);
  LOG.assertTrue(myDocument != null);
  final FileType fileType = file.getFileType();
  SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, file.getVirtualFile());
  highlighter = highlighter == null ? new PlainSyntaxHighlighter() : highlighter;
  myHighlighter = new SyntaxHighlighterOverEditorHighlighter(highlighter, file.getVirtualFile(), project);
  myDocumentStamp = -1;
}
项目:js-graphql-intellij-plugin    文件:JSGraphQLSyntaxHighlighterFactory.java   
@NotNull
@Override
public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile) {
    final boolean schema = virtualFile != null && virtualFile.getFileType() == JSGraphQLSchemaFileType.INSTANCE;
    if(project == null) {
        Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
        if(openProjects.length > 0) {
            project = openProjects[0];
        } else {
            // can't syntax highlight GraphQL without a project to associate the language service instance to
            return new PlainSyntaxHighlighter();
        }
    }
    return new JSGraphQLSyntaxHighlighter(project, schema);
}
项目:tools-idea    文件:ChunkExtractor.java   
private ChunkExtractor(@NotNull PsiFile file) {
  myColorsScheme = UsageTreeColorsScheme.getInstance().getScheme();

  Project project = file.getProject();
  myDocument = PsiDocumentManager.getInstance(project).getDocument(file);
  LOG.assertTrue(myDocument != null);
  final FileType fileType = file.getFileType();
  final SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, file.getVirtualFile());
  myHighlighter = highlighter == null ? new PlainSyntaxHighlighter() : highlighter;
  myLexer = myHighlighter.getHighlightingLexer();
  myLexer.start(myDocument.getCharsSequence());
  myDocumentStamp = myDocument.getModificationStamp();
}
项目:consulo    文件:ChunkExtractor.java   
private ChunkExtractor(@Nonnull PsiFile file) {
  myColorsScheme = UsageTreeColorsScheme.getInstance().getScheme();

  Project project = file.getProject();
  myDocument = PsiDocumentManager.getInstance(project).getDocument(file);
  LOG.assertTrue(myDocument != null);
  final FileType fileType = file.getFileType();
  SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, file.getVirtualFile());
  highlighter = highlighter == null ? new PlainSyntaxHighlighter() : highlighter;
  myHighlighter = new SyntaxHighlighterOverEditorHighlighter(highlighter, file.getVirtualFile(), project);
  myDocumentStamp = -1;
}
项目:intellij-ce-playground    文件:LexerEditorHighlighter.java   
public boolean isPlain() {
  return myHighlighter instanceof PlainSyntaxHighlighter;
}
项目:intellij-ce-playground    文件:DebuggerColorsPage.java   
@NotNull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:intellij-ce-playground    文件:TemplateEditorUtil.java   
private static void setHighlighter(EditorEx editor, @Nullable SyntaxHighlighter highlighter) {
  EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  LayeredLexerEditorHighlighter layeredHighlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), editorColorsScheme);
  layeredHighlighter.registerLayer(TemplateTokenType.TEXT, new LayerDescriptor(ObjectUtils.notNull(highlighter, new PlainSyntaxHighlighter()), ""));
  editor.setHighlighter(layeredHighlighter);
}
项目:intellij-ce-playground    文件:DefaultLanguageColorsPage.java   
@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:intellij-ce-playground    文件:GeneralColorsPage.java   
@Override
@NotNull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:intellij-ce-playground    文件:ANSIColoredConsoleColorsPage.java   
@Override
@NotNull
public SyntaxHighlighter getHighlighter() {
   return new PlainSyntaxHighlighter();
}
项目:intellij-ce-playground    文件:AndroidLogcatColorPage.java   
@Override
@NotNull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:spoofax-intellij    文件:SpoofaxSyntaxHighlighterFactory.java   
/**
 * Gets the syntax highlighter for the specified project and file.
 *
 * @param project     The project.
 * @param virtualFile The file.
 * @return The syntax highlighter.
 */
@Override
public SyntaxHighlighter getSyntaxHighlighter(
        final Project project,
        final VirtualFile virtualFile) {

    @Nullable ILanguageImpl implementation = null;
    @Nullable final FileObject file = this.resourceService.resolve(virtualFile);

    if (file != null) {
        try {
            implementation = this.identifierService.identify(file);
        } catch (IllegalStateException ex) {
            // Multiple possible languages identified
            // (e.g. when different languages have the same extension,
            // such as TypeScript and TS both having .ts extension)
            // TODO: Better error message,
            // but to do that the exception needs to have its own class (derived from IllegalStateException)
            // that contains a list of languages.
            Notification notification = NotificationUtils.METABORG_NOTIFICATIONS.createNotification(ex.getMessage(), NotificationType.ERROR);
            NotificationUtils.INSTANCE.notify(project, notification);
            implementation = null;

        }
    }
    else if (virtualFile instanceof LightVirtualFile) {
        final com.intellij.lang.Language ideaLanguage = ((LightVirtualFile)virtualFile).getLanguage();
        if (ideaLanguage instanceof MetaborgIdeaLanguage) {
            final ILanguage language = this.languageManager.getLanguage((MetaborgIdeaLanguage)ideaLanguage);
            implementation = language.activeImpl();
        }
    }

    if (implementation == null){
        // We don't know the language, so
        // let's return the plain syntax highlighter instead.
        return new PlainSyntaxHighlighter();
    }

    @Nullable final IProject metaborgProject = null;  // FIXME: Get IProject from Project
    final SpoofaxTokenTypeManager tokenTypesManager =
            this.bindingManager.getTokenTypeManager(implementation.belongsTo());
    final Lexer lexer = this.highlightingLexerFactory
            .create(file, metaborgProject, implementation, tokenTypesManager);

    return new SpoofaxSyntaxHighlighter(lexer);
}
项目:material-theme-jetbrains    文件:MTFileColorsPage.java   
@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:tools-idea    文件:LexerEditorHighlighter.java   
public boolean isPlain() {
  return myHighlighter instanceof PlainSyntaxHighlighter;
}
项目:tools-idea    文件:DebuggerColorsPage.java   
@NotNull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:tools-idea    文件:DefaultLanguageColorsPage.java   
@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:tools-idea    文件:GeneralColorsPage.java   
@Override
@NotNull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:tools-idea    文件:ANSIColoredConsoleColorsPage.java   
@Override
@NotNull
public SyntaxHighlighter getHighlighter() {
   return new PlainSyntaxHighlighter();
}
项目:consulo-play    文件:PlayJavaColorSettingsPage.java   
@NotNull
@Override
public SyntaxHighlighter getHighlighter()
{
    return new PlainSyntaxHighlighter();
}
项目:consulo    文件:LexerEditorHighlighter.java   
public boolean isPlain() {
  return myHighlighter instanceof PlainSyntaxHighlighter;
}
项目:consulo    文件:DebuggerColorsPage.java   
@Override
@Nonnull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:consulo    文件:DefaultLanguageColorsPage.java   
@Nonnull
@Override
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:consulo    文件:GeneralColorsPage.java   
@Override
@Nonnull
public SyntaxHighlighter getHighlighter() {
  return new PlainSyntaxHighlighter();
}
项目:consulo    文件:ANSIColoredConsoleColorsPage.java   
@Override
@Nonnull
public SyntaxHighlighter getHighlighter() {
   return new PlainSyntaxHighlighter();
}