CVS: check authorization inside doNext() before actually doNext() for default project...
authorirengrig <Irina.Chernushina@jetbrains.com>
Tue, 26 Jan 2010 14:56:26 +0000 (17:56 +0300)
committerirengrig <Irina.Chernushina@jetbrains.com>
Tue, 26 Jan 2010 14:56:26 +0000 (17:56 +0300)
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/CvsWizard.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/SelectCvsElementStep.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/ui/experts/WizardStep.java

index 9c6a7e2bd0763eb0400f91e108c27ca12fd66627..4b14ec5be78171ef907df2d425e1f285966a985a 100644 (file)
@@ -41,6 +41,17 @@ public class CvsWizard extends AbstractWizard<WizardStep> {
     return null;
   }
 
+  @Override
+  protected void doNextAction() {
+    if ((myCurrentStep + 1) >= mySteps.size()) return;
+    final WizardStep nextStep = mySteps.get(myCurrentStep + 1);
+    if (! nextStep.preNextCheck()) {
+      return;
+    }
+
+    super.doNextAction();
+  }
+
   public void updateStep() {
     super.updateStep();
     if (getNumberOfSteps() == 0) return;
index b6fc9148afd959dae36852dc40a03dcbd1e00d77..cad563ee7c46bc12b63369fe1c5dc54b28de3b17 100644 (file)
@@ -77,18 +77,24 @@ public class SelectCvsElementStep extends WizardStep {
           errors.set(Boolean.TRUE);
         }
       });
-    final boolean logged = performer.loginAll(
-      new ModalityContextImpl(ModalityState.stateForComponent(mySelectCVSConfigurationStep.getComponent()), false), false);
+    /*final boolean logged = performer.loginAll(
+      new ModalityContextImpl(ModalityState.stateForComponent(mySelectCVSConfigurationStep.getComponent()), false), false);*/
+    final boolean logged = performer.loginAll(new ModalityContextImpl(ModalityState.current(), false), false);
     if ((! logged) || (! errors.isNull())) {
       return false;
     }
     return true;
   }
 
+  @Override
+  public boolean preNextCheck() {
+    CvsRootConfiguration selectedConfiguration = mySelectCVSConfigurationStep.getSelectedConfiguration();
+    return isLogged(selectedConfiguration);
+  }
+
   public boolean setActive() {
     CvsRootConfiguration selectedConfiguration =
       mySelectCVSConfigurationStep.getSelectedConfiguration();
-    if (! isLogged(selectedConfiguration)) return false;
 
     if (myCvsTree == null || !Comparing.equal(myConfiguration, selectedConfiguration)) {
       myConfiguration = selectedConfiguration;
index b010c95a5623bb0ee6e4a39b47f3d5644b183279..273f76d63d6450081d4228dea9029a914e25ec25 100644 (file)
@@ -53,6 +53,10 @@ public abstract class WizardStep extends StepAdapter{
 
   }
 
+  public boolean preNextCheck() {
+    return true;
+  }
+
   public abstract boolean nextIsEnabled();
   public abstract boolean setActive();
   protected abstract JComponent createComponent();