當前位置: 首頁>>代碼示例>>Java>>正文


Java SyntaxHighlighter類代碼示例

本文整理匯總了Java中com.intellij.openapi.fileTypes.SyntaxHighlighter的典型用法代碼示例。如果您正苦於以下問題:Java SyntaxHighlighter類的具體用法?Java SyntaxHighlighter怎麽用?Java SyntaxHighlighter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SyntaxHighlighter類屬於com.intellij.openapi.fileTypes包,在下文中一共展示了SyntaxHighlighter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SoyLayeredHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public SoyLayeredHighlighter(
    @Nullable Project project,
    @Nullable VirtualFile virtualFile,
    @NotNull EditorColorsScheme colors) {
  // Creating main highlighter.
  super(new SoySyntaxHighlighter(), colors);

  // Highlighter for the outer language.
  FileType type = null;
  if (project == null || virtualFile == null) {
    type = StdFileTypes.PLAIN_TEXT;
  } else {
    Language language = TemplateDataLanguageMappings.getInstance(project).getMapping(virtualFile);
    if (language != null) type = language.getAssociatedFileType();
    if (type == null) type = SoyLanguage.getDefaultTemplateLang();
  }

  SyntaxHighlighter outerHighlighter =
      SyntaxHighlighterFactory.getSyntaxHighlighter(type, project, virtualFile);

  registerLayer(OTHER, new LayerDescriptor(outerHighlighter, ""));
}
 
開發者ID:google,項目名稱:bamboo-soy,代碼行數:23,代碼來源:SoyLayeredHighlighter.java

示例2: create

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
/**
 * SyntaxHighlighterProvider implementation (for .class files).
 */
@Nullable
@Override
public SyntaxHighlighter create(@NotNull FileType fileType, @Nullable Project project, @Nullable VirtualFile file) {
  if (project != null && file != null) {
    PsiFile psiFile = PsiManager.getInstance(project).findFile(file);

    if (fileType == JavaClassFileType.INSTANCE && psiFile != null) {
      Language language = psiFile.getLanguage();
      if (language != JavaLanguage.INSTANCE) {
        return SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, file);
      }
    }

    if (psiFile instanceof ClsFileImpl) {
      LanguageLevel sourceLevel = ((ClsFileImpl)psiFile).getLanguageLevel();
      return new JavaFileHighlighter(sourceLevel);
    }
  }

  return new JavaFileHighlighter();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:JavaSyntaxHighlighterFactory.java

示例3: updateView

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
@Override
public void updateView() {
  EditorColorsScheme scheme = myOptions.getSelectedScheme();

  myEditor.setColorsScheme(scheme);

  EditorHighlighter highlighter = null;
  if (myPage instanceof EditorHighlightingProvidingColorSettingsPage) {

    highlighter = ((EditorHighlightingProvidingColorSettingsPage)myPage).createEditorHighlighter(scheme);
  }
  if (highlighter == null) {
    final SyntaxHighlighter pageHighlighter = myPage.getHighlighter();
    highlighter = HighlighterFactory.createHighlighter(pageHighlighter, scheme);
  }
  myEditor.setHighlighter(highlighter);
  updateHighlighters();

  myEditor.reinitSettings();

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:SimpleEditorPreview.java

示例4: getHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
@Override
public SyntaxHighlighter getHighlighter() {
  final SyntaxHighlighter highlighter =
      SyntaxHighlighterFactory.getSyntaxHighlighter(BuildFileType.INSTANCE, null, null);
  assert highlighter != null;
  return highlighter;
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:8,代碼來源:BuildColorsPage.java

示例5: getHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
    log.info("Building new SutrSyntaxHighlighter for Sutr Color settings page.");

    return new SutrSyntaxHighlighter();
}
 
開發者ID:SlalomConsulting,項目名稱:sutr-io,代碼行數:8,代碼來源:SutrColorSettingsPage.java

示例6: getSyntaxHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
@NotNull
@Override
public SyntaxHighlighter getSyntaxHighlighter(Project project, VirtualFile virtualFile){
    log.info("Creating new Utr Syntax Highlight for [" + project.getName() + "]");

    return new UtrSyntaxHighlighter();
}
 
開發者ID:SlalomConsulting,項目名稱:sutr-io,代碼行數:8,代碼來源:UtrSyntaxHighlighterFactory.java

示例7: RtplLanguage

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
protected RtplLanguage() {
    super(NAME);
    SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(this,
            new SingleLazyInstanceSyntaxHighlighterFactory() {
                @NotNull
                protected SyntaxHighlighter createHighlighter() {
                    return new RtplSyntaxHighlighter();
                }
            }
    );
}
 
開發者ID:LichFaker,項目名稱:RtplPlugin,代碼行數:12,代碼來源:RtplLanguage.java

示例8: LexerEditorHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public LexerEditorHighlighter(@NotNull SyntaxHighlighter highlighter, @NotNull EditorColorsScheme scheme) {
  myScheme = scheme;
  myLexer = highlighter.getHighlightingLexer();
  myLexer.start(ArrayUtil.EMPTY_CHAR_SEQUENCE);
  myInitialState = myLexer.getState();
  myHighlighter = highlighter;
  mySegments = createSegments();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:LexerEditorHighlighter.java

示例9: getActiveSyntaxHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public SyntaxHighlighter getActiveSyntaxHighlighter() {
  if (myCurrentMapper != null) {
    return myCurrentMapper.mySyntaxHighlighter;
  }

  return LayeredLexerEditorHighlighter.this.getSyntaxHighlighter();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:LayeredLexerEditorHighlighter.java

示例10: ChunkExtractor

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:ChunkExtractor.java

示例11: printWithHighlighting

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public static void printWithHighlighting(@NotNull ConsoleView console, @NotNull String text, @NotNull SyntaxHighlighter highlighter) {
  Lexer lexer = highlighter.getHighlightingLexer();
  lexer.start(text, 0, text.length(), 0);

  IElementType tokenType;
  while ((tokenType = lexer.getTokenType()) != null) {
    console.print(lexer.getTokenText(), getContentTypeForToken(tokenType, highlighter));
    lexer.advance();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:ConsoleViewUtil.java

示例12: printAsFileType

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public static void printAsFileType(@NotNull ConsoleView console, @NotNull String text, @NotNull FileType fileType) {
  SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
  if (highlighter != null) {
    printWithHighlighting(console, text, highlighter);
  }
  else {
    console.print(text, ConsoleViewContentType.NORMAL_OUTPUT);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ConsoleViewUtil.java

示例13: setHighlighter

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public static void setHighlighter(Editor editor, @Nullable TemplateContext templateContext) {
  SyntaxHighlighter highlighter = null;
  if (templateContext != null) {
    for(TemplateContextType type: TemplateManagerImpl.getAllContextTypes()) {
      if (templateContext.isEnabled(type)) {
        highlighter = type.createHighlighter();
        if (highlighter != null) break;
      }
    }
  }
  setHighlighter((EditorEx)editor, highlighter);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:TemplateEditorUtil.java

示例14: PropertiesLanguage

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public PropertiesLanguage() {
  super("Properties", "text/properties");
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(this, new SingleLazyInstanceSyntaxHighlighterFactory() {
    @NotNull
    protected SyntaxHighlighter createHighlighter() {
      return new PropertiesHighlighter();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PropertiesLanguage.java

示例15: addClickNavigator

import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public void addClickNavigator(final Editor view,
                              final SyntaxHighlighter highlighter,
                              final HighlightData[] data,
                              final boolean isBackgroundImportant) {
  addMouseMotionListener(view, highlighter, data, isBackgroundImportant);

  CaretListener listener = new CaretAdapter() {
    @Override
    public void caretPositionChanged(CaretEvent e) {
      navigate(view, true, e.getNewPosition(), highlighter, data, isBackgroundImportant);
    }
  };
  view.getCaretModel().addCaretListener(listener);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ClickNavigator.java


注:本文中的com.intellij.openapi.fileTypes.SyntaxHighlighter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。