Java Code Examples for com.intellij.openapi.fileEditor.TextEditor#isValid()

The following examples show how to use com.intellij.openapi.fileEditor.TextEditor#isValid() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlutterWidgetPerf.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void harvestInvalidEditors(Set<TextEditor> newEditors) {
  final Iterator<TextEditor> editors = editorDecorations.keySet().iterator();

  while (editors.hasNext()) {
    final TextEditor editor = editors.next();
    if (!editor.isValid() || (newEditors != null && !newEditors.contains(editor))) {
      final EditorPerfModel editorPerfDecorations = editorDecorations.get(editor);
      editors.remove();
      Disposer.dispose(editorPerfDecorations);
    }
  }
}
 
Example 2
Source File: FlutterWidgetPerf.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void harvestInvalidEditors(Set<TextEditor> newEditors) {
  final Iterator<TextEditor> editors = editorDecorations.keySet().iterator();

  while (editors.hasNext()) {
    final TextEditor editor = editors.next();
    if (!editor.isValid() || (newEditors != null && !newEditors.contains(editor))) {
      final EditorPerfModel editorPerfDecorations = editorDecorations.get(editor);
      editors.remove();
      Disposer.dispose(editorPerfDecorations);
    }
  }
}
 
Example 3
Source File: BreadcrumbsInitializingActivity.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean isSuitable(@Nonnull TextEditor editor, @Nonnull VirtualFile file) {
  if (file instanceof HttpVirtualFile || !editor.isValid()) {
    return false;
  }

  for (FileBreadcrumbsCollector collector : FileBreadcrumbsCollector.EP_NAME.getExtensionList(editor.getEditor().getProject())) {
    if (collector.handlesFile(file) && collector.isShownForFile(editor.getEditor(), file)) {
      return true;
    }
  }
  return false;
}
 
Example 4
Source File: FlutterWidgetPerf.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void showReports(Multimap<String, TextEditor> editorForPath) {
  // True if any of the EditorPerfDecorations want to animate.
  boolean animate = false;

  synchronized (this) {
    for (String path : editorForPath.keySet()) {
      for (TextEditor fileEditor : editorForPath.get(path)) {
        if (!fileEditor.isValid()) return;
        final EditorPerfModel editorDecoration = editorDecorations.get(fileEditor);
        if (editorDecoration != null) {
          if (!perfProvider.shouldDisplayPerfStats(fileEditor)) {
            editorDecoration.clear();
            continue;
          }
          final FilePerfInfo fileStats = buildSummaryStats(fileEditor);
          editorDecoration.setPerfInfo(fileStats);
          if (editorDecoration.isAnimationActive()) {
            animate = true;
          }
        }
      }
    }
  }

  if (!animate) {
    for (PerfModel listener : perfListeners) {
      if (listener.isAnimationActive()) {
        animate = true;
        break;
      }
    }
  }

  if (animate != uiAnimationTimer.isRunning()) {
    if (animate) {
      uiAnimationTimer.start();
    }
    else {
      uiAnimationTimer.stop();
    }
  }
  performRequestFinish();
}
 
Example 5
Source File: FlutterWidgetPerf.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void showReports(Multimap<String, TextEditor> editorForPath) {
  // True if any of the EditorPerfDecorations want to animate.
  boolean animate = false;

  synchronized (this) {
    for (String path : editorForPath.keySet()) {
      for (TextEditor fileEditor : editorForPath.get(path)) {
        if (!fileEditor.isValid()) return;
        final EditorPerfModel editorDecoration = editorDecorations.get(fileEditor);
        if (editorDecoration != null) {
          if (!perfProvider.shouldDisplayPerfStats(fileEditor)) {
            editorDecoration.clear();
            continue;
          }
          final FilePerfInfo fileStats = buildSummaryStats(fileEditor);
          editorDecoration.setPerfInfo(fileStats);
          if (editorDecoration.isAnimationActive()) {
            animate = true;
          }
        }
      }
    }
  }

  if (!animate) {
    for (PerfModel listener : perfListeners) {
      if (listener.isAnimationActive()) {
        animate = true;
        break;
      }
    }
  }

  if (animate != uiAnimationTimer.isRunning()) {
    if (animate) {
      uiAnimationTimer.start();
    }
    else {
      uiAnimationTimer.stop();
    }
  }
  performRequestFinish();
}