Use LoginDialog to log into cvs pserver. sandwich_build_3
authormentlicher@netbeans.org
Mon, 04 Sep 2000 09:51:56 +0000
changeset 337f984e0738d73
parent 336 7d4ffb6f3492
child 338 37af881803bc
Use LoginDialog to log into cvs pserver.
This solves deadlock of AWT thread when connecting to the pserver.
vcscvs/src/org/netbeans/modules/vcs/cmdline/Cust2ServerPanel.java
     1.1 --- a/vcscvs/src/org/netbeans/modules/vcs/cmdline/Cust2ServerPanel.java	Mon Sep 04 09:48:55 2000 +0000
     1.2 +++ b/vcscvs/src/org/netbeans/modules/vcs/cmdline/Cust2ServerPanel.java	Mon Sep 04 09:51:56 2000 +0000
     1.3 @@ -38,6 +38,7 @@
     1.4      CvsFileSystem fs;
     1.5      CVSPasswd passFile;
     1.6      boolean isLastPanel;
     1.7 +    boolean loginCancelled = false;
     1.8      
     1.9      private ArrayList listeners = new ArrayList ();
    1.10  
    1.11 @@ -288,7 +289,10 @@
    1.12   */
    1.13      public int getNext() {
    1.14         if (!isLoggedIn()) {
    1.15 -         return 2; 
    1.16 +         //return 2;
    1.17 +           if (loginCancelled) return 2; // return me if the login was cancelled
    1.18 +           fs.setDoCommandRefresh(false); // set offline mode
    1.19 +           return 4; // skip checkout when not logged in
    1.20         }    
    1.21         if (this.rbLocal.isSelected()) { // see BUG no 6990 - needs to check if the repository is initiated
    1.22           String repos = this.txRepository.getText();
    1.23 @@ -433,6 +437,11 @@
    1.24          }
    1.25      }    
    1.26      
    1.27 +    /**
    1.28 +     * Find out whether the user is logged in.
    1.29 +     * @return true if the user is logged in successfully,
    1.30 +     *         false if the user is not logged in and offline mode should be used.
    1.31 +     */
    1.32      public boolean isLoggedIn() {
    1.33        if (rbPserver.isSelected()) { 
    1.34          String connectStr = ":pserver:" + txUser.getText().trim() 
    1.35 @@ -442,6 +451,8 @@
    1.36          PasswdEntry entry = passFile.find(connectStr);
    1.37          if (entry == null) {
    1.38               // do remote login
    1.39 +            LoginDialog login = LoginDialog.createDialog();
    1.40 +            /*
    1.41              String passwd = "";
    1.42              NotifyDescriptor.InputLine not = new NotifyDescriptorInputPassword(org.openide.util.NbBundle.getBundle(NewCvsCustomizer.class).getString("NewCvsCustomizer.passwordLabel"), 
    1.43                             org.openide.util.NbBundle.getBundle(NewCvsCustomizer.class).getString("NewCvsCustomizer.inputPassword"));
    1.44 @@ -459,7 +470,13 @@
    1.45                   passFile.savePassFile(); } 
    1.46                return ok; 
    1.47              }
    1.48 -            return false; // cancel pressed on password dialog.  
    1.49 +             */
    1.50 +            login.setPserverName(txServer.getText().trim());
    1.51 +            login.setConnectString(connectStr);
    1.52 +            login.show();
    1.53 +            loginCancelled = !login.isOffline();
    1.54 +            return login.isLoggedIn();
    1.55 +            //return false; // cancel pressed on password dialog.  
    1.56          }    
    1.57          return true;   // was found in .pass file
    1.58        }