• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EditorHighlighterFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.editor.highlighter.EditorHighlighterFactory的典型用法代码示例。如果您正苦于以下问题:Java EditorHighlighterFactory类的具体用法?Java EditorHighlighterFactory怎么用?Java EditorHighlighterFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EditorHighlighterFactory类属于com.intellij.openapi.editor.highlighter包,在下文中一共展示了EditorHighlighterFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:20,代码来源:WeaveEditor.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileTypeEditorHighlighterProviders.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:EditorHighlighterCache.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:TemplateEditorUtil.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FileTemplateConfigurable.java


示例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);
          }
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyUtil.java


示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:FileTypeEditorHighlighterProviders.java


示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:TextEditorComponent.java


示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:TemplateEditorUtil.java


示例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());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:FileTemplateConfigurable.java


示例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);
	}
}
 
开发者ID:JanTvrdik,项目名称:intellij-latte,代码行数:20,代码来源:LatteIndexPatternBuilder.java


示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:DiffUtil.java


示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:FileTypeEditorHighlighterProviders.java


示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:DetailViewImpl.java


示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:FileTemplateConfigurable.java


示例16: createEditor

import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
public Editor createEditor(Document document, Project project, @Nullable FileType fileType) {
    EditorImpl editor = (EditorImpl) EditorFactory.getInstance().createEditor(document, project);
    if (fileType != null) {
        editor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileType));
    }
    return editor;
}
 
开发者ID:PioBeat,项目名称:GravSupport,代码行数:8,代码来源:LanguageFileEditorGUI.java


示例17: createEditorHighlighter

import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@Nullable
public static EditorHighlighter createEditorHighlighter(@Nullable Project project, @NotNull DocumentContent content) {
  FileType type = content.getContentType();
  VirtualFile file = content.getHighlightFile();

  if ((file != null && file.getFileType() == type) || file instanceof LightVirtualFile) {
    return EditorHighlighterFactory.getInstance().createEditorHighlighter(project, file);
  }
  if (type != null) {
    return EditorHighlighterFactory.getInstance().createEditorHighlighter(project, type);
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DiffUtil.java


示例18: createEditor

import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
@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);

  ((EditorEx)editor).setContextMenuGroupId(IdeActions.GROUP_EDITOR_POPUP);

  ((EditorImpl) editor).setDropHandler(new FileDropHandler(editor));

  TextEditorProvider.putTextEditor(editor, myTextEditor);
  return editor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:TextEditorComponent.java


示例19: updateHighlighters

import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
/**
 * Updates editors' highlighters. This should be done when the opened file
 * changes its file type.
 */
private void updateHighlighters(){
  if (!myProject.isDisposed() && !myEditor.isDisposed()) {
    final EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, myFile);
    ((EditorEx)myEditor).setHighlighter(highlighter);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:TextEditorComponent.java


示例20: setHighlighterSettings

import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; //导入依赖的package包/类
private void setHighlighterSettings(@Nullable EditorColorsScheme settings, @NotNull EditorPlace place) {
  if (settings == null) {
    settings = EditorColorsManager.getInstance().getGlobalScheme();
  }
  Editor editor = place.getEditor();
  DiffEditorState editorState = place.getState();
  if (editor != null) {
    ((EditorEx)editor).setHighlighter(EditorHighlighterFactory.getInstance().
      createEditorHighlighter(editorState.getFileType(), settings, editorState.getProject()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MergePanel2.java



注:本文中的com.intellij.openapi.editor.highlighter.EditorHighlighterFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseTarget类代码示例发布时间:2022-05-22
下一篇:
Java GetQueueInfoResponseProto类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap