@Messages({
   "PROGRESS_checking_for_upgrade=Checking for old harnesses to upgrade",
   "CTL_Close=&Close",
   "CTL_NbPlatformManager_Title=NetBeans Platform Manager"
 })
 public static void showCustomizer() {
   final AtomicBoolean canceled = new AtomicBoolean();
   ProgressUtils.runOffEventDispatchThread(
       new Runnable() { // #207451
         @Override
         public void run() {
           HarnessUpgrader.checkForUpgrade();
         }
       },
       PROGRESS_checking_for_upgrade(),
       canceled,
       false);
   NbPlatformCustomizer customizer = new NbPlatformCustomizer();
   JButton closeButton = new JButton();
   Mnemonics.setLocalizedText(closeButton, CTL_Close());
   DialogDescriptor descriptor =
       new DialogDescriptor(
           customizer,
           CTL_NbPlatformManager_Title(),
           true,
           new Object[] {closeButton},
           closeButton,
           DialogDescriptor.DEFAULT_ALIGN,
           new HelpCtx("org.netbeans.modules.apisupport.project.ui.platform.NbPlatformCustomizer"),
           null);
   Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
   dlg.setVisible(true);
   dlg.dispose();
 }
예제 #2
0
 public void dispose(boolean toDispose) {
   if (toDispose) {
     super.dispose();
     frame.toFront();
   }
   if (client != null) client.dialogDismissed(this);
 }
예제 #3
0
 @Override
 public void closeTextPanel() {
   // Confirm save before open another file
   if (this.isContentChanged()) {
     int ans =
         JOptionPane.showConfirmDialog(
             this,
             "The contents of "
                 + CurrentFileName
                 + " has been modified. \nDo you want to save the changes?",
             "Save to file?",
             JOptionPane.YES_NO_CANCEL_OPTION);
     if (ans == JOptionPane.CANCEL_OPTION) {
       return;
     } else if (ans == JOptionPane.YES_OPTION) {
       this.cmdSaveActionPerformed(null);
     }
   }
   if (ContainerComponent instanceof Frame) {
     ((Frame) ContainerComponent).dispose();
   } else if (ContainerComponent instanceof Dialog) {
     ((Dialog) ContainerComponent).dispose();
   } else if (ContainerComponent instanceof JTabbedPane && TabId > 0) {
     // ((JTabbedPane)ContainerComponent).remove(this.TabId);
     ((JTabbedPane) ContainerComponent).remove(this);
     TabId = 0;
   }
 }
예제 #4
0
  protected synchronized void disposeGotoDialog() {
    if (gotoDialog != null) {
      EditorState.put(BOUNDS_KEY, gotoDialog.getBounds());
      gotoDialog.dispose();
      Utilities.returnFocus();
    }

    gotoDialog = null;
  }
 public @Override void windowClosing(WindowEvent e) {
   // Dispose the dialog otherwsie the {@link WindowAdapter#windowClosed}
   // may not be called
   Dialog dialog = project2Dialog.get(project);
   if (dialog != null) {
     dialog.setVisible(false);
     dialog.dispose();
   }
 }
    // Listening to OK button ----------------------------------------------------------
    public void actionPerformed(ActionEvent e) {
      // Store the properties into project
      uiProperties.save();

      // Close & dispose the the dialog
      Dialog dialog = project2Dialog.get(project);
      if (dialog != null) {
        dialog.setVisible(false);
        dialog.dispose();
      }
    }
예제 #7
0
 private void closeAll() {
   if (dialog != null) {
     dialog.dispose();
   }
   if (parentDialog != null) {
     parentDialog.dispose();
   }
   if (parentFrame != null) {
     parentFrame.dispose();
   }
 }
예제 #8
0
  // implementation of java.awt.event.ActionListener interface
  public void actionPerformed(JCActionEvent e) {
    if (e.getSource() == ok || e.getSource() == cancel) {
      if (e.getSource() == ok) {
        accept = true;
      } else {
        accept = false;
      }

      dialog.dispose();
    } else {
      JCButton b = (JCButton) e.getSource();
      Color c = b.getBackground();

      updateColor(c, e.getSource());
    }
  }
예제 #9
0
 @Override
 public void actionPerformed(java.awt.event.ActionEvent e) {
   try {
     PropertyEditor propEd = property.getPropertyEditor();
     propEd.setValue(property.getValue());
     final Component custEditor = propEd.getCustomEditor();
     Object[] options = buttons();
     DialogDescriptor descriptor =
         new DialogDescriptor(
             custEditor,
             (String) getValue(Action.NAME),
             true,
             options,
             DialogDescriptor.CANCEL_OPTION,
             DialogDescriptor.DEFAULT_ALIGN,
             HelpCtx.DEFAULT_HELP,
             (ActionEvent e1) -> {
               try {
                 String action = e1.getActionCommand();
                 switch (action) {
                   case OK_COMMAND:
                     Object value = property.getPropertyEditor().getValue();
                     property.setValue(value);
                     break;
                   case RESTORE_COMMAND:
                     property.restoreDefaultValue();
                     break;
                 }
                 dialog.dispose();
               } catch (Exception ex) {
                 NotifyDescriptor descriptor2 =
                     new NotifyDescriptor.Message(
                         NbBundle.getMessage(PropertyAction.class, "MSG_InvalidValue")); // NOI18N
                 DialogDisplayer.getDefault().notify(descriptor2);
               }
             });
     descriptor.setClosingOptions(new Object[0]);
     dialog = DialogDisplayer.getDefault().createDialog(descriptor);
     dialog.setVisible(true);
     dialog = null;
   } catch (Exception ex) {
     ErrorManager.getDefault().notify(ex);
   }
 }
