• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java EditorMarkupModel类的典型用法和代码示例

java 1次浏览

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

EditorMarkupModel类属于com.intellij.openapi.editor.ex包,在下文中一共展示了EditorMarkupModel类的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createEditorHolders

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@NotNull
@Override
protected List<TextEditorHolder> createEditorHolders(@NotNull EditorHolderFactory<TextEditorHolder> factory) {
  List<TextEditorHolder> holders = super.createEditorHolders(factory);

  boolean[] forceReadOnly = TextDiffViewerUtil.checkForceReadOnly(myContext, myRequest);
  for (int i = 0; i < 3; i++) {
    if (forceReadOnly[i]) holders.get(i).getEditor().setViewer(true);
  }

  ThreeSide.LEFT.select(holders).getEditor().setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
  ((EditorMarkupModel)ThreeSide.BASE.select(holders).getEditor().getMarkupModel()).setErrorStripeVisible(false);

  if (Registry.is("diff.divider.repainting.disable.blitting")) {
    for (TextEditorHolder holder : holders) {
      holder.getEditor().getScrollPane().getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
    }
  }

  return holders;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:22,
代码来源:ThreesideTextDiffViewer.java

示例2: createEditor

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@NotNull
public static EditorEx createEditor(@NotNull Document document, @Nullable Project project, boolean isViewer, boolean enableFolding) {
  EditorFactory factory = EditorFactory.getInstance();
  EditorEx editor = (EditorEx)(isViewer ? factory.createViewer(document, project) : factory.createEditor(document, project));

  editor.putUserData(DiffManagerImpl.EDITOR_IS_DIFF_KEY, Boolean.TRUE);

  editor.getSettings().setLineNumbersShown(true);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
  editor.getGutterComponentEx().setShowDefaultGutterPopup(false);

  if (enableFolding) {
    setFoldingModelSupport(editor);
  } else {
    editor.getSettings().setFoldingOutlineShown(false);
    editor.getFoldingModel().setFoldingEnabled(false);
  }

  UIUtil.removeScrollBorder(editor.getComponent());

  return editor;
}
 

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

示例3: createEditor

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@Nullable
public EditorEx createEditor() {
  Document document = getDocument();
  if (document == null) return null;
  Project project = myData.getProject();
  EditorEx editor = DiffUtil.createEditor(document, project, myIndex != 1);

  if (editor == null) return editor;
  //FileType type = getFileType();
  //editor.setHighlighter(HighlighterFactory.createHighlighter(project, type));
  if (myIndex == 0) editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
  if (myIndex != 1) ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
  editor.getSettings().setFoldingOutlineShown(false);
  editor.getFoldingModel().setFoldingEnabled(false);
  editor.getSettings().setLineMarkerAreaShown(false);
  editor.getSettings().setFoldingOutlineShown(false);
  editor.getGutterComponentEx().setShowDefaultGutterPopup(false);
  initEditorSettings(editor);

  return editor;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:22,
代码来源:MergePanel2.java

示例4: setOrRefreshErrorStripeRenderer

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
static void setOrRefreshErrorStripeRenderer(@NotNull EditorMarkupModel editorMarkupModel,
                                            @NotNull Project project,
                                            @NotNull Document document,
                                            PsiFile file) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (!editorMarkupModel.isErrorStripeVisible() || !DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file)) {
    return;
  }
  ErrorStripeRenderer renderer = editorMarkupModel.getErrorStripeRenderer();
  if (renderer instanceof TrafficLightRenderer) {
    TrafficLightRenderer tlr = (TrafficLightRenderer)renderer;
    tlr.refresh();
    ((EditorMarkupModelImpl)editorMarkupModel).repaintVerticalScrollBar();
    if (tlr.myFile == null || tlr.myFile.isValid()) return;
    Disposer.dispose(tlr);
  }
  EditorImpl editor = (EditorImpl)editorMarkupModel.getEditor();

  if (!editor.isDisposed()) {
    renderer = new TrafficLightRenderer(project, document, file);
    Disposer.register(editor.getDisposable(), (Disposable)renderer);
    editorMarkupModel.setErrorStripeRenderer(renderer);
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:25,
代码来源:TrafficLightRenderer.java

示例5: createEditor

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的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

示例6: createLogEditor

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
private Editor createLogEditor() {
  Project project = myProjectModel.getProject();
  final Editor editor = ConsoleViewUtil.setupConsoleEditor(project, false, false);
  Disposer.register(myProjectModel, new Disposable() {
    @Override
    public void dispose() {
      EditorFactory.getInstance().releaseEditor(editor);
    }
  });

  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);

  final ClearLog clearLog = new ClearLog();
  clearLog.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.CONSOLE_CLEAR_ALL).getShortcutSet(), editor.getContentComponent());

  editor.addEditorMouseListener(new EditorPopupHandler() {
    public void invokePopup(final EditorMouseEvent event) {
      final ActionManager actionManager = ActionManager.getInstance();
      final ActionPopupMenu menu = actionManager.createActionPopupMenu(ActionPlaces.EDITOR_POPUP, createPopupActions(actionManager, clearLog));
      final MouseEvent mouseEvent = event.getMouseEvent();
      menu.getComponent().show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
    }
  });
  return editor;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:26,
