@Override
 public void open() {
   // Open the repl in the output pane by default
   Mode m = WindowManager.getDefault().findMode("output");
   if (m != null) {
     m.dockInto(this);
   }
   super.open();
 }
  public void showTopComponent() {
    if (m_topComponent == null) {
      m_topComponent = getTopComponent();
      m_topComponent.open();
    }

    if (m_topComponent != null) {
      if (!m_topComponent.isOpened()) {
        m_topComponent = getTopComponent();
        m_topComponent.open();
      }

      m_topComponent.requestActive();

      // repeated on purpose to assert the display name
      m_topComponent.requestActive();

      m_topComponent.setDisplayName(m_name);
    }
  }
 private static void showTopComponent(int id, Exception exception) {
   String name = "exception" + id;
   TopComponent c = NbComponents.findTopComponentByNameAndClass(name, TopComponent.class);
   if (c == null) {
     c =
         new TopComponent() {
           @Override
           public int getPersistenceType() {
             return TopComponent.PERSISTENCE_NEVER;
           }
         };
     c.setName(name);
     c.setDisplayName(exception.getClass().getSimpleName());
     c.setLayout(new BorderLayout());
     c.add(ExceptionPanel.create(exception), BorderLayout.CENTER);
     c.open();
   }
   c.requestActive();
 }
  private void openAndCloseMembers(Perspective perspective) {
    // Close other perspective based on group name
    for (Perspective g : perspectives) {
      if (g != perspective) {
        TopComponentGroup tpg = WindowManager.getDefault().findTopComponentGroup(g.getName());
        if (tpg != null) {
          tpg.close();
        }
      }
    }

    // Open perspective
    TopComponentGroup tpg = WindowManager.getDefault().findTopComponentGroup(perspective.getName());
    if (tpg != null) {
      tpg.open();
    }

    // Close members
    for (TopComponent c : WindowManager.getDefault().getRegistry().getOpened()) {
      String pId = WindowManager.getDefault().findTopComponentID((TopComponent) c);
      for (PerspectiveMember perspectiveMember : members) {
        if (pId.equals(perspectiveMember.getTopComponentId())
            && !perspectiveMember.isMemberOf(perspective)) {
          boolean closed = c.close();
        }
      }
    }

    // Open members
    for (PerspectiveMember perspectiveMember : members) {
      if (perspectiveMember.isMemberOf(perspective)) {
        String pId = perspectiveMember.getTopComponentId();
        TopComponent c = WindowManager.getDefault().findTopComponent(pId);
        if (c != null && !c.isOpened()) {
          c.open();
        }
      }
    }
  }
 @Override
 public void actionPerformed(ActionEvent evt) {
   TopComponent win = PrintPreviewTopComponent.findInstance();
   win.open();
   win.requestActive();
 }
Beispiel #6
0
 @Override
 public void performAction() {
   TopComponent tc = WatchesView.findInstance();
   tc.open();
   tc.requestActive();
 }