Example usage for org.eclipse.jface.wizard IWizardPage getMessage

List of usage examples for org.eclipse.jface.wizard IWizardPage getMessage

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizardPage getMessage.

Prototype

String getMessage();

Source Link

Document

Returns the current message for this wizard page.

Usage

From source file:fr.imag.adele.cadse.si.workspace.uiplatform.swt.ui.WizardController.java

License:Apache License

public String getMessage() {
    IWizardPage currentPage = getContainer().getCurrentPage();
    if (currentPage == null) {
        return null;
    }/*from   w ww  .j a  va  2s  .c om*/
    return currentPage.getMessage();
}

From source file:org.eclipse.m2e.integration.tests.common.UIIntegrationTestCase.java

License:Open Source License

protected static void assertWizardMessage(final String message, final int severity) throws Exception {
    bot.sleep(1000);/*from  w  ww .  j  av  a2  s  .com*/
    final AssertionError[] error = new AssertionError[] { null };
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            try {
                Object data = bot.activeShell().widget.getData();
                assertTrue("Current dialog is expected to be a wizard", data instanceof WizardDialog);

                boolean error = severity == WizardPage.ERROR;

                IWizardPage page = ((WizardDialog) data).getCurrentPage();
                String wizardMessage = error ? page.getErrorMessage() : page.getMessage();
                String prefix = error ? "Wizard error " : "Wizard message ";

                if (message == null) {
                    assertNull(prefix + "should be null", wizardMessage);
                } else {
                    assertNotNull(prefix + "should not be null", wizardMessage);
                    assertEquals(prefix + "is not as expected", message, wizardMessage.trim());
                }
            } catch (AssertionError e) {
                error[0] = e;
            }
        }
    });
    if (error[0] != null) {
        takeScreenShot(error[0]);
    }
}

From source file:org.eclipse.ui.tests.dialogs.UINewWorkingSetWizardAuto.java

License:Open Source License

public void testEditPage() throws Throwable {
    WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
    IWizardPage page = fWizardDialog.getCurrentPage();
    IWizardPage defaultEditPage = registry.getDefaultWorkingSetPage();
    String defaultEditPageClassName = defaultEditPage.getClass().getName();
    WorkingSetDescriptor[] descriptors = getEditableWorkingSetDescriptors();

    // the first page must be the type selection page iff there is more than one working set type
    assertEquals(descriptors.length > 1, (page instanceof WorkingSetTypePage));

    if (page instanceof WorkingSetTypePage) {
        /*//from   w  ww . j  av  a2s.  c  o m
         * Select the default (Resource) working set type
         * and advance to edit page.
         */
        List widgets = getWidgets((Composite) page.getControl(), Table.class);
        Table table = (Table) widgets.get(0);
        TableItem[] items = table.getItems();
        String workingSetName = null;
        for (int descriptorIndex = 0; descriptorIndex < descriptors.length; descriptorIndex++) {
            WorkingSetDescriptor descriptor = descriptors[descriptorIndex];
            if (defaultEditPageClassName.equals(descriptor.getPageClassName())) {
                workingSetName = descriptor.getName();
                break;
            }
        }
        assertNotNull(workingSetName);
        boolean found = false;
        for (int i = 0; i < items.length; i++) {
            if (items[i].getText().equals(workingSetName)) {
                table.setSelection(i);
                found = true;
                break;
            }
        }
        assertTrue(found);
        fWizardDialog.showPage(fWizard.getNextPage(page));
    }
    page = fWizardDialog.getCurrentPage();
    assertTrue(page instanceof IWorkingSetPage);

    /*
     * Verify that correct working set edit page is displayed
     */
    assertTrue(page.getClass() == defaultEditPage.getClass());
    /*
     * Test initial page state
     */
    assertFalse(page.canFlipToNextPage());
    assertFalse(fWizard.canFinish());
    assertNull(page.getErrorMessage());
    assertNull(page.getMessage());

    /*
     * Test page state with partial page input
     */
    setTextWidgetText(WORKING_SET_NAME_1, page);
    assertFalse(page.canFlipToNextPage());
    assertTrue(fWizard.canFinish()); // allow for empty sets
    assertNull(page.getErrorMessage());
    assertNotNull(page.getMessage());

    /*
     * Test page state with page complete input
     */
    checkTreeItems();
    assertFalse(page.canFlipToNextPage());
    assertTrue(fWizard.canFinish());
    assertNull(page.getErrorMessage());
    assertNull(page.getMessage());

    fWizard.performFinish();
    IWorkingSet workingSet = ((WorkingSetNewWizard) fWizard).getSelection();
    IAdaptable[] workingSetItems = workingSet.getElements();
    assertEquals(WORKING_SET_NAME_1, workingSet.getName());

    List widgets = getWidgets((Composite) page.getControl(), Tree.class);
    Tree tree = (Tree) widgets.get(0);
    assertEquals(workingSetItems.length, tree.getItemCount());
    assertTrue(ArrayUtil.contains(workingSetItems, p1));
    assertTrue(ArrayUtil.contains(workingSetItems, p2));

    /*
     * Check page texts 
     */
    DialogCheck.assertDialogTexts(fWizardDialog, this);
}