title: Event onclick next button in jface wizard
body: <p>I have a <strong>jface wizard</strong> with two pages. </p>
  
  <ul>
  <li>First page: create one project folder.</li>
  <li>Second page: create <strong>class</strong> inside folder created in the firs step.</li>
  </ul>
  
  <p>But when I click on <kbd>next</kbd> button, the first page do not create the folder for to be selected on next step, only create when I click on <kbd>finish</kbd> button.</p>
  
  <p>How can I create the folder on click on <kbd>next</kbd> buttom?</p>
  
  <p>My code:</p>
  
  <pre><code>public class ShapesCreationWizard extends Wizard implements INewWizard,
      IExecutableExtension {
  
  private WizardNewProjectCreationPage _mainPage;
  private CreationPage page2;
  
  // cache of newly-created project
  private IProject _newProject;
  
  // switch to control write of trace data
  private boolean _bTraceEnabled = true;
  
  
  public void addPages() {
  
      _mainPage = new WizardNewProjectCreationPage("Project");
      _mainPage.setDescription("Create a new project .");
      _mainPage.setTitle("New Project");
      addPage(_mainPage); 
      addPage(page2);
  }
  
  public IProject getNewProject() {
      return _newProject;
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection) {
      page2 = new CreationPage(workbench, selection);
  }
  
  public boolean performFinish() {
      createNewProject();
      if (_config != null) {
          BasicNewProjectResourceWizard.updatePerspective(_config);
          BasicNewProjectResourceWizard.selectAndReveal(this._newProject,
                  PlatformUI.getWorkbench().getActiveWorkbenchWindow());
      }
      page2.finish();
      return true;
  
  }
  
  
  public IProject createNewProject() {
      if (_newProject != null) {
          return _newProject;
      }
      // get a project handle
      final IProject newProjectHandle = _mainPage.getProjectHandle();
  
      // get a project descriptor
      IPath defaultPath = Platform.getLocation();
      IPath newPath = _mainPage.getLocationPath();
      if (defaultPath.equals(newPath)) {
          newPath = null;
      }
      IWorkspace workspace = ResourcesPlugin.getWorkspace();
      final IProjectDescription description = workspace
              .newProjectDescription(newProjectHandle.getName());
      description.setLocation(newPath);
  
      // create the new project operation
      WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
          protected void execute(IProgressMonitor monitor)
                  throws CoreException {
              createProject(description, newProjectHandle, monitor);
              // addOWLNature(newProjectHandle);
  
          }
      };
  
      // run the new project creation operation
      try {
          getContainer().run(false, true, op);
      } catch (InterruptedException e) {
          return null;
      } catch (InvocationTargetException e) { 
  
          return null;
      }
  
      _newProject = newProjectHandle;
  
      return _newProject;
  }
  
  
  public void createProject(IProjectDescription description,IProject projectHandle, IProgressMonitor monitor)
          throws CoreException {
      try {
          monitor.beginTask("",2000);
  
          projectHandle.create(description, new SubProgressMonitor(monitor,1000));
  
          if (monitor.isCanceled()) {
              throw new OperationCanceledException();
          }
          projectHandle.open(new SubProgressMonitor(monitor,1000));
  
      } finally {
          monitor.done();
      }
  }
  
  
  protected void resultInformation(String title, String msg) {
      // Confirm Result
      if (_bTraceEnabled) {
          // trace only to console
          System.out.println(title + msg);
      } else {
          // user interaction response
          MessageDialog.openInformation(getShell(), title, msg);
      }
  
  }
  
  
  protected void resultError(String title, String msg) {
      // Indicate Error
      if (_bTraceEnabled) {
          // trace only to console
          System.out.println(title + msg);
      } else {
          // user interaction response
          MessageDialog.openError(getShell(), title, msg);
      }
  
  }
  
  private IConfigurationElement _config;
  
  
  public void setInitializationData(IConfigurationElement config,String propertyName, Object data) throws CoreException {
          _config = config;
  
  }
  }
  </code></pre>
  
  <p>Second page:</p>
  
  <pre><code>public class CreationPage extends WizardNewFileCreationPage {
  private static final String DEFAULT_EXTENSION = ".inte";//TODO extenção, alterara tb no shapes XML
  private final IWorkbench workbench;
  
  /**
   * Create a new wizard page instance.
   * 
   * @param workbench
   *            the current workbench
   * @param selection
   *            the current object selection
   * @see CopyOfShapesCreationWizard#init(IWorkbench, IStructuredSelection)
   */
  CreationPage(IWorkbench workbench, IStructuredSelection selection) {
      super("shapeCreationPage1", selection);
      this.workbench = workbench;
      setTitle("Create a new " + DEFAULT_EXTENSION + " file");
      setDescription("Create a new " + DEFAULT_EXTENSION + " file");
  }
  
  /*
   * (non-Javadoc)
   * 
   * @see
   * org.eclipse.ui.dialogs.WizardNewFileCreationPage#createControl(org
   * .eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
      super.createControl(parent);
      setFileName("Integrid1" + DEFAULT_EXTENSION);
      setPageComplete(validatePage());
  }
  
  /** Return a new ShapesDiagram instance. */
  private Object createDefaultContent() {
      return new ShapesDiagram();
  }
  
  /**
   * This method will be invoked, when the "Finish" button is pressed.
   * 
   * @see CopyOfShapesCreationWizard#performFinish()
   */
  boolean finish() {
      // create a new file, result != null if successful
      IFile newFile = createNewFile();
  
      // open newly created file in the editor
      IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
      if (newFile != null &amp;&amp; page != null) {
          try {
              IDE.openEditor(page, newFile, true);
              System.err.println();
          } catch (PartInitException e) {
              e.printStackTrace();
              return false;
          }
      }
  
      return true;
  }
  
  /*
   * (non-Javadoc)
   * 
   * @see
   * org.eclipse.ui.dialogs.WizardNewFileCreationPage#getInitialContents()
   */
  protected InputStream getInitialContents() {
  
      ByteArrayInputStream bais = null;
      try {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          ObjectOutputStream oos = new ObjectOutputStream(baos);
          oos.writeObject(createDefaultContent()); // argument must be
                                                      // Serializable
          oos.flush();
          oos.close();
          bais = new ByteArrayInputStream(baos.toByteArray());
      } catch (IOException ioe) {
          ioe.printStackTrace();
      }
      return bais;
  }
  
  /**
   * Return true, if the file name entered in this page is valid.
   */
  private boolean validateFilename() {
      if (getFileName() != null
              &amp;&amp; getFileName().endsWith(DEFAULT_EXTENSION)) {
          return true;
      }
      setErrorMessage("The 'file' name must end with " + DEFAULT_EXTENSION);
      return false;
  }
  
  /*
   * (non-Javadoc)
   * 
   * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage()
   */
  protected boolean validatePage() {
      return super.validatePage() &amp;&amp; validateFilename();
  }
  }
  </code></pre>