代码来源:EventLogConsole.java

示例7: updateChangesForDocument

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
private void updateChangesForDocument(@NotNull final Document document) {
  if (DaemonListeners.isUnderIgnoredAction(null)) return;
  List<Pair<PsiElement, Boolean>> toUpdate = changedElements.get(document);
  if (toUpdate == null) return;
  Application application = ApplicationManager.getApplication();
  final Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor();
  if (editor != null && !application.isUnitTestMode()) {
    application.invokeLater(new Runnable() {
      @Override
      public void run() {
        EditorMarkupModel markupModel = (EditorMarkupModel)editor.getMarkupModel();
        PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
        TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markupModel, myProject, editor.getDocument(), file);
      }
    }, ModalityState.stateForComponent(editor.getComponent()), myProject.getDisposed());
  }

  for (Pair<PsiElement, Boolean> changedElement : toUpdate) {
    PsiElement element = changedElement.getFirst();
    Boolean whiteSpaceOptimizationAllowed = changedElement.getSecond();
    updateByChange(element, document, whiteSpaceOptimizationAllowed);
  }
  changedElements.remove(document);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:25,
代码来源:PsiChangeHandler.java

示例8: setOrRefreshErrorStripeRenderer

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public static void setOrRefreshErrorStripeRenderer(@NotNull EditorMarkupModel editorMarkupModel,
                                                   @NotNull Project project,
                                                   @NotNull Document document,
                                                   PsiFile file) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (!editorMarkupModel.isErrorStripeVisible() || !DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file)) {
    return;
  }
  ErrorStripeRenderer renderer = editorMarkupModel.getErrorStripeRenderer();
  if (renderer instanceof TrafficLightRenderer) {
    TrafficLightRenderer tlr = (TrafficLightRenderer)renderer;
    tlr.refresh();
    ((EditorMarkupModelImpl)editorMarkupModel).repaintVerticalScrollBar();
    if (tlr.myFile == null || tlr.myFile.isValid()) return;
    Disposer.dispose(tlr);
  }
  renderer = new TrafficLightRenderer(project, document, file);
  Disposer.register(((EditorImpl)editorMarkupModel.getEditor()).getDisposable(), (Disposable)renderer);
  editorMarkupModel.setErrorStripeRenderer(renderer);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:21,
代码来源:TrafficLightRenderer.java

