本文整理匯總了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, ""));
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
}
);
}
示例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();
}
示例9: getActiveSyntaxHighlighter
import com.intellij.openapi.fileTypes.SyntaxHighlighter; //導入依賴的package包/類
public SyntaxHighlighter getActiveSyntaxHighlighter() {
if (myCurrentMapper != null) {
return myCurrentMapper.mySyntaxHighlighter;
}
return LayeredLexerEditorHighlighter.this.getSyntaxHighlighter();
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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();
}
});
}
示例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);
}