Example usage for org.eclipse.jface.wizard IWizardContainer getCurrentPage

List of usage examples for org.eclipse.jface.wizard IWizardContainer getCurrentPage

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizardContainer getCurrentPage.

Prototype

public IWizardPage getCurrentPage();

Source Link

Document

Returns the current wizard page for this container.

Usage

From source file:com.nokia.s60tools.ui.wizards.S60ToolsWizard.java

License:Open Source License

/**
 * Overrides the base class implementation from  
 * <code>org.eclipse.jface.dialogs.IPageChangedListener</code>.
 * // ww  w .j a v  a 2s.c  om
 * This overridden implementation 
 * gets current <code>S60ToolsWizardPage</code> instance and calls it
 * <code>recalculateButtonStates</code> and <code>setInitialFocus</code> methods
 * thus initializing page into correct initial state.
 * 
 * @see com.nokia.s60tools.ui.wizards.S60ToolsWizardPage#recalculateButtonStates
 * @see com.nokia.s60tools.ui.wizards.S60ToolsWizardPage#setInitialFocus
 */
public void pageChanged(PageChangedEvent event) {
    //
    // Updating buttons states when the page is changed
    //
    IWizardContainer container = getContainer();
    if (container != null) {
        S60ToolsWizardPage currPage = (S60ToolsWizardPage) container.getCurrentPage();
        if (currPage != null) {
            currPage.recalculateButtonStates();
            currPage.setInitialFocus();
        }
    }
}

From source file:com.siteview.mde.internal.ui.nls.InternationalizeWizardOpenOperation.java

License:Open Source License

public int run(final Shell parent, final String dialogTitle) throws InterruptedException {
    Assert.isNotNull(dialogTitle);//  w w w  .java 2 s  .c o  m
    final IJobManager manager = Job.getJobManager();
    final int[] result = new int[1];
    final InterruptedException[] canceled = new InterruptedException[1];

    Runnable r = new Runnable() {
        public void run() {
            try {
                manager.beginRule(ResourcesPlugin.getWorkspace().getRoot(), null);

                Dialog dialog = new WizardDialog(parent, fWizard);
                dialog.create();

                IWizardContainer wizardContainer = (IWizardContainer) dialog;
                if (wizardContainer.getCurrentPage() == null) {
                    //Close the dialog if there are no pages
                    result[0] = Window.CANCEL;
                } else {
                    //Open the wizard dialog
                    result[0] = dialog.open();
                }

            } catch (OperationCanceledException e) {
                canceled[0] = new InterruptedException(e.getMessage());
            } finally {
                manager.endRule(ResourcesPlugin.getWorkspace().getRoot());
            }
        }
    };
    BusyIndicator.showWhile(parent.getDisplay(), r);
    if (canceled[0] != null)
        throw canceled[0];
    return result[0];
}

From source file:com.siteview.mde.ui.templates.OptionTemplateSection.java

License:Open Source License

/**
 * Resets the current page state by clearing the error message and making
 * the page complete, thereby allowing users to flip to the next page.
 *///from  w w w  .j  a  va 2  s . com
protected void resetPageState() {
    if (pages.size() == 0)
        return;
    WizardPage firstPage = ((TemplatePage) pages.get(0)).page;
    IWizardContainer container = firstPage.getWizard().getContainer();
    WizardPage currentPage = (WizardPage) container.getCurrentPage();
    currentPage.setErrorMessage(null);
    currentPage.setPageComplete(true);
}

From source file:eu.geclipse.ui.wizards.ConnectionWizard.java

License:Open Source License

@Override
public boolean canFinish() {

    IWizardContainer container = getContainer();
    IWizardPage currentPage = container.getCurrentPage();

    return ((currentPage != this.firstPage) || (this.initialURI != null)) && super.canFinish();

}

From source file:eu.numberfour.n4js.ui.wizard.classifiers.N4JSNewClassifierWizard.java

License:Open Source License

/**
 * Sets the error message for the active wizard page.
 *
 * Note that this method has no effect if the current page doesn't support error messages.
 *//*from ww w  .  j  ava2 s .c  om*/
private void setErrorMessage(String message) {
    IWizardContainer container = getContainer();
    if (container != null) {
        IWizardPage currentPage = container.getCurrentPage();
        if (currentPage instanceof DialogPage) {
            ((DialogPage) currentPage).setErrorMessage(message);
        }
    }
}

From source file:fr.inria.diverse.commons.eclipse.pde.wizards.pages.pde.ui.templates.OptionTemplateSection.java

License:Open Source License

/**
 * Resets the current page state by clearing the error message and making
 * the page complete, thereby allowing users to flip to the next page.
 *//*from  w w  w  . j  ava2s  . c  o  m*/
protected void resetPageState() {
    if (pages.size() == 0)
        return;
    WizardPage firstPage = pages.get(0).page;
    IWizardContainer container = firstPage.getWizard().getContainer();
    WizardPage currentPage = (WizardPage) container.getCurrentPage();
    currentPage.setErrorMessage(null);
    currentPage.setPageComplete(true);
}

From source file:org.apache.directory.studio.connection.ui.wizards.NewConnectionWizardPage.java

License:Apache License

/**
 * @see org.apache.directory.studio.connection.ui.ConnectionParameterPageModifyListener#connectionParameterPageModified()
 *///w  w  w .  j  av  a 2 s  . c  o m