示例9: createEditorHolders

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@Nonnull
@Override
protected List<TextEditorHolder> createEditorHolders(@Nonnull EditorHolderFactory<TextEditorHolder> factory) {
  List<TextEditorHolder> holders = super.createEditorHolders(factory);

  boolean[] forceReadOnly = TextDiffViewerUtil.checkForceReadOnly(myContext, myRequest);
  for (int i = 0; i < 3; i++) {
    if (forceReadOnly[i]) holders.get(i).getEditor().setViewer(true);
  }

  ThreeSide.LEFT.select(holders).getEditor().setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
  ((EditorMarkupModel)ThreeSide.BASE.select(holders).getEditor().getMarkupModel()).setErrorStripeVisible(false);

  for (TextEditorHolder holder : holders) {
    DiffUtil.disableBlitting(holder.getEditor());
  }

  return holders;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:20,
代码来源:ThreesideTextDiffViewer.java

示例10: createEditor

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@Nonnull
public static EditorEx createEditor(@Nonnull Document document, @Nullable Project project, boolean isViewer, boolean enableFolding) {
  EditorFactory factory = EditorFactory.getInstance();
  EditorEx editor = (EditorEx)(isViewer ? factory.createViewer(document, project) : factory.createEditor(document, project));

  editor.putUserData(DiffManagerImpl.EDITOR_IS_DIFF_KEY, Boolean.TRUE);

  editor.getSettings().setShowIntentionBulb(false);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
  editor.getGutterComponentEx().setShowDefaultGutterPopup(false);

  if (enableFolding) {
    setFoldingModelSupport(editor);
  } else {
    editor.getSettings().setFoldingOutlineShown(false);
    editor.getFoldingModel().setFoldingEnabled(false);
  }

  UIUtil.removeScrollBorder(editor.getComponent());

  return editor;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:23,
代码来源:DiffUtil.java

示例11: setOrRefreshErrorStripeRenderer

点赞 3

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@RequiredDispatchThread
static void setOrRefreshErrorStripeRenderer(@Nonnull EditorMarkupModel editorMarkupModel,
                                            @Nonnull Project project,
                                            @Nonnull Document document,
                                            PsiFile file) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (!editorMarkupModel.isErrorStripeVisible() || !DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file)) {
    return;
  }
  ErrorStripeRenderer renderer = editorMarkupModel.getErrorStripeRenderer();
  if (renderer instanceof TrafficLightRenderer) {
    TrafficLightRenderer tlr = (TrafficLightRenderer)renderer;
    tlr.refresh();
    ((EditorMarkupModelImpl)editorMarkupModel).repaintVerticalScrollBar();
    if (tlr.myFile == null || tlr.myFile.isValid()) return;
    Disposer.dispose(tlr);
  }
  EditorImpl editor = (EditorImpl)editorMarkupModel.getEditor();

  if (!editor.isDisposed()) {
    renderer = new TrafficLightRenderer(project, document, file);
    Disposer.register(editor.getDisposable(), (Disposable)renderer);
    editorMarkupModel.setErrorStripeRenderer(renderer);
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:26,
代码来源:TrafficLightRenderer.java

示例12: ColorPreviewPanel

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public ColorPreviewPanel() {
    final EditorFactory editorFactory = EditorFactory.getInstance();
    myEditor = (EditorEx) editorFactory.createViewer(editorFactory.createDocument(""));

    final EditorSettings settings = myEditor.getSettings();
    settings.setLineNumbersShown(true);
    settings.setWhitespacesShown(true);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setAdditionalColumnsCount(0);
    settings.setAdditionalLinesCount(0);
    settings.setRightMarginShown(true);
    settings.setRightMargin(60);

    /** {@link FontEditorPreview#installTrafficLights(EditorEx)} */
    TrafficLightRenderer renderer = new TrafficLightRenderer(null, null, null) {

        private final DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();

        {
            status.errorAnalyzingFinished = true;
            status.errorCount = new int[]{ 0 };
        }

        @NotNull
        @Override
        protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(
                @NotNull SeverityRegistrar severityRegistrar) {
            return status;
        }
    };

    Disposer.register((Disposable) myEditor.getCaretModel(), renderer);
    EditorMarkupModel markupModel = (EditorMarkupModel) myEditor.getMarkupModel();
    markupModel.setErrorStripeRenderer(renderer);
    markupModel.setErrorStripeVisible(true);
}
 

开发者ID:huoguangjin,
项目名称:MultiHighlight,
代码行数:39,
代码来源:ColorPreviewPanel.java

示例13: createEditor

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的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

示例14: repaintErrorStripeRenderer

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
static void repaintErrorStripeRenderer(@NotNull Editor editor, @NotNull Project project) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (!project.isInitialized()) return;
  final Document document = editor.getDocument();
  final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
  final EditorMarkupModel markup = (EditorMarkupModel)editor.getMarkupModel();
  markup.setErrorPanelPopupHandler(new DaemonEditorPopup(psiFile));
  markup.setErrorStripTooltipRendererProvider(new DaemonTooltipRendererProvider(project));
  markup.setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT);
  TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markup, project, document, psiFile);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:12,
代码来源:DaemonListeners.java

