예제 #1
0
  public void showGotoDialog(final KeyEventBlocker blocker) {
    Dialog dialog = createGotoDialog();
    if (dialog == null) { // already visible
      // TODO:beep()
      return;
    }

    dialog.setVisible(true);
    gotoPanel.popupNotify(blocker);

    WindowAdapter winAdapt =
        new WindowAdapter() {
          public @Override void windowClosing(WindowEvent evt) {
            disposeGotoDialog();
          }

          public @Override void windowClosed(WindowEvent evt) {
            SwingUtilities.invokeLater(
                new Runnable() {
                  public void run() {
                    if (blocker != null) {
                      blocker.stopBlocking(false);
                    }
                    //                        Utilities.returnFocus();
                  }
                });
          }
        };
    dialog.addWindowListener(winAdapt);
  }
예제 #2
0
 public void actionPerformed(ActionEvent evt) {
   Object src = evt.getSource();
   if (src == gotoButtons[0] || src == gotoPanel) { // Find button
     if (performGoto()) {
       gotoPanel.updateHistory(); // A.N.: support for history
       disposeGotoDialog();
     }
   } else { // Cancel button
     disposeGotoDialog();
   }
 }
예제 #3
0
  public GotoDialogSupport() {
    ResourceBundle bundle = NbBundle.getBundle(org.netbeans.editor.BaseKit.class);
    JButton gotoButton = new JButton(bundle.getString("goto-button-goto")); // NOI18N
    JButton cancelButton = new JButton(bundle.getString("goto-button-cancel")); // NOI18N
    gotoButton
        .getAccessibleContext()
        .setAccessibleDescription(bundle.getString("ACSD_goto-button-goto")); // NOI18N
    cancelButton
        .getAccessibleContext()
        .setAccessibleDescription(bundle.getString("ACSD_goto-button-cancel")); // NOI18N
    //        gotoButton.setMnemonic( bundle.getString("goto-button-goto-mnemonic").charAt(0));
    // //NOI18N

    gotoButtons = new JButton[] {gotoButton, cancelButton};
    gotoPanel = new GotoDialogPanel();

    gotoPanel
        .getGotoCombo()
        .getEditor()
        .getEditorComponent()
        .addKeyListener(
            new KeyListener() {
              public void keyPressed(KeyEvent evt) {}

              public void keyReleased(KeyEvent evt) {}

              public void keyTyped(KeyEvent evt) {
                if (evt.getKeyChar() == '\n') {
                  actionPerformed(new ActionEvent(gotoButtons[0], 0, null));
                }
                //                if (!Character.isDigit(evt.getKeyChar()) &&
                // !Character.isISOControl(evt.getKeyChar())) {
                //                    evt.consume();
                //                    Component c = evt.getComponent();
                //                    if (c != null) {
                //                        c.getToolkit().beep();
                //                    }
                //                }
              }
            });
  }
예제 #4
0
 /**
  * Get text value of the
  *
  * @return text value of goto field.
  * @since
  */
 protected final String getGotoValueText() {
   return gotoPanel.getValue();
 }