예제 #10
0
    /** Handles button events */
    public void actionPerformed(ActionEvent e) {

      // only chooseMainClassButton can be performed

      final MainClassChooser panel =
          new MainClassChooser(sourceRoots.getRoots(), null, mainClassTextField.getText());
      Object[] options = new Object[] {okButton, DialogDescriptor.CANCEL_OPTION};
      panel.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
              if (e.getSource() instanceof MouseEvent
                  && MouseUtils.isDoubleClick(((MouseEvent) e.getSource()))) {
                // click button and finish the dialog with selected class
                okButton.doClick();
              } else {
                okButton.setEnabled(panel.getSelectedMainClass() != null);
              }
            }
          });
      okButton.setEnabled(false);
      DialogDescriptor desc =
          new DialogDescriptor(
              panel,
              NbBundle.getMessage(CustomizerRun.class, "LBL_ChooseMainClass_Title"), // NOI18N
              true,
              options,
              options[0],
              DialogDescriptor.BOTTOM_ALIGN,
              null,
              null);
      // desc.setMessageType (DialogDescriptor.INFORMATION_MESSAGE);
      Dialog dlg = DialogDisplayer.getDefault().createDialog(desc);
      dlg.setVisible(true);
      if (desc.getValue() == options[0]) {
        mainClassTextField.setText(panel.getSelectedMainClass());
      }
      dlg.dispose();
    }
예제 #11
0
  public static int crossOver(int version, JoConnection conn, Config config) throws Exception {
    Dialog dlg = null;
    try {
      if (version < 1002) {
        // ----------------------------------------------------
        //  New Columns GamePlayer.Color and GamePlayer.Result
        // ----------------------------------------------------

        dlg =
            JoDialog.createMessageDialog(
                "Database Update",
                "jose will now update the database structure.\n"
                    + "This may take up to some minutes.",
                false);
        dlg.show();
        dlg.paint(dlg.getGraphics());

        Setup setup = new Setup(config, "MAIN", conn);
        /*
        				setup.addColumn("GamePlayer","Color",3);
        				setup.addColumn("GamePlayer","Result",4);
        /*
        					alter table gameplayer
        					modify column PId integer not null,
        					add column Color tinyint not null,
        					add index GamePlayer_3 (Color),
        					add column Result tinyint not null,
        					add index GamePlayer_4 (Result)
        * /
        				//  fill in values
        				String upd1 =
        				        "UPDATE GamePlayer, Game" +
        				        " SET GamePlayer.Color = 1, GamePlayer.Result = Game.Result" +
        				        " WHERE GamePlayer.GId = Game.Id" +
        				        "   AND GamePlayer.PId = Game.WhiteId";
        				/** Color = 1 = White
        				 *  Result = Game.Result (from white's perspective)
        				 * /
        				conn.executeUpdate(upd1);

        				String upd2 =
        				        "UPDATE GamePlayer, Game" +
        				        " SET GamePlayer.Result = CASE WHEN Game.Result < 0 THEN Game.Result ELSE 2-Game.Result END" +
        				        " WHERE GamePlayer.GId = Game.Id" +
        				        "   AND GamePlayer.PId = Game.BlackId";
        				/** Color = 0 = Black
        				 *  Result = 2-Game.Result (from black's perspective)
        				 * /
        				conn.executeUpdate(upd2);
        */
        System.err.print("[create GamePlayer");
        try {
          setup.dropTable("GamePlayer");
        } catch (Exception e) {
          Application.error(e);
        }

        setup.createTable(null, setup.getTable("GamePlayer"), null, true);
        JoConnection.getAdapter().disableConstraints("GamePlayer", conn);

        String ins =
            "INSERT INTO GamePlayer"
                + " SELECT Id, WhiteId, 1, Result FROM Game "
                + " UNION"
                + " SELECT Id, BlackId, 0, CASE WHEN Result<0 THEN Result ELSE 2-Result END FROM Game";

        conn.executeUpdate(ins);
        JoConnection.getAdapter().enableConstraints("GamePlayer", conn);
        System.err.println("]");

        Setup.setTableVersion(conn, "MAIN", "GamePlayer", 102);
        Setup.setSchemaVersion(conn, "MAIN", version = 1002);
      }

      return version;

    } finally {
      if (dlg != null) dlg.dispose();
    }
  }