本文整理汇总了Java中com.intellij.openapi.editor.highlighter.EditorHighlighterFactory类的典型用法代码示例。如果您正苦于以下问题:Java EditorHighlighterFactory类的具体用法?Java EditorHighlighterFactory怎么用?Java EditorHighlighterFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EditorHighlighterFactory类属于com.intellij.openapi.editor.highlighter包,在下文中一共展示了EditorHighlighterFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTab
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private void updateTab(@NotNull JBTabsPaneImpl tabsPane, int index, WeaveIdentifier identifier, @NotNull WeaveDataType dataType) {
Icon icon = iconsMap.containsKey(dataType.getText()) ? iconsMap.get(dataType.getText()) : AllIcons.FileTypes.Any_type;
String title = (identifier == null ? "output" : identifier.getName());
tabsPane.setTitleAt(index, title);
tabsPane.setIconAt(index, icon);
contentTypes.put(title, dataType.getText());
VirtualFile vfile = inputOutputFiles.get(title);
if (vfile != null) {
vfile.putUserData(newFileDataTypeKey, dataType.getText());
FileContentUtilCore.reparseFiles(vfile);
}
Editor oldEditor = editors.get(title);
FileType newType = fileTypes.containsKey(dataType.getText()) ? fileTypes.get(dataType.getText()) : FileTypes.UNKNOWN;
((EditorEx) oldEditor).setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(project, newType));
}
示例2: buildExtensions
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@NotNull
@Override
protected List<EditorHighlighterProvider> buildExtensions(@NotNull String stringKey, @NotNull final FileType key) {
List<EditorHighlighterProvider> fromEP = super.buildExtensions(stringKey, key);
if (fromEP.isEmpty()) {
EditorHighlighterProvider defaultProvider = new EditorHighlighterProvider() {
@Override
public EditorHighlighter getEditorHighlighter(@Nullable Project project,
@NotNull FileType fileType,
@Nullable VirtualFile virtualFile,
@NotNull EditorColorsScheme colors) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(
SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, virtualFile), colors);
}
};
return Collections.singletonList(defaultProvider);
}
return fromEP;
}
示例3: getLexerBasedOnLexerHighlighter
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@Nullable
public static Lexer getLexerBasedOnLexerHighlighter(CharSequence text, VirtualFile virtualFile, Project project) {
EditorHighlighter highlighter = null;
PsiFile psiFile = virtualFile != null ? PsiManager.getInstance(project).findFile(virtualFile) : null;
final Document document = psiFile != null ? PsiDocumentManager.getInstance(project).getDocument(psiFile) : null;
final EditorHighlighter cachedEditorHighlighter;
boolean alreadyInitializedHighlighter = false;
if (document != null &&
(cachedEditorHighlighter = getEditorHighlighterForCachesBuilding(document)) != null &&
PlatformIdTableBuilding.checkCanUseCachedEditorHighlighter(text, cachedEditorHighlighter)) {
highlighter = cachedEditorHighlighter;
alreadyInitializedHighlighter = true;
}
else if (virtualFile != null) {
highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(project, virtualFile);
}
if (highlighter != null) {
return new LexerEditorHighlighterLexer(highlighter, alreadyInitializedHighlighter);
}
return null;
}
示例4: createEditor
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private static Editor createEditor(boolean isReadOnly, final Document document, final Project project) {
EditorFactory editorFactory = EditorFactory.getInstance();
Editor editor = (isReadOnly ? editorFactory.createViewer(document, project) : editorFactory.createEditor(document, project));
editor.getContentComponent().setFocusable(!isReadOnly);
EditorSettings editorSettings = editor.getSettings();
editorSettings.setVirtualSpace(false);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
editorSettings.setCaretRowShown(false);
EditorColorsScheme scheme = editor.getColorsScheme();
VirtualFile file = FileDocumentManager.getInstance().getFile(document);
if (file != null) {
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
((EditorEx) editor).setHighlighter(highlighter);
}
return editor;
}
示例5: createHighlighter
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private EditorHighlighter createHighlighter() {
if (myTemplate != null && myVelocityFileType != FileTypes.UNKNOWN) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft"));
}
FileType fileType = null;
if (myTemplate != null) {
fileType = FileTypeManager.getInstance().getFileTypeByExtension(myTemplate.getExtension());
}
if (fileType == null) {
fileType = FileTypes.PLAIN_TEXT;
}
SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
if (originalHighlighter == null) {
originalHighlighter = new PlainSyntaxHighlighter();
}
final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
LayeredLexerEditorHighlighter highlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), scheme);
highlighter.registerLayer(FileTemplateTokenType.TEXT, new LayerDescriptor(originalHighlighter, ""));
return highlighter;
}
示例6: rehighlightOpenEditors
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
/**
* Force re-highlighting in all open editors that belong to specified project.
*/
public static void rehighlightOpenEditors(final @NotNull Project project) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
for (Editor editor : EditorFactory.getInstance().getAllEditors()) {
if (editor instanceof EditorEx && editor.getProject() == project) {
final VirtualFile vFile = ((EditorEx)editor).getVirtualFile();
if (vFile != null) {
final EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(project, vFile);
((EditorEx)editor).setHighlighter(highlighter);
}
}
}
}
});
}
示例7: buildExtensions
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@Override
protected List<EditorHighlighterProvider> buildExtensions(String stringKey, final FileType key) {
List<EditorHighlighterProvider> fromEP = super.buildExtensions(stringKey, key);
if (fromEP.isEmpty()) {
EditorHighlighterProvider defaultProvider = new EditorHighlighterProvider() {
@Override
public EditorHighlighter getEditorHighlighter(@Nullable Project project,
@NotNull FileType fileType,
@Nullable VirtualFile virtualFile,
@NotNull EditorColorsScheme colors) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(
SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, virtualFile), colors);
}
};
return Collections.singletonList(defaultProvider);
}
return fromEP;
}
示例8: createEditor
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
/**
* @return created editor. This editor should be released by {@link #disposeEditor(Editor) }
* method.
*/
@NotNull
private Editor createEditor(){
Editor editor = EditorFactory.getInstance().createEditor(myDocument, myProject);
((EditorMarkupModel) editor.getMarkupModel()).setErrorStripeVisible(true);
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(myFile, EditorColorsManager.getInstance().getGlobalScheme(), myProject);
((EditorEx) editor).setHighlighter(highlighter);
((EditorEx) editor).setFile(myFile);
editor.addEditorMouseListener(myEditorMouseListener);
((EditorImpl) editor).setDropHandler(new FileDropHandler(editor));
TextEditorProvider.putTextEditor(editor, myTextEditor);
return editor;
}
示例9: createEditor
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private static Editor createEditor(boolean isReadOnly, final Document document, final Project project) {
EditorFactory editorFactory = EditorFactory.getInstance();
Editor editor = (isReadOnly ? editorFactory.createViewer(document, project) : editorFactory.createEditor(document, project));
EditorSettings editorSettings = editor.getSettings();
editorSettings.setVirtualSpace(false);
editorSettings.setLineMarkerAreaShown(false);
editorSettings.setIndentGuidesShown(false);
editorSettings.setLineNumbersShown(false);
editorSettings.setFoldingOutlineShown(false);
EditorColorsScheme scheme = editor.getColorsScheme();
scheme.setColor(EditorColors.CARET_ROW_COLOR, null);
VirtualFile file = FileDocumentManager.getInstance().getFile(document);
if (file != null) {
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
((EditorEx) editor).setHighlighter(highlighter);
}
return editor;
}
示例10: createHighlighter
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private EditorHighlighter createHighlighter() {
if (myTemplate != null && myProject != null && myVelocityFileType != FileTypes.UNKNOWN) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft"));
}
FileType fileType = null;
if (myTemplate != null) {
fileType = FileTypeManager.getInstance().getFileTypeByExtension(myTemplate.getExtension());
}
if (fileType == null) {
fileType = FileTypes.PLAIN_TEXT;
}
SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
if (originalHighlighter == null) originalHighlighter = new PlainSyntaxHighlighter();
return new LexerEditorHighlighter(new TemplateHighlighter(originalHighlighter), EditorColorsManager.getInstance().getGlobalScheme());
}
示例11: getIndexingLexer
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@Nullable
@Override
public Lexer getIndexingLexer(@NotNull PsiFile file) {
if (!(file instanceof LatteFile)) {
return null;
}
VirtualFile virtualFile = file.getVirtualFile();
if (virtualFile == null) {
virtualFile = file.getViewProvider().getVirtualFile();
}
try {
LayeredLexer.ourDisableLayersFlag.set(Boolean.TRUE);
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file.getProject(), virtualFile);
return new LexerEditorHighlighterLexer(highlighter, false);
} finally {
LayeredLexer.ourDisableLayersFlag.set(Boolean.FALSE);
}
}
示例12: createEditorHighlighter
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@javax.annotation.Nullable
private static EditorHighlighter createEditorHighlighter(@Nullable Project project, @Nonnull DocumentContent content) {
FileType type = content.getContentType();
VirtualFile file = content.getHighlightFile();
Language language = content.getUserData(DiffUserDataKeys.LANGUAGE);
EditorHighlighterFactory highlighterFactory = EditorHighlighterFactory.getInstance();
if (language != null) {
SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, file);
return highlighterFactory.createEditorHighlighter(syntaxHighlighter, EditorColorsManager.getInstance().getGlobalScheme());
}
if (file != null) {
if ((type == null || type == PlainTextFileType.INSTANCE) || file.getFileType() == type || file instanceof LightVirtualFile) {
return highlighterFactory.createEditorHighlighter(project, file);
}
}
if (type != null) {
return highlighterFactory.createEditorHighlighter(project, type);
}
return null;
}
示例13: buildExtensions
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@Override
protected List<EditorHighlighterProvider> buildExtensions(String stringKey, final FileType key) {
List<EditorHighlighterProvider> fromEP = super.buildExtensions(stringKey, key);
if (fromEP.isEmpty()) {
EditorHighlighterProvider defaultProvider = new EditorHighlighterProvider() {
@Override
public EditorHighlighter getEditorHighlighter(@Nullable Project project,
@Nonnull FileType fileType,
@Nullable VirtualFile virtualFile,
@Nonnull EditorColorsScheme colors) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(
SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, virtualFile), colors);
}
};
return Collections.singletonList(defaultProvider);
}
return fromEP;
}
示例14: createEditor
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@Nonnull
protected Editor createEditor(@Nullable Project project, Document document, VirtualFile file) {
EditorEx editor = (EditorEx)EditorFactory.getInstance().createViewer(document, project);
final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
editor.setFile(file);
editor.setHighlighter(highlighter);
EditorSettings settings = editor.getSettings();
settings.setAnimatedScrolling(false);
settings.setRefrainFromScrolling(false);
settings.setLineNumbersShown(true);
settings.setFoldingOutlineShown(false);
if (settings instanceof SettingsImpl) {
((SettingsImpl)settings).setSoftWrapAppliancePlace(SoftWrapAppliancePlaces.PREVIEW);
}
editor.getFoldingModel().setFoldingEnabled(false);
return editor;
}
示例15: createHighlighter
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private EditorHighlighter createHighlighter() {
if (myTemplate != null && myVelocityFileType != UnknownFileType.INSTANCE) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft"));
}
FileType fileType = null;
if (myTemplate != null) {
fileType = FileTypeManager.getInstance().getFileTypeByExtension(myTemplate.getExtension());
}
if (fileType == null) {
fileType = PlainTextFileType.INSTANCE;
}
SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
if (originalHighlighter == null) {
originalHighlighter = new PlainSyntaxHighlighter();
}
final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
LayeredLexerEditorHighlighter highlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), scheme);
highlighter.registerLayer(FileTemplateTokenType.TEXT, new LayerDescriptor(originalHighlighter, ""));
return highlighter;
}