Example usage for org.eclipse.jface.wizard Wizard performFinish

List of usage examples for org.eclipse.jface.wizard Wizard performFinish

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard Wizard performFinish.

Prototype

@Override
public abstract boolean performFinish();

Source Link

Document

Subclasses must implement this IWizard method to perform any special finish processing for their wizard.

Usage

From source file:org.eclipse.team.tests.ccvs.ui.ProjectSetImporterTests.java

License:Open Source License

public void testScmUrlImportWithTag() throws TeamException, CoreException, IOException {
    IProject project = createProject("testScmUrlImportWithTag", new String[0]);
    tagProject(project, new CVSTag("tag", CVSTag.VERSION), false);
    project.delete(true, true, null);/*  w  w w  . j ava 2  s  .  co  m*/
    ensureDoesNotExistInWorkspace(project);

    final IScmUrlImportWizardPage[] pages = TeamUI.getPages("org.eclipse.team.core.cvs.importer");
    assertEquals(1, pages.length);
    String s = ProjectSetCapability.SCHEME_SCM + ":cvs:" + CVSTestSetup.REPOSITORY_LOCATION + ":"
            + project.getName() + ";tag=tag";
    ;
    ScmUrlImportDescription d = new ScmUrlImportDescription(s, project.getName());
    ScmUrlImportDescription[] selection = new ScmUrlImportDescription[] { d };
    pages[0].setSelection(selection);

    assertTrue(pages[0] instanceof CVSScmUrlImportWizardPage);
    Wizard wizard = new Wizard() {
        public boolean performFinish() {
            // update SCM URLs in descriptions
            pages[0].finish();
            return true;
        }
    };
    wizard.addPage(pages[0]);
    WizardDialog wizardDialog = new WizardDialog(new Shell(Display.getCurrent()), wizard);
    wizardDialog.setBlockOnOpen(false);
    wizardDialog.open();
    // simulate clicking "Import from HEAD" on the CVS import page
    Button useHead = (Button) ReflectionUtils.getField(pages[0], "useHead");
    useHead.setSelection(true);
    wizard.performFinish();
    wizardDialog.close();

    // altered selection, check out from HEAD
    selection = pages[0].getSelection();
    IBundleImporter cvsBundleImporter = getBundleImporter("org.eclipse.team.core.cvs.importer");
    cvsBundleImporter.performImport(selection, null);

    assertExistsInWorkspace(project);
    IProject copy = checkoutCopy(project, CVSTag.DEFAULT);
    // expecting the project to be checked out from HEAD
    assertEquals(project, copy, false, false);
}