com.intellij.openapi.editor.Editor.isDisposed()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中com.intellij.openapi.editor.Editor.isDisposed()方法的一些代码示例,展示了Editor.isDisposed()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Editor.isDisposed()方法的具体详情如下:
包路径:com.intellij.openapi.editor.Editor
类名称:Editor
方法名:isDisposed

Editor.isDisposed介绍

暂无

代码示例

代码示例来源:origin: hsz/idea-gitignore

/** Disposes current preview {@link #editorPanel}. */
@Override
public void dispose() {
  if (!editorPanel.preview.isDisposed()) {
    EditorFactory.getInstance().releaseEditor(editorPanel.preview);
  }
}

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

private static void startTemplate(@NotNull Editor editor, @NotNull Template template, @NotNull Project project) {
 Runnable runnable = () -> {
  if (project.isDisposed() || editor.isDisposed()) return;
  CommandProcessor.getInstance().executeCommand(project, () ->
   TemplateManager.getInstance(project).startTemplate(editor, template, null), "Introduce function", null);
 };
 if (ApplicationManager.getApplication().isUnitTestMode()) {
  runnable.run();
 }
 else {
  ApplicationManager.getApplication().invokeLater(runnable);
 }
}

代码示例来源:origin: hsz/idea-gitignore

/** Disposes current preview {@link #commands}. */
  @Override
  public void dispose() {
    super.dispose();
    tree.getModel().removeTreeModelListener(treeModelListener);
    if (!commands.isDisposed()) {
      EditorFactory.getInstance().releaseEditor(commands);
    }
  }
}

代码示例来源:origin: JetBrains/ideavim

@Override
 public void run() {
  if (editor.isDisposed()) {
   return;
  }
  final List<KeyStroke> toKeys = mappingInfo.getToKeys();
  final VimExtensionHandler extensionHandler = mappingInfo.getExtensionHandler();
  final EditorDataContext currentContext = new EditorDataContext(editor);
  if (toKeys != null) {
   final boolean fromIsPrefix = isPrefix(mappingInfo.getFromKeys(), toKeys);
   boolean first = true;
   for (KeyStroke keyStroke : toKeys) {
    final boolean recursive = mappingInfo.isRecursive() && !(first && fromIsPrefix);
    handleKey(editor, keyStroke, currentContext, recursive);
    first = false;
   }
  }
  else if (extensionHandler != null) {
   final CommandProcessor processor = CommandProcessor.getInstance();
   processor.executeCommand(editor.getProject(),
                () -> extensionHandler.execute(editor, context),
                "Vim " + extensionHandler.getClass().getSimpleName(),
                null);
  }
  if (prevMappingInfo != null) {
   handleKey(editor, key, currentContext);
  }
 }
};

代码示例来源:origin: JetBrains/ideavim

commandState.startMappingTimer(actionEvent -> application.invokeLater(() -> {
 mappingKeys.clear();
 if (editor.isDisposed()) {
  return;

代码示例来源:origin: JetBrains/ideavim

private void updateLineNumbers(@NotNull Editor editor) {
 if (!EditorData.isFileEditor(editor)) {
  return;
 }
 final Options options = Options.getInstance();
 final boolean relativeLineNumber = options.isSet(Options.RELATIVE_NUMBER);
 final boolean lineNumber = options.isSet(Options.NUMBER);
 final EditorSettings settings = editor.getSettings();
 final boolean showEditorLineNumbers = (EditorData.isLineNumbersShown(editor) || lineNumber) && !relativeLineNumber;
 if (settings.isLineNumbersShown() ^ showEditorLineNumbers) {
  // Update line numbers later since it may be called from a caret listener
  // on the caret move and it may move the caret internally
  ApplicationManager.getApplication().invokeLater(() -> {
   if (editor.isDisposed()) return;
   settings.setLineNumbersShown(showEditorLineNumbers);
  });
 }
 if (relativeLineNumber) {
  final EditorGutter gutter = editor.getGutter();
  gutter.closeAllAnnotations();
  gutter.registerTextAnnotation(myLineNumbersGutterProvider);
 }
}

代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin

referenceRange.getEndOffset(),
() -> {
 if (file.isValid() && !editor.isDisposed()) {
  perform(packagesToImport, file, editor);

代码示例来源:origin: ballerina-platform/ballerina-lang

HintManager.getInstance().showQuestionHint(editor, message, referenceRange.getStartOffset(),
    referenceRange.getEndOffset(), () -> {
      if (ballerinaFile.isValid() && !editor.isDisposed()) {
        performImport(packagesToImport, ballerinaFile, editor);

代码示例来源:origin: t28hub/json2java4idea

@Override
protected void dispose() {
  if (jsonEditor != null && !jsonEditor.isDisposed()) {
    EditorFactory.getInstance().releaseEditor(jsonEditor);
  }
  super.dispose();
}

代码示例来源:origin: t28hub/json2java4idea

@Override
public void dispose() {
  Collections.list(styleGroup.getElements()).forEach(button -> button.removeActionListener(this));
  classNamePrefixField.getDocument().removeDocumentListener(this);
  classNameSuffixField.getDocument().removeDocumentListener(this);
  generatedAnnotationCheckBox.removeActionListener(this);
  suppressWarningsAnnotationCheckBox.removeActionListener(this);
  if (previewEditor == null || previewEditor.isDisposed()) {
    return;
  }
  EditorFactory.getInstance().releaseEditor(previewEditor);
}

代码示例来源:origin: neueda/jetbrains-plugin-graph-database-support

private void releaseFileSpecificEditor(VirtualFile oldFile) {
  if (fileSpecificParamEditor != null) {
    // set params in fileSpecificParamDocument.addDocumentListener() listener is a more universal but worse solution:
    // gets triggered immediately, debounce required
    FileUtil.setParams(oldFile, fileSpecificParamEditor.getDocument().getText());
    graphConsoleView.getFileSpecificParametersTab().remove(fileSpecificParamEditor.getComponent());
    if (!fileSpecificParamEditor.isDisposed()) {
      EditorFactory.getInstance().releaseEditor(fileSpecificParamEditor);
    }
  }
  fileSpecificParamEditor = null;
}

代码示例来源:origin: SonarSource/sonarlint-intellij

public void startBlinking() {
 Project project = myEditor.getProject();
 if (ApplicationManager.getApplication().isDisposed() || myEditor.isDisposed() || (project != null && project.isDisposed())) {
  return;
 }
 MarkupModel markupModel = myEditor.getMarkupModel();
 if (show) {
  for (Segment segment : myMarkers) {
   if (segment.getEndOffset() > myEditor.getDocument().getTextLength()) {
    continue;
   }
   RangeHighlighter highlighter = markupModel.addRangeHighlighter(segment.getStartOffset(), segment.getEndOffset(),
    HighlighterLayer.ADDITIONAL_SYNTAX, myAttributes,
    HighlighterTargetArea.EXACT_RANGE);
   myAddedHighlighters.add(highlighter);
  }
 } else {
  removeHighlights();
 }
 myBlinkingAlarm.cancelAllRequests();
 myBlinkingAlarm.addRequest(() -> {
  if (myTimeToLive > 0 || show) {
   myTimeToLive--;
   show = !show;
   startBlinking();
  }
 }, 400);
}

相关文章