Exemplo n.º 1
0
  /** Starts the tree from scratch taking into account new sort orders. */
  private void redoTreeView() {
    UIUtilities.invokeLater(
        () -> {
          ((DefaultTreeModel) tree.getModel()).setRoot(null);
          ((DefaultTreeModel) tree.getModel()).setRoot(new TreeViewNode(null, null));
          if (scroller != null) {
            scroller.unregister();
          }
          scroller = new TreeTreeScroller(swingEventBus, tree);

          for (WindowModel window : windowManager.getRootWindows()) {
            addWindow(null, windowFactory.getSwingWindow(window));
            final Collection<WindowModel> childWindows = windowManager.getChildren(window);
            for (WindowModel childWindow : childWindows) {
              addWindow(
                  nodes.get(windowFactory.getSwingWindow(window)),
                  windowFactory.getSwingWindow(childWindow));
            }
          }

          if (activeFrameManager.getActiveFrame() != null) {
            selectionChanged(new SwingWindowSelectedEvent(activeFrameManager.getActiveFrame()));
          }
        });
  }
Exemplo n.º 2
0
  @Override
  public void close() {
    int dccs = 0;
    for (WindowModel window : windowManager.getChildren(this)) {
      if (window instanceof TransferContainer && ((TransferContainer) window).getDCC().isActive()
          || window instanceof ChatContainer && ((ChatContainer) window).getDCC().isActive()) {
        dccs++;
      }
    }

    if (dccs > 0) {
      new StandardQuestionDialog(
              parentWindow,
              ModalityType.MODELESS,
              "Close confirmation",
              "Closing this window will cause all existing DCCs "
                  + "to terminate, are you sure you want to do this?",
              () -> {
                close();
                plugin.removeContainer();
              })
          .display();
    } else {
      super.close();
      plugin.removeContainer();
    }
  }