Example usage for org.eclipse.jface.dialogs IDialogConstants NEXT_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants NEXT_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants NEXT_ID.

Prototype

int NEXT_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants NEXT_ID.

Click Source Link

Document

Button id for a "Next" button (value 15).

Usage

From source file:org.locationtech.udig.catalog.tests.ui.workflow.BasicWorkflowDialogTest.java

License:Open Source License

@Ignore
@Test//from  ww  w .  j  av a2s . com
public void testBlockingWizard() {
    Assertion a1 = new Assertion() {
        public void run() {
            Button next = DialogDriver.findButton(bdialog, IDialogConstants.NEXT_ID);
            Button prev = DialogDriver.findButton(bdialog, IDialogConstants.BACK_ID);
            Button fin = DialogDriver.findButton(bdialog, IDialogConstants.FINISH_ID);

            if (!next.isEnabled())
                fail = true;
            if (prev.isEnabled())
                fail = true;
            if (fin.isEnabled())
                fail = true;
        }
    };
    Assertion a2 = new Assertion() {
        public void run() {
            Button next = DialogDriver.findButton(bdialog, IDialogConstants.NEXT_ID);
            Button prev = DialogDriver.findButton(bdialog, IDialogConstants.BACK_ID);
            Button fin = DialogDriver.findButton(bdialog, IDialogConstants.FINISH_ID);

            if (next.isEnabled())
                fail = true;
            if (!prev.isEnabled())
                fail = true;
            if (!fin.isEnabled())
                fail = true;
        }
    };

    Object[] buttons = new Object[] { a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID,
            IDialogConstants.NEXT_ID, a2, IDialogConstants.BACK_ID, IDialogConstants.BACK_ID,
            IDialogConstants.BACK_ID, a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID,
            IDialogConstants.NEXT_ID, a2, IDialogConstants.FINISH_ID };

    DialogDriver driver = new DialogDriver(bdialog, buttons);
    driver.schedule();

    bdialog.open();
    driver.cancel();

    assertFalse(a1.fail);
    assertFalse(a2.fail);
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.BasicWorkflowDialogTest.java

License:Open Source License

@Ignore
@Test//from  ww w.  ja v a  2 s  .  co m
public void testNonBlockingWizard() {
    Assertion a1 = new Assertion() {
        public void run() {
            Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
            Button prev = DialogDriver.findButton(dialog, IDialogConstants.BACK_ID);
            Button fin = DialogDriver.findButton(dialog, IDialogConstants.FINISH_ID);

            if (!next.isEnabled())
                fail = true;
            if (prev.isEnabled())
                fail = true;
            if (fin.isEnabled())
                fail = true;
        }
    };
    Assertion a2 = new Assertion() {
        public void run() {
            Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
            Button prev = DialogDriver.findButton(dialog, IDialogConstants.BACK_ID);
            Button fin = DialogDriver.findButton(dialog, IDialogConstants.FINISH_ID);

            if (next.isEnabled())
                fail = true;
            if (!prev.isEnabled())
                fail = true;
            if (!fin.isEnabled())
                fail = true;
        }
    };

    Object[] buttons = new Object[] { a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID,
            IDialogConstants.NEXT_ID, a2, IDialogConstants.BACK_ID, IDialogConstants.BACK_ID,
            IDialogConstants.BACK_ID, a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID,
            IDialogConstants.NEXT_ID, a2, IDialogConstants.FINISH_ID };

    DialogDriver driver = new DialogDriver(dialog, buttons);
    driver.schedule();

    dialog.open();
    driver.cancel();

    assertFalse(a1.fail);
    assertFalse(a2.fail);
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.ConnectionTest.java

License:Open Source License

@Ignore // fails when running from maven
@Test//from w  w w.  ja  va2s  . c o  m
public void testButtonState() {
    init("org.locationtech.udig.catalog.ui.WMS"); //$NON-NLS-1$

    Assertion a1 = new Assertion() {
        @Override
        public void run() {
            Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
            fail = !next.isEnabled();
        }
    };
    Object[] actions = new Object[] { a1, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();

    assertFalse(a1.fail);
    driver.cancel();
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.ConnectionTest.java

License:Open Source License

@Test
public void testWorkbenchSelection() {
    init("org.locationtech.udig.catalog.ui.WMS"); //$NON-NLS-1$

    // create a workbench selection
    try {/*from w w  w  .ja va2s .c  o m*/

        workflow.setContext(capabilitiesRequestURL);
    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }

    Assertion a1 = new Assertion() {
        @Override
        public void run() {
            Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
            fail = !next.isEnabled();
        }
    };
    Object[] actions = new Object[] { a1, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();

    assertFalse(a1.fail);
    driver.cancel();
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.ConnectionTest.java

License:Open Source License

@Test
public void testConnection() {
    init("org.locationtech.udig.catalog.ui.WMS"); //$NON-NLS-1$

    //create a workbench selection
    try {/*w  w w  .j  a v  a 2  s. com*/

        workflow.setContext(capabilitiesRequestURL);

    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }

    Object[] actions = new Object[] { IDialogConstants.NEXT_ID, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();
    driver.cancel();

    assertNotNull(state.getServices());
    assertFalse(state.getServices().isEmpty());

}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.DataSourceSelectionTest.java

License:Open Source License

@Test
public void testWorkbenchSelection() {
    try {/*from   ww w.  j a  v a2  s  .co  m*/
        URL url = new URL("http://wms.jpl.nasa.gov/wms.cgi?Service=WMS&Version=1.1.1&Request=GetCapabilities"); //$NON-NLS-1$
        workflow.setContext(url);
    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }

    Assertion a1 = new Assertion() {
        @Override
        public void run() {
            IStructuredSelection sselection = (IStructuredSelection) page.getViewer().getSelection();
            UDIGConnectionFactoryDescriptor d = (UDIGConnectionFactoryDescriptor) sselection.getFirstElement();

            fail = !d.getId().equals("org.locationtech.udig.catalog.ui.WMS"); //$NON-NLS-1$
            if (!fail) {
                Button button = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
                fail = !button.isEnabled();
            }
        }
    };
    Object[] actions = new Object[] { a1, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();
    driver.cancel();

    assertFalse(a1.fail);

}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.DataSourceSelectionTest.java

License:Open Source License

@Test
public void testSelection() {
    // turn on and off a viewer selection
    Runnable r1 = new Runnable() {
        public void run() {
            page.getViewer().setSelection(new StructuredSelection());

            SelectionChangedEvent event = new SelectionChangedEvent(page.getViewer(),
                    new StructuredSelection());
            page.selectionChanged(event);
        }//w w  w.  j  av a 2  s  .  co m
    };

    Assertion a1 = new Assertion() {
        @Override
        public void run() {
            Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
            fail = next.isEnabled();
        }
    };
    Runnable r2 = new Runnable() {

        public void run() {
            List<UDIGConnectionFactoryDescriptor> l = page.getDescriptors();
            page.getViewer().setSelection(new StructuredSelection(l.get(0)));
        }
    };
    Assertion a2 = new Assertion() {
        @Override
        public void run() {
            Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID);
            fail = !next.isEnabled();
        }
    };
    Object[] actions = new Object[] { r1, a1, r2, a2, IDialogConstants.CANCEL_ID };
    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();
    driver.cancel();
    driver.cancel();

    assertFalse(a1.fail);
    assertFalse(a2.fail);
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.ResourceSelectionTest.java

License:Open Source License

@Test
public void testNormal() throws Exception {
    //create a context
    URL url = new URL(
            "http://demo.opengeo.org/geoserver/wms?Service=WMS&Version=1.1.1&Request=GetCapabilities"); //$NON-NLS-1$
    CatalogTestUtils.assumeNoConnectionException(url, 3000);
    workflow.setContext(url);/*from   w  ww  .j ava 2s.c o m*/

    Assertion a1 = new Assertion() {
        @Override
        public void run() {
            fail = page.getViewer().getTree().getItemCount() != 1;
            if (!fail) {
                fail = page.getViewer().getTree().getItem(0).getItemCount() < 1;
            }
            if (!fail)
                fail = page.getViewer().getCheckedElements().length != 0;
        }
    };
    Object[] actions = new Object[] { IDialogConstants.NEXT_ID, a1, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();

    assertFalse(a1.fail);
    driver.cancel();
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.ResourceSelectionTest.java

License:Open Source License

@Test
public void testNormalSelectedGeoResource() throws Exception {
    //create a workbench selection
    URL url = new URL(
            "http://demo.opengeo.org/geoserver/wms?Service=WMS&Version=1.1.1&Request=GetCapabilities#topp:tasmania_cities"); //$NON-NLS-1$
    CatalogTestUtils.assumeNoConnectionException(url, 3000);
    workflow.setContext(url);/*from   www . j  a v  a2 s .co m*/

    Assertion a1 = new Assertion() {
        @Override
        public void run() {
            fail = page.getViewer().getTree().getItemCount() != 1;
            if (!fail) {
                fail = page.getViewer().getTree().getItem(0).getItemCount() < 1;
            }
            if (!fail)
                fail = page.getViewer().getCheckedElements().length != 2;
        }
    };
    Object[] actions = new Object[] { IDialogConstants.NEXT_ID, a1, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.setBlockOnOpen(true);
    dialog.open();

    assertFalse(a1.fail);
    driver.cancel();
}

From source file:org.locationtech.udig.catalog.tests.ui.workflow.SingleResourceSelectionTest.java

License:Open Source License

@Test
public void test() {
    Assertion a1 = new Assertion() {
        @Override//from   www.  j  a  v  a2  s. c  om
        public void run() {
            fail = page.getViewer().getTree().getItemCount() != 1;
            if (!fail) {
                fail = page.getViewer().getTree().getItem(0).getItemCount() < 1;
            }
            if (!fail)
                fail = page.getViewer().getCheckedElements().length != 2;
        }
    };
    Object[] actions = new Object[] { IDialogConstants.NEXT_ID, a1, IDialogConstants.CANCEL_ID };

    DialogDriver driver = new DialogDriver(dialog, actions);
    driver.schedule();

    dialog.open();

    assertFalse(a1.fail);
    driver.cancel();
}