Java Code Examples for consulo.disposer.Disposer

The following examples show how to use consulo.disposer.Disposer. These examples are extracted from open source projects. 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 Project: consulo   Source File: DuplexConsoleView.java    License: Apache License 2.0 6 votes vote down vote up
public DuplexConsoleView(@Nonnull S primaryConsoleView, @Nonnull T secondaryConsoleView, @Nullable String stateStorageKey) {
  super(new CardLayout());
  myPrimaryConsoleView = primaryConsoleView;
  mySecondaryConsoleView = secondaryConsoleView;
  myStateStorageKey = stateStorageKey;

  add(myPrimaryConsoleView.getComponent(), PRIMARY_CONSOLE_PANEL);
  add(mySecondaryConsoleView.getComponent(), SECONDARY_CONSOLE_PANEL);

  mySwitchConsoleAction = new SwitchDuplexConsoleViewAction();

  myPrimary = true;
  enableConsole(getStoredState());

  Disposer.register(this, myPrimaryConsoleView);
  Disposer.register(this, mySecondaryConsoleView);
}
 
Example 2
Source Project: consulo   Source File: DesktopTransactionGuardImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void runSyncTransaction(@Nonnull Transaction transaction) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (Disposer.isDisposed(transaction.parentDisposable)) return;

  boolean wasWritingAllowed = myWritingAllowed;
  myWritingAllowed = true;
  myCurrentTransaction = new TransactionIdImpl(myCurrentTransaction);

  try {
    transaction.runnable.run();
  }
  finally {
    Queue<Transaction> queue = getQueue(myCurrentTransaction.myParent);
    queue.addAll(myCurrentTransaction.myQueue);
    if (!queue.isEmpty()) {
      pollQueueLater();
    }

    myWritingAllowed = wasWritingAllowed;
    myCurrentTransaction.myFinished = true;
    myCurrentTransaction = myCurrentTransaction.myParent;
  }
}
 
Example 3
Source Project: consulo   Source File: FrameDiffTool.java    License: Apache License 2.0 6 votes vote down vote up
private boolean checkNoDifferenceAndNotify(DiffPanel diffPanel, DiffRequest data, final Window window, final boolean showMessage) {
  if (!diffPanel.hasDifferences() && !data.getHints().contains(HINT_ALLOW_NO_DIFFERENCES)) {
    DiffManagerImpl manager = (DiffManagerImpl) DiffManager.getInstance();
    if (!Comparing.equal(manager.getComparisonPolicy(), ComparisonPolicy.DEFAULT)) {
      ComparisonPolicy oldPolicy = manager.getComparisonPolicy();
      manager.setComparisonPolicy(ComparisonPolicy.DEFAULT);
      Disposable parentDisposable = Disposable.newDisposable();
      DiffPanel maybeDiffPanel = DiffManagerImpl.createDiffPanel(data, window, parentDisposable, this);
      manager.setComparisonPolicy(oldPolicy);

      boolean hasDiffs = maybeDiffPanel.hasDifferences();
      Disposer.dispose(parentDisposable);

      if (hasDiffs) return false;
    }

    if (! showMessage) {
      return true;
    }
    return !askForceOpenDiff(data);
  }
  return false;
}
 
Example 4
Source Project: consulo   Source File: CompletionProgressIndicator.java    License: Apache License 2.0 6 votes vote down vote up
private void finishCompletionProcess(boolean disposeOffsetMap) {
  cancel();

  ApplicationManager.getApplication().assertIsDispatchThread();
  Disposer.dispose(myQueue);
  LookupManager.getInstance(getProject()).removePropertyChangeListener(myLookupManagerListener);

  CompletionServiceImpl.assertPhase(CompletionPhase.BgCalculation.class, CompletionPhase.ItemsCalculated.class, CompletionPhase.Synchronous.class, CompletionPhase.CommittingDocuments.class);

  CompletionProgressIndicator currentCompletion = CompletionServiceImpl.getCurrentCompletionProgressIndicator();
  LOG.assertTrue(currentCompletion == this, currentCompletion + "!=" + this);

  CompletionPhase oldPhase = CompletionServiceImpl.getCompletionPhase();
  if (oldPhase instanceof CompletionPhase.CommittingDocuments) {
    LOG.assertTrue(((CompletionPhase.CommittingDocuments)oldPhase).indicator != null, oldPhase);
    ((CompletionPhase.CommittingDocuments)oldPhase).replaced = true;
  }
  CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion);
  if (disposeOffsetMap) {
    disposeIndicator();
  }
}
 