public void connectionParameterPageModified() {
    //only one of the messages can be shown
    //warning messages are more important 
    //than info messages
    if (page.getMessage() != null) {
        setMessage(page.getMessage());
    } else if (page.getInfoMessage() != null) {
        setMessage(page.getInfoMessage());
    } else {
        setMessage(null);
    }

    setErrorMessage(page.getErrorMessage());
    setPageComplete(page.isValid());

    IWizardContainer container = getContainer();

    if ((container != null) && (container.getCurrentPage() != null)) {
        container.updateButtons();
    }
}

From source file:org.eclipse.acceleo.internal.ide.ui.wizards.project.AcceleoProjectWizard.java

License:Open Source License

/**
 * {@inheritDoc}//from   w  w  w . j  a  v  a 2s .  c o  m
 * 
 * @see org.eclipse.jface.wizard.Wizard#canFinish()
 */
@Override
public boolean canFinish() {
    IWizardContainer iWizardContainer = this.getContainer();
    IWizardPage currentPage = iWizardContainer.getCurrentPage();
    if (currentPage instanceof WizardNewProjectCreationPage) {
        return newProjectPage.isPageComplete();
    }
    return newProjectPage.isPageComplete() && newAcceleoModulesCreationPage.isPageComplete();
}

From source file:org.eclipse.compare.codereview.refactorChange.ApplyRefactoringScriptWizard.java

License:Open Source License

/**
 * Sets the location of the refactoring script.
 *
 * @param uri/*  ww w .ja  v a 2  s .c  om*/
 *            the location of the script, or <code>null</code>
 */
public void setRefactoringScript(final URI uri) {
    fScriptLocation = uri;
    final IWizardContainer wizard = getContainer();
    if (wizard.getCurrentPage() != null)
        wizard.updateButtons();
}

From source file:org.eclipse.emf.search.ui.internal.replace.provisional.TextualModelSearchRefactoringOperation.java

License:Open Source License

/**
 * Opens the refactoring dialog for the refactoring wizard passed to the constructor. 
 * The method first checks the initial conditions of the refactoring. If the condition 
 * checking returns a status with a severity of {@link RefactoringStatus#FATAL} then
 * a message dialog is opened containing the corresponding status message. No wizard 
 * dialog is opened in this situation. If the condition checking passes then the 
 * refactoring dialog is opened. //  w w w  .j a v a 2 s.  c o m
 * <p>
 * The methods ensures that the workspace lock is held while the condition checking, 
 * change creation and change execution is performed. Clients can't make any assumption
 * about the thread in which these steps are executed. However the framework ensures
 * that the workspace lock is transfered to the thread in which the execution of the
 * steps takes place. 
 * </p>
 * @param parent the parent shell for the dialog or <code>null</code> if the dialog
 *  is a top level dialog
 * @param dialogTitle the dialog title of the message box presenting the failed
 *  condition check (if any)
 *   
 * @return {@link #INITIAL_CONDITION_CHECKING_FAILED} if the initial condition checking
 *  failed and no wizard dialog was presented. Otherwise either {@link IDialogConstants#OK_ID}
 *  or {@link IDialogConstants#CANCEL_ID} is returned depending on whether the user
 *  has pressed the OK or cancel button on the wizard dialog.
 * 
 * @throws InterruptedException if the initial condition checking got canceled by
 *  the user.
 */
public int run(final Shell parent, final String dialogTitle) throws InterruptedException {
    Assert.isNotNull(dialogTitle);
    final Refactoring refactoring = fWizard.getRefactoring();
    final IJobManager manager = Job.getJobManager();
    final int[] result = new int[1];
    final InterruptedException[] canceled = new InterruptedException[1];
    Runnable r = new Runnable() {
        public void run() {
            try {
                // we are getting the block dialog for free if we pass in null
                manager.beginRule(ResourcesPlugin.getWorkspace().getRoot(), null);

                refactoring.setValidationContext(parent);
                fInitialConditions = checkInitialConditions(refactoring, parent, dialogTitle);
                if (fInitialConditions.hasFatalError()) {
                    String message = fInitialConditions.getMessageMatchingSeverity(RefactoringStatus.FATAL);
                    MessageDialog.openInformation(parent, dialogTitle, message);
                    result[0] = INITIAL_CONDITION_CHECKING_FAILED;
                } else {
                    fWizard.setInitialConditionCheckingStatus(fInitialConditions);
                    Dialog dialog = new ModelSearchWizardDialog(parent, fWizard);
                    dialog.create();
                    IWizardContainer wizardContainer = (IWizardContainer) dialog;
                    if (wizardContainer.getCurrentPage() == null)
                        /*
                         * Don't show the dialog at all if there are no user
                         * input pages and change creation was cancelled.
                         */
                        result[0] = Window.CANCEL;
                    else
                        result[0] = dialog.open();
                }
            } catch (InterruptedException e) {
                canceled[0] = e;
            } catch (OperationCanceledException e) {
                canceled[0] = new InterruptedException(e.getMessage());
            } finally {
                manager.endRule(ResourcesPlugin.getWorkspace().getRoot());
                refactoring.setValidationContext(null);
            }
        }
    };
    BusyIndicator.showWhile(parent.getDisplay(), r);
    if (canceled[0] != null)
        throw canceled[0];
    return result[0];
}