コード例 #1
0
 private URL[] find(FileObject file, SourceRoots from, SourceRoots to) {
   Project p = FileOwnerQuery.getOwner(file);
   if (p == null) {
     return null;
   }
   FileObject[] fromRoots = from.getRoots();
   for (int i = 0; i < fromRoots.length; i++) {
     if (fromRoots[i].equals(file)) {
       return to.getRootURLs();
     }
   }
   return null;
 }
コード例 #2
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();
    }