Example 5
Source Project: consulo   Source File: ParameterInfoController.java    License: Apache License 2.0 6 votes vote down vote up
public static ParameterInfoController findControllerAtOffset(Editor editor, int offset) {
  List<ParameterInfoController> allControllers = getAllControllers(editor);
  for (int i = 0; i < allControllers.size(); ++i) {
    ParameterInfoController controller = allControllers.get(i);

    int lbraceOffset = controller.myLbraceMarker.getStartOffset();
    if (lbraceOffset == offset) {
      if (controller.myKeepOnHintHidden || controller.myHint.isVisible() || ApplicationManager.getApplication().isHeadlessEnvironment()) return controller;
      Disposer.dispose(controller);
      //noinspection AssignmentToForLoopParameter
      --i;
    }
  }

  return null;
}
 
Example 6
Source Project: consulo   Source File: BackgroundTaskUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static <T> T runUnderDisposeAwareIndicator(@Nonnull Disposable parent, @Nonnull Computable<T> task) {
  ProgressIndicator indicator = new EmptyProgressIndicator(ModalityState.defaultModalityState());
  indicator.start();

  Disposable disposable = () -> {
    if (indicator.isRunning()) indicator.cancel();
  };

  if (!registerIfParentNotDisposed(parent, disposable)) {
    indicator.cancel();
    throw new ProcessCanceledException();
  }

  try {
    return ProgressManager.getInstance().runProcess(task, indicator);
  }
  finally {
    Disposer.dispose(disposable);
  }
}
 
Example 7
Source Project: consulo   Source File: RunContentManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void dispose() {
  if (myContent == null) return;

  final Content content = myContent;
  try {
    RunContentDescriptor descriptor = getRunContentDescriptorByContent(content);
    getSyncPublisher().contentRemoved(descriptor, myExecutor);
    if (descriptor != null) {
      Disposer.dispose(descriptor);
    }
  }
  finally {
    content.getManager().removeContentManagerListener(this);
    ProjectManager.getInstance().removeProjectManagerListener(this);
    myCloseRegisterVetoRemover.dispose();
    content.release(); // don't invoke myContent.release() because myContent becomes null after destroyProcess()
    myContent = null;
  }
}
 
Example 8
Source Project: consulo   Source File: DesktopToolWindowImpl.java    License: Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
protected void init(boolean canCloseContent, @Nullable Object component) {
  final ContentFactory contentFactory = ContentFactory.getInstance();
  myContentUI = new DesktopToolWindowContentUi(this);
  ContentManager contentManager = myContentManager = contentFactory.createContentManager(myContentUI, canCloseContent, myToolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createContent((JComponent)component, "", false);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);
  }

  myComponent = contentManager.getComponent();

  DesktopInternalDecorator.installFocusTraversalPolicy(myComponent, new LayoutFocusTraversalPolicy());

  UiNotifyConnector notifyConnector = new UiNotifyConnector(myComponent, new Activatable() {
    @Override
    public void showNotify() {
      myShowing.onReady();
    }
  });
  Disposer.register(contentManager, notifyConnector);
}
 