示例15: installTrafficLights

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
static void installTrafficLights(@NotNull EditorEx editor) {
  TrafficLightRenderer renderer = new TrafficLightRenderer(null, null,null) {
    @NotNull
    @Override
    protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(@NotNull SeverityRegistrar severityRegistrar) {
      DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();
      status.errorAnalyzingFinished = true;
      status.errorCount = new int[]{1, 2};
      return status;
    }
  };
  Disposer.register((Disposable)editor.getCaretModel(), renderer);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeRenderer(renderer);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:16,
代码来源:FontEditorPreview.java

示例16: mouseMoved

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
  int line = EditorUtil.yPositionToLogicalLine(editor, e.getPoint());
  if (line == lastGutterToolTipLine) {
    return;
  }

  TooltipController controller = TooltipController.getInstance();
  if (lastGutterToolTipLine != -1) {
    controller.cancelTooltip(TOOLTIP_GROUP, e, true);
  }

  String toolTip = gutterContentProvider.getToolTip(line, editor);
  setCursor(toolTip == null ? Cursor.getDefaultCursor() : Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  if (toolTip == null) {
    lastGutterToolTipLine = -1;
    controller.cancelTooltip(TOOLTIP_GROUP, e, false);
  }
  else {
    lastGutterToolTipLine = line;
    RelativePoint showPoint = new RelativePoint(this, e.getPoint());
    controller.showTooltipByMouseMove(editor,
                                      showPoint,
                                      ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(toolTip),
                                      false,
                                      TOOLTIP_GROUP,
                                      new HintHint(this, e.getPoint()).setAwtTooltip(true));
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:30,
代码来源:ConsoleGutterComponent.java

示例17: repaintErrorStripeRenderer

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
void repaintErrorStripeRenderer(@NotNull Editor editor) {
  if (!myProject.isInitialized()) return;
  final Document document = editor.getDocument();
  final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
  final EditorMarkupModel markup = (EditorMarkupModel)editor.getMarkupModel();
  markup.setErrorPanelPopupHandler(new DaemonEditorPopup(psiFile));
  markup.setErrorStripTooltipRendererProvider(new DaemonTooltipRendererProvider(myProject));
  markup.setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT);
  TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markup, myProject, document, psiFile);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:11,
代码来源:DaemonCodeAnalyzerImpl.java

示例18: installTrafficLights

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
static void installTrafficLights(@NotNull EditorEx editor) {
  TrafficLightRenderer renderer = new TrafficLightRenderer(null, null,null){
    @Override
    protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(boolean fillErrorsCount, SeverityRegistrar severityRegistrar) {
      DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();
      status.errorAnalyzingFinished = true;
      status.errorCount = new int[]{1, 2};
      return status;
    }
  };
  Disposer.register((Disposable)editor.getCaretModel(), renderer);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeRenderer(renderer);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:15,
代码来源:FontEditorPreview.java

示例19: createEditor

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@Nonnull
private Editor createEditor() {
  Editor editor = EditorFactory.getInstance().createEditor(myDocument, myProject);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
  ((EditorEx)editor).getGutterComponentEx().setForceShowRightFreePaintersArea(true);

  ((EditorEx)editor).setFile(myFile);

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

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

  TextEditorProvider.putTextEditor(editor, myTextEditor);
  return editor;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:16,
代码来源:TextEditorComponent.java

示例20: repaintErrorStripeRenderer

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
static void repaintErrorStripeRenderer(@Nonnull Editor editor, @Nonnull Project project) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (!project.isInitialized()) return;
  final Document document = editor.getDocument();
  final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
  final EditorMarkupModel markup = (EditorMarkupModel)editor.getMarkupModel();
  markup.setErrorPanelPopupHandler(new DaemonEditorPopup(psiFile));
  markup.setErrorStripTooltipRendererProvider(new DaemonTooltipRendererProvider(project));
  markup.setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT);
  TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markup, project, document, psiFile);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:12,
代码来源:DaemonListeners.java

示例21: installTrafficLights

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
static void installTrafficLights(@Nonnull EditorEx editor) {
  TrafficLightRenderer renderer = new TrafficLightRenderer(null, null,null) {
    @Nonnull
    @Override
    protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(@Nonnull SeverityRegistrar severityRegistrar) {
      DaemonCodeAnalyzerStatus status = new DaemonCodeAnalyzerStatus();
      status.errorAnalyzingFinished = true;
      status.errorCount = new int[]{1, 2};
      return status;
    }
  };
  Disposer.register((Disposable)editor.getCaretModel(), renderer);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeRenderer(renderer);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:16,
代码来源:FontEditorPreview.java

示例22: showTooltip

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public void showTooltip(@NotNull Editor editor, @NotNull Point p, @NotNull String text, boolean alignToRight, @NotNull TooltipGroup group) {
  TooltipRenderer tooltipRenderer = ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(text);
  showTooltip(editor, p, tooltipRenderer, alignToRight, group);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:5,
代码来源:TooltipController.java

示例23: onContentChangedIn

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public void onContentChangedIn(EditorSource source) {
  myDiffUpdater.contentRemoved(source);
  final EditorEx editor = source.getEditor();
  if (myIsHorizontal && source.getSide() == FragmentSide.SIDE1 && editor != null) {
    editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
  }
  DiffSideView viewSide = getSideView(source.getSide());
  viewSide.setEditorSource(getProject(), source);
  Disposer.dispose(myScrollSupport);
  if (editor == null) {
    if (!myDisposed) {
      rediff();
    }
    return;
  }

  final MouseListener mouseListener = PopupHandler
    .installUnknownPopupHandler(editor.getContentComponent(), new MergeActionGroup(this, source.getSide()), ActionManager.getInstance());
  myDiffUpdater.contentAdded(source);
  editor.getSettings().setLineNumbersShown(true);
  editor.getSettings().setFoldingOutlineShown(false);
  editor.getFoldingModel().setFoldingEnabled(false);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);

  Editor editor1 = getEditor(FragmentSide.SIDE1);
  Editor editor2 = getEditor(FragmentSide.SIDE2);
  if (editor1 != null && editor2 != null && myIsSyncScroll) {
    myScrollSupport.install(new EditingSides[]{this});
  }

  final VisibleAreaListener visibleAreaListener = mySplitter.getVisibleAreaListener();
  final ScrollingModel scrollingModel = editor.getScrollingModel();
  if (visibleAreaListener != null) {
    scrollingModel.addVisibleAreaListener(visibleAreaListener);
    scrollingModel.addVisibleAreaListener(myVisibleAreaListener);
  }
  myFontSizeSynchronizer.synchronize(editor);
  source.addDisposable(new Disposable() {
    public void dispose() {
      myFontSizeSynchronizer.stopSynchronize(editor);
    }
  });
  source.addDisposable(new Disposable() {
    public void dispose() {
      if (visibleAreaListener != null) {
        scrollingModel.removeVisibleAreaListener(visibleAreaListener);
        scrollingModel.removeVisibleAreaListener(myVisibleAreaListener);
      }
      editor.getContentComponent().removeMouseListener(mouseListener);
    }
  });
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:53,
代码来源:DiffPanelImpl.java

示例24: createHint

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
@NotNull
public static EmmetPreviewHint createHint(@NotNull final EditorEx parentEditor,
                                          @NotNull String templateText,
                                          @NotNull FileType fileType) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document document = editorFactory.createDocument(templateText);
  final EditorEx previewEditor = (EditorEx)editorFactory.createEditor(document, parentEditor.getProject(), fileType, true);
  MarkupModelEx model = previewEditor.getMarkupModel();
  if (model instanceof EditorMarkupModel) {
    ((EditorMarkupModel)model).setErrorStripeVisible(true);
  }
  final EditorSettings settings = previewEditor.getSettings();
  settings.setLineNumbersShown(false);
  settings.setAdditionalLinesCount(1);
  settings.setAdditionalColumnsCount(1);
  settings.setRightMarginShown(false);
  settings.setFoldingOutlineShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setIndentGuidesShown(false);
  settings.setVirtualSpace(false);
  settings.setWheelFontChangeEnabled(false);
  settings.setAdditionalPageAtBottom(false);
  settings.setCaretRowShown(false);
  previewEditor.setCaretEnabled(false);
  previewEditor.setBorder(IdeBorderFactory.createEmptyBorder());

  JBPanel panel = new JBPanel(new BorderLayout()) {
    @NotNull
    @Override
    public Dimension getPreferredSize() {
      Dimension size = super.getPreferredSize();
      Dimension parentEditorSize = parentEditor.getScrollPane().getSize();
      int maxWidth = (int)parentEditorSize.getWidth() / 3;
      int maxHeight = (int)parentEditorSize.getHeight() / 2;
      final int width = settings.isUseSoftWraps() ? maxWidth : Math.min((int)size.getWidth(), maxWidth);
      final int height = Math.min((int)size.getHeight(), maxHeight);
      return new Dimension(width, height);
    }

    @NotNull
    @Override
    public Insets getInsets() {
      return new Insets(1, 2, 0, 0);
    }
  };
  panel.setBackground(previewEditor.getBackgroundColor());
  panel.add(previewEditor.getComponent(), BorderLayout.CENTER);
  return new EmmetPreviewHint(panel, previewEditor, parentEditor);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:50,
代码来源:EmmetPreviewHint.java

示例25: createPreviewEditor

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public Editor createPreviewEditor(final VirtualFile grammarFile, Document doc) {
		LOG.info("createEditor: create new editor for "+grammarFile.getPath()+" "+previewPanel.project.getName());
		final EditorFactory factory = EditorFactory.getInstance();
		doc.addDocumentListener(
			new DocumentAdapter() {
				VirtualFile grammarFileForThisPreviewEditor;

				{
					{ // faux ctor
						this.grammarFileForThisPreviewEditor = grammarFile;
					}
				}

				@Override
				public void documentChanged(DocumentEvent event) {
					previewPanel.updateParseTreeFromDoc(grammarFileForThisPreviewEditor);
				}
			}
		                       );
		final Editor editor = factory.createEditor(doc, previewPanel.project);
		// force right margin
		((EditorMarkupModel) editor.getMarkupModel()).setErrorStripeVisible(true);
		EditorSettings settings = editor.getSettings();
		settings.setWhitespacesShown(true);
		settings.setLineNumbersShown(true);
		settings.setLineMarkerAreaShown(true);
		installListeners(editor);

//		EditorGutter gutter = editor.getGutter();
//		gutter.registerTextAnnotation(
//			new TextAnnotationGutterProvider() {
//				@Nullable
//				@Override
//				public String getLineText(int line, Editor editor) {
//					return "foo";
//				}
//
//				@Nullable
//				@Override
//				public String getToolTip(int line, Editor editor) {
//					return "tool tip";
//				}
//
//				@Override
//				public EditorFontType getStyle(int line, Editor editor) {
//					return null;
//				}
//
//				@Nullable
//				@Override
//				public ColorKey getColor(int line, Editor editor) {
//					return EditorColors.MODIFIED_LINES_COLOR;
//				}
//
//				@Nullable
//				@Override
//				public Color getBgColor(int line, Editor editor) {
//					return JBColor.WHITE;
//				}
//
//				@Override
//				public List<AnAction> getPopupActions(int line, Editor editor) {
//					return null;
//				}
//
//				@Override
//				public void gutterClosed() {
//
//				}
//			}
//		);

		return editor;
	}
 

开发者ID:antlr,
项目名称:intellij-plugin-v4,
代码行数:75,
代码来源:InputPanel.java

示例26: showTooltip

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public void showTooltip(@Nonnull Editor editor, @Nonnull Point p, @Nonnull String text, boolean alignToRight, @Nonnull TooltipGroup group) {
  TooltipRenderer tooltipRenderer = ((EditorMarkupModel)editor.getMarkupModel()).getErrorStripTooltipRendererProvider().calcTooltipRenderer(text);
  showTooltip(editor, p, tooltipRenderer, alignToRight, group);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:5,
代码来源:TooltipController.java

示例27: onContentChangedIn

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public void onContentChangedIn(EditorSource source) {
  myDiffUpdater.contentRemoved(source);
  final EditorEx editor = source.getEditor();
  if (myIsHorizontal && source.getSide() == FragmentSide.SIDE1 && editor != null) {
    editor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);
  }
  DiffSideView viewSide = getSideView(source.getSide());
  viewSide.setEditorSource(getProject(), source);
  Disposer.dispose(myScrollSupport);
  if (editor == null) {
    if (!myDisposed) {
      rediff();
    }
    return;
  }

  final MouseListener mouseListener = PopupHandler.installUnknownPopupHandler(editor.getContentComponent(), new MergeActionGroup(this, source.getSide()), ActionManager.getInstance());
  myDiffUpdater.contentAdded(source);
  editor.getSettings().setLineNumbersShown(true);
  editor.getSettings().setFoldingOutlineShown(false);
  editor.getFoldingModel().setFoldingEnabled(false);
  ((EditorMarkupModel)editor.getMarkupModel()).setErrorStripeVisible(true);

  Editor editor1 = getEditor(FragmentSide.SIDE1);
  Editor editor2 = getEditor(FragmentSide.SIDE2);
  if (editor1 != null && editor2 != null && myIsSyncScroll) {
    myScrollSupport.install(new EditingSides[]{this});
  }

  final VisibleAreaListener visibleAreaListener = mySplitter.getVisibleAreaListener();
  final ScrollingModel scrollingModel = editor.getScrollingModel();
  if (visibleAreaListener != null) {
    scrollingModel.addVisibleAreaListener(visibleAreaListener);
    scrollingModel.addVisibleAreaListener(myVisibleAreaListener);
  }
  myFontSizeSynchronizer.synchronize(editor);
  source.addDisposable(new Disposable() {
    public void dispose() {
      myFontSizeSynchronizer.stopSynchronize(editor);
    }
  });
  source.addDisposable(new Disposable() {
    public void dispose() {
      if (visibleAreaListener != null) {
        scrollingModel.removeVisibleAreaListener(visibleAreaListener);
        scrollingModel.removeVisibleAreaListener(myVisibleAreaListener);
      }
      editor.getContentComponent().removeMouseListener(mouseListener);
    }
  });
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:52,
代码来源:DiffPanelImpl.java

示例28: ApplyPatchViewer

点赞 2

import com.intellij.openapi.editor.ex.EditorMarkupModel; //导入依赖的package包/类
public ApplyPatchViewer(@Nonnull DiffContext context, @Nonnull ApplyPatchRequest request) {
  myProject = context.getProject();
  myContext = context;
  myPatchRequest = request;


  DocumentContent resultContent = request.getResultContent();
  DocumentContent patchContent = DiffContentFactory.getInstance().create(new DocumentImpl("", true), resultContent);

  myResultHolder = TextEditorHolder.create(myProject, resultContent);
  myPatchHolder = TextEditorHolder.create(myProject, patchContent);

  myResultEditor = myResultHolder.getEditor();
  myPatchEditor = myPatchHolder.getEditor();

  if (isReadOnly()) myResultEditor.setViewer(true);
  myPatchEditor.setViewer(true);

  DiffUtil.disableBlitting(myResultEditor);
  DiffUtil.disableBlitting(myPatchEditor);

  ((EditorMarkupModel)myResultEditor.getMarkupModel()).setErrorStripeVisible(false);
  myResultEditor.setVerticalScrollbarOrientation(EditorEx.VERTICAL_SCROLLBAR_LEFT);

  myPatchEditor.getGutterComponentEx().setForceShowRightFreePaintersArea(true);
  ((EditorMarkupModel)myPatchEditor.getMarkupModel()).setErrorStripeVisible(false);


  List<TextEditorHolder> holders = ContainerUtil.list(myResultHolder, myPatchHolder);
  List<EditorEx> editors = ContainerUtil.list(myResultEditor, myPatchEditor);
  JComponent resultTitle = DiffUtil.createTitle(myPatchRequest.getResultTitle());
  JComponent patchTitle = DiffUtil.createTitle(myPatchRequest.getPatchTitle());
  List<JComponent> titleComponents = DiffUtil.createSyncHeightComponents(ContainerUtil.list(resultTitle, patchTitle));

  myContentPanel = new TwosideContentPanel(holders, titleComponents);
  myPanel = new SimpleDiffPanel(myContentPanel, this, myContext);

  myModel = new MyModel(myProject, myResultEditor.getDocument());

  myFocusTrackerSupport = new FocusTrackerSupport.Twoside(holders);
  myFocusTrackerSupport.setCurrentSide(Side.LEFT);
  myPrevNextDifferenceIterable = new MyPrevNextDifferenceIterable();
  myStatusPanel = new MyStatusPanel();
  myFoldingModel = new MyFoldingModel(myResultEditor, this);


  new MyFocusOppositePaneAction().install(myPanel);
  new TextDiffViewerUtil.EditorActionsPopup(createEditorPopupActions()).install(editors);

  new TextDiffViewerUtil.EditorFontSizeSynchronizer(editors).install(this);

  myEditorSettingsAction = new SetEditorSettingsAction(getTextSettings(), editors);
  myEditorSettingsAction.applyDefaults();

  if (!isReadOnly()) {
    DiffUtil.registerAction(new ApplySelectedChangesAction(true), myPanel);
    DiffUtil.registerAction(new IgnoreSelectedChangesAction(true), myPanel);
  }

  ProxyUndoRedoAction.register(myProject, myResultEditor, myContentPanel);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:62,
代码来源:ApplyPatchViewer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)