Exemplo n.º 1
0
 /**
  * Update the visibility of the CASA window group
  *
  * @param preferredId
  */
 public static void updateGroupVisibility(String preferredId) {
   WindowManager wm = WindowManager.getDefault();
   TopComponentGroup group = wm.findTopComponentGroup("casa_ui"); // NOI18N
   if (group == null) {
     return; // group not found (should not happen)
   }
   //
   boolean isDesignViewSelected = false;
   for (Mode mode : wm.getModes()) {
     TopComponent selected = mode.getSelectedTopComponent();
     if (selected != null) {
       MultiViewHandler mvh = MultiViews.findMultiViewHandler(selected);
       if (mvh != null) {
         MultiViewPerspective mvp = mvh.getSelectedPerspective();
         if (mvp != null) {
           String id = mvp.preferredID();
           if (preferredId.equals(id)) {
             isDesignViewSelected = true;
             break;
           }
         }
       }
     }
   }
   synchronized (groupVisible) {
     if (isDesignViewSelected && !groupVisible) {
       group.open();
       groupVisible = Boolean.TRUE;
     } else if (!isDesignViewSelected && groupVisible) {
       group.close();
       groupVisible = Boolean.FALSE;
     }
   }
 }
Exemplo n.º 2
0
 @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();
 }