Example 9
Source Project: consulo   Source File: MacUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static void adjustFocusTraversal(@Nonnull Disposable disposable) {
  if (!SystemInfo.isMacOSSnowLeopard) return;
  final AWTEventListener listener = new AWTEventListener() {
    @Override
    public void eventDispatched(AWTEvent event) {
      if (event instanceof KeyEvent && ((KeyEvent)event).getKeyCode() == KeyEvent.VK_TAB && (!(event.getSource() instanceof JTextComponent)) && (!(event.getSource() instanceof JList)) && !isFullKeyboardAccessEnabled())
        ((KeyEvent)event).consume();
    }
  };
  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      Toolkit.getDefaultToolkit().removeAWTEventListener(listener);
    }
  });
  Toolkit.getDefaultToolkit().addAWTEventListener(listener, AWTEvent.KEY_EVENT_MASK);
}
 
Example 10
Source Project: consulo   Source File: LazyUiDisposable.java    License: Apache License 2.0 6 votes vote down vote up
private static AsyncResult<Disposable> findDisposable(Disposable defaultValue, final Key<? extends Disposable> key) {
  if (defaultValue == null) {
    if (ApplicationManager.getApplication() != null) {
      final AsyncResult<Disposable> result = AsyncResult.undefined();
      DataManager.getInstance().getDataContextFromFocus().doWhenDone(context -> {
        Disposable disposable = context.getData(key);
        if (disposable == null) {
          disposable = Disposer.get("ui");
        }
        result.setDone(disposable);
      });
      return result;
    }
    else {
      return null;
    }
  }
  else {
    return AsyncResult.done(defaultValue);
  }
}
 
Example 11
Source Project: consulo   Source File: GroupTreeNode.java    License: Apache License 2.0 6 votes vote down vote up
private void addFiles(@Nonnull AbstractTreeNode parentNode,
                      @Nonnull List<File> roots,
                      @Nonnull final Collection<File> files,
                      @Nonnull GroupByPackages groupByPackages,
                      String parentPath) {
  Collections.sort(roots, new Comparator<File>() {
    @Override
    public int compare(File file1, File file2) {
      boolean containsFile1 = files.contains(file1);
      boolean containsFile2 = files.contains(file2);
      if (containsFile1 == containsFile2) {
        return file1.getAbsolutePath().compareToIgnoreCase(file2.getAbsolutePath());
      }
      return containsFile1 ? 1 : -1;
    }
  });

  for (final File root : roots) {
    FileOrDirectoryTreeNode child = files.contains(root)
                                    ? new FileTreeNode(root.getAbsolutePath(), myInvalidAttributes, myProject, parentPath)
                                    : new DirectoryTreeNode(root.getAbsolutePath(), myProject, parentPath);
    Disposer.register((Disposable)parentNode, child);
    parentNode.add(child);
    addFiles(child, groupByPackages.getChildren(root), files, groupByPackages, child.getFilePath());
  }
}
 
Example 12
Source Project: consulo   Source File: ContentImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void dispose() {
  if (myShouldDisposeContent && myComponent instanceof Disposable) {
    Disposer.dispose((Disposable)myComponent);
  }

  myComponent = null;
  myFocusRequest = null;
  myManager = null;

  clearUserData();
  if (myDisposer != null) {
    Disposer.dispose(myDisposer);
    myDisposer = null;
  }
}
 
Example 13
Source Project: consulo   Source File: TreeInplaceEditor.java    License: Apache License 2.0 6 votes vote down vote up
private void hide() {
  if (!isShown()) {
    return;
  }
  myInplaceEditorComponent = null;
  onHidden();
  for (Runnable action : myRemoveActions) {
    action.run();
  }
  myRemoveActions.clear();

  Disposer.dispose(myDisposable);

  final JTree tree = getTree();
  tree.repaint();
  IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(tree);
}
 
Example 14
Source Project: consulo   Source File: XDebuggerInlayUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static void createInlay(@Nonnull Project project, @Nonnull VirtualFile file, int offset, String inlayText) {
  UIUtil.invokeLaterIfNeeded(() -> {
    FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(file);
    if (editor instanceof TextEditor) {
      Editor e = ((TextEditor)editor).getEditor();
      CharSequence text = e.getDocument().getImmutableCharSequence();

      int insertOffset = offset;
      while (insertOffset < text.length() && Character.isJavaIdentifierPart(text.charAt(insertOffset))) insertOffset++;

      List<Inlay> existing = e.getInlayModel().getInlineElementsInRange(insertOffset, insertOffset);
      for (Inlay inlay : existing) {
        if (inlay.getRenderer() instanceof MyRenderer) {
          Disposer.dispose(inlay);
        }
      }

      e.getInlayModel().addInlineElement(insertOffset, new MyRenderer(inlayText));
    }
  });
}
 
Example 15
Source Project: consulo   Source File: DiffManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
static DiffPanel createDiffPanel(DiffRequest data, Window window, @Nonnull Disposable parentDisposable, FrameDiffTool tool) {
  DiffPanel diffPanel = null;
  try {
    diffPanel = DiffManager.getInstance().createDiffPanel(window, data.getProject(), parentDisposable, tool);
    int contentCount = data.getContents().length;
    LOG.assertTrue(contentCount == 2, String.valueOf(contentCount));
    LOG.assertTrue(data.getContentTitles().length == contentCount);
    diffPanel.setDiffRequest(data);
    return diffPanel;
  }
  catch (RuntimeException e) {
    if (diffPanel != null) {
      Disposer.dispose(diffPanel);
    }
    throw e;
  }
}
 
Example 16
Source Project: consulo   Source File: InfoAndProgressPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void removeProgress(@Nonnull MyInlineProgressIndicator progress) {
  synchronized (myOriginals) {
    if (!myInline2Original.containsKey(progress)) return; // already disposed

    final boolean last = myOriginals.size() == 1;
    final boolean beforeLast = myOriginals.size() == 2;

    myPopup.removeIndicator(progress);

    final ProgressIndicatorEx original = removeFromMaps(progress);
    if (myOriginals.contains(original)) {
      Disposer.dispose(progress);
      return;
    }

    if (last) {
      restoreEmptyStatus();
      if (myShouldClosePopupAndOnProcessFinish) {
        hideProcessPopup();
      }
    }
    else {
      if (myPopup.isShowing() || myOriginals.size() > 1) {
        buildInProcessCount();
      }
      else if (beforeLast) {
        buildInInlineIndicator(createInlineDelegate(myInfos.get(0), myOriginals.get(0), true));
      }
      else {
        restoreEmptyStatus();
      }
    }

    runQuery();
  }
  Disposer.dispose(progress);

}
 
Example 17
Source Project: consulo   Source File: LocalHistoryFacade.java    License: Apache License 2.0 5 votes vote down vote up
public void addListener(@Nonnull final Listener l, @javax.annotation.Nullable Disposable parent) {
  myListeners.add(l);

  if (parent != null) {
    Disposer.register(parent, new Disposable() {
      @Override
      public void dispose() {
        myListeners.remove(l);
      }
    });
  }
}
 
Example 18
Source Project: consulo   Source File: UpdateInfoTree.java    License: Apache License 2.0 5 votes vote down vote up
public void dispose() {
  Disposer.dispose(myRoot);
  if (myFileStatusListener != null) {
    myFileStatusManager.removeFileStatusListener(myFileStatusListener);
    myFileStatusListener = null;
  }
}
 
Example 19
Source Project: consulo   Source File: UsageNodeTreeBuilderTest.java    License: Apache License 2.0 5 votes vote down vote up
private GroupNode buildUsageTree(int[] indices, UsageGroupingRule[] rules) {
  Usage[] usages = new Usage[indices.length];
  for (int i = 0; i < usages.length; i++) {
    usages[i] = createUsage(indices[i]);
  }

  UsageViewPresentation presentation = new UsageViewPresentation();
  presentation.setUsagesString("searching for mock usages");

  ExtensionPoint<UsageGroupingRuleProvider> point = Application.get().getExtensionPoint(UsageGroupingRuleProvider.EP_NAME);
  UsageGroupingRuleProvider provider = new UsageGroupingRuleProvider() {
    @Nonnull
    @Override
    public UsageGroupingRule[] getActiveRules(Project project) {
      return rules;
    }

    @Nonnull
    @Override
    public AnAction[] createGroupingActions(UsageView view) {
      return AnAction.EMPTY_ARRAY;
    }
  };
 // point.registerExtension(provider);
  try {
    UsageViewImpl usageView = new UsageViewImpl(getProject(), presentation, UsageTarget.EMPTY_ARRAY, null);
    Disposer.register(getTestRootDisposable(), usageView);
    for (Usage usage : usages) {
      usageView.appendUsage(usage);
    }
    UIUtil.dispatchAllInvocationEvents();

    return usageView.getRoot();
  }
  finally {
   // point.unregisterExtension(provider);
  }
}
 
Example 20
Source Project: consulo   Source File: UIWindowOverVaadinUI.java    License: Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void close() {
  myUI.close();

  Disposer.dispose(this);
}
 
Example 21
Source Project: consulo   Source File: VcsLogProgress.java    License: Apache License 2.0 5 votes vote down vote up
public void addProgressIndicatorListener(@Nonnull ProgressListener listener, @Nullable Disposable parentDisposable) {
  synchronized (myLock) {
    myListeners.add(listener);
    if (parentDisposable != null) {
      Disposer.register(parentDisposable, () -> removeProgressIndicatorListener(listener));
    }
    if (isRunning()) ApplicationManager.getApplication().invokeLater(listener::progressStarted);
  }
}
 
Example 22
Source Project: consulo   Source File: Notifications.java    License: Apache License 2.0 5 votes vote down vote up
public static void notifyAndHide(@Nonnull final Notification notification, @Nullable Project project) {
  notify(notification);
  Alarm alarm = new Alarm(project == null ? Application.get() : project);
  alarm.addRequest(() -> {
    notification.expire();
    Disposer.dispose(alarm);
  }, 5000);
}
 
Example 23
Source Project: consulo   Source File: DiffManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public DiffRequestPanel createRequestPanel(@javax.annotation.Nullable Project project, @Nonnull Disposable parent, @Nullable Window window) {
  DiffRequestPanelImpl panel = new DiffRequestPanelImpl(project, window);
  Disposer.register(parent, panel);
  return panel;
}
 
Example 24
Source Project: consulo   Source File: RunContentExecutor.java    License: Apache License 2.0 5 votes vote down vote up
private ConsoleView createConsole(@Nonnull Project project) {
  TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
  consoleBuilder.filters(myFilterList);
  final ConsoleView console = consoleBuilder.getConsole();

  if (myHelpId != null) {
    console.setHelpId(myHelpId);
  }
  Executor executor = DefaultRunExecutor.getRunExecutorInstance();
  DefaultActionGroup actions = new DefaultActionGroup();

  final JComponent consolePanel = createConsolePanel(console, actions);
  RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle);

  Disposer.register(descriptor, this);
  Disposer.register(descriptor, console);

  actions.add(new RerunAction(consolePanel));
  actions.add(new StopAction());
  actions.add(new CloseAction(executor, descriptor, myProject));

  ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, descriptor);

  if (myActivateToolWindow) {
    activateToolWindow();
  }

  return console;
}
 
Example 25
Source Project: consulo   Source File: DocumentationComponent.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
public static DocumentationComponent createAndFetch(@Nonnull Project project, @Nonnull PsiElement element, @Nonnull Disposable disposable) {
  DocumentationManager manager = DocumentationManager.getInstance(project);
  DocumentationComponent component = new DocumentationComponent(manager);
  Disposer.register(disposable, component);
  manager.fetchDocInfo(element, component);
  return component;
}
 
Example 26
public FileOrDirectoryDependencyTabContext(Disposable parent, ClasspathPanel panel, StructureConfigurableContext context) {
  super(panel, context);

  myLibraryTypes = new HashMap<LibraryRootsComponentDescriptor, LibraryType>();
  myDefaultDescriptor = new DefaultLibraryRootsComponentDescriptor();

  for (LibraryType<?> libraryType : LibraryEditingUtil.getSuitableTypes(myClasspathPanel)) {
    LibraryRootsComponentDescriptor descriptor = null;
    if (libraryType != null) {
      descriptor = libraryType.createLibraryRootsComponentDescriptor();
    }
    if (descriptor == null) {
      descriptor = myDefaultDescriptor;
    }
    if (!myLibraryTypes.containsKey(descriptor)) {
      myLibraryTypes.put(descriptor, libraryType);
    }
  }

  Module module = myClasspathPanel.getRootModel().getModule();

  myFileChooserDescriptor = createFileChooserDescriptor();
  myFileSystemTree = FileSystemTreeFactory.getInstance().createFileSystemTree(module.getProject(), myFileChooserDescriptor);
  Disposer.register(parent, myFileSystemTree);
  myFileSystemTree.showHiddens(true);
  final VirtualFile dirForSelect = ObjectUtil.chooseNotNull(module.getModuleDir(), module.getProject().getBaseDir());
  if(dirForSelect != null) {
    myFileSystemTree.select(dirForSelect, new Runnable() {
      @Override
      public void run() {
        myFileSystemTree.expand(dirForSelect, null);
      }
    });
  }
}
 
Example 27
Source Project: consulo   Source File: UsageViewTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testUsageViewHandlesDocumentChange() throws Exception {
  PsiFile psiFile = createFile("X.java", "public class X{ int xxx; } //comment");
  Usage usage = createUsage(psiFile, psiFile.getText().indexOf("xxx"));

  UsageView usageView = UsageViewManager.getInstance(getProject()).createUsageView(UsageTarget.EMPTY_ARRAY, new Usage[]{usage}, new UsageViewPresentation(), null);
  Disposer.register(getTestRootDisposable(), usageView);

  PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject());
  Document document = documentManager.getDocument(psiFile);
  document.insertString(0, "/* sdfsdfsd */");
  documentManager.commitAllDocuments();
  int navigationOffset = ((UsageInfo2UsageAdapter)usage).getUsageInfo().getNavigationOffset();
  assertEquals(psiFile.getText().indexOf("xxx"), navigationOffset);
}
 
Example 28
Source Project: consulo   Source File: DockablePopupManager.java    License: Apache License 2.0 5 votes vote down vote up
public void restorePopupBehavior() {
  if (myToolWindow != null) {
    PropertiesComponent.getInstance().setValue(getShowInToolWindowProperty(), Boolean.FALSE.toString());
    ToolWindowManagerEx toolWindowManagerEx = ToolWindowManagerEx.getInstanceEx(myProject);
    toolWindowManagerEx.hideToolWindow(getToolwindowId(), false);
    toolWindowManagerEx.unregisterToolWindow(getToolwindowId());
    Disposer.dispose(myToolWindow.getContentManager());
    myToolWindow = null;
    restartAutoUpdate(false);
  }
}
 
Example 29
Source Project: consulo   Source File: ParameterInfoController.java    License: Apache License 2.0 5 votes vote down vote up
private void updateWhenAllCommitted() {
  if (!myDisposed && !myProject.isDisposed()) {
    PsiDocumentManager.getInstance(myProject).performLaterWhenAllCommitted(() -> {
      try {
        DumbService.getInstance(myProject).withAlternativeResolveEnabled(this::updateComponent);
      }
      catch (IndexNotReadyException e) {
        LOG.info(e);
        Disposer.dispose(this);
      }
    });
  }
}
 
Example 30
Source Project: consulo   Source File: ModulesConfigurator.java    License: Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
public void disposeUIResources() {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      for (final ModuleEditor moduleEditor : myModuleEditors) {
        Disposer.dispose(moduleEditor);
      }
      myModuleEditors.clear();

      myModuleModel.dispose();
    }
  });

}