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

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

Introduction

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

Prototype

int BACK_ID

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

Click Source Link

Document

Button id for a "Back" button (value 14).

Usage

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

License:Open Source License

@Ignore
@Test/*from  w  ww.j av  a2 s.  c o  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.modelio.api.ui.ModelioWizardDialog.java

License:Apache License

@objid("d657c887-910f-11e0-9de7-002564c97630")
@Override// w  w w .j a  v a 2s. c o m
protected void buttonPressed(final int buttonId) {
    switch (buttonId) {
    case IDialogConstants.HELP_ID: {
        helpPressed();
        break;
    }
    case IDialogConstants.BACK_ID: {
        backPressed();
        break;
    }
    case IDialogConstants.NEXT_ID: {
        nextPressed();
        break;
    }
    case IDialogConstants.FINISH_ID: {
        finishPressed();
        break;
    }
    default: {
        // Nothing to do
        // The Cancel button has a listener which calls cancelPressed directly
    }
    }
}

From source file:org.modelio.api.ui.ModelioWizardDialog.java

License:Apache License

/**
 * Creates the Previous and Next buttons for this wizard dialog. Creates
 * standard (<code>SWT.PUSH</code>) buttons and registers for their
 * selection events. Note that the number of columns in the button bar
 * composite is incremented. These buttons are created specially to prevent
 * any space between them./*from   w  ww. jav a2s  . com*/
 * @param parent the parent button bar
 * @return a composite containing the new buttons
 */
@objid("bc1ce886-120f-11e2-b5c6-002564c97630")
private Composite createPreviousAndNextButtons(final Composite parent) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // will be incremented by createButton
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    this.backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    this.nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    return composite;
}

From source file:org.talend.component.ui.wizard.ui.common.GenericWizardDialog.java

License:Open Source License

@Override
public void updateButtons() {
    super.updateButtons();
    Form form = getForm();//from   ww w . j  a v  a2s. c o m
    Button nextButton = getButton(IDialogConstants.NEXT_ID);
    if (nextButton != null && nextButton.isEnabled()) {
        nextButton.setEnabled(form.isAllowForward());
    }
    Button backButton = getButton(IDialogConstants.BACK_ID);
    if (backButton != null && backButton.isEnabled()) {
        backButton.setEnabled(form.isAllowBack());
    }
    Button finishButton = getButton(IDialogConstants.FINISH_ID);
    if (finishButton != null && finishButton.isEnabled()) {
        finishButton.setEnabled(form.isAllowFinish());
    }
}

From source file:org.talend.registration.wizards.register.AbstractBasicWizardDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
}

From source file:org.talend.registration.wizards.register.RegisterWizardPage2.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);

    String password = passwordText.getText();
    String password2 = passwordText2.getText();
    String pseudonym = userNameText.getText();

    if (!alreadyRegistered) {

        if (password != null && !"".equals(password) && password2 != null && !"".equals(password2)
                && password.equals(password2) && pseudonym != null && !"".equals(pseudonym)) {
            nextButton.setEnabled(true);
        } else {/*from  ww  w.  ja v a 2 s  .  com*/
            nextButton.setEnabled(false);
        }
    } else {
        String oldPassword = oldPasswdText.getText();
        if (oldPassword != null && oldPassword.equals(password) && pseudonym != null && !"".equals(pseudonym)) {
            nextButton.setEnabled(true);
        } else {
            nextButton.setEnabled(false);
        }
    }

}

From source file:org.talend.registration.wizards.register.RegisterWizardPage2.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (IDialogConstants.NEXT_ID == buttonId) {
        boolean updateOrCreateSuccess = false;
        boolean success = false;
        try {//from w  w w.j  a v  a2  s  .  c o m
            if (alreadyRegistered) {
                success = RegisterManagement.getInstance().updateUser(email, pseudonym, oldPasswd, null,
                        firstname, lastname, country, isProxyEnable, proxyHost, proxyPort);
            } else {
                success = RegisterManagement.getInstance().createUser(email, pseudonym, password, firstname,
                        lastname, country, isProxyEnable, proxyHost, proxyPort, null, null);
            }
            if (success) {
                updateOrCreateSuccess = true;
            }
        } catch (BusinessException e) {
            MessageBoxExceptionHandler.process(e);
            updateOrCreateSuccess = false;
        } finally {
            if (updateOrCreateSuccess) {
                close();
                RegisterWizard registerWizard = new RegisterWizard();
                RegisterWizardPage3 dialog = new RegisterWizardPage3(this.getShell(), registerWizard, email);
                dialog.open();
            }
        }

    } else if (IDialogConstants.BACK_ID == buttonId) {
        close();
        RegisterWizard registerWizard = new RegisterWizard();
        RegisterWizardPage1 dialog = new RegisterWizardPage1(this.getShell(), registerWizard, email, country);
        dialog.open();
    }
}

From source file:org.talend.repository.ui.wizards.newproject.ImportProjectWizardDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
            .getService(IBrandingService.class);

    Button nextButton = getButton(IDialogConstants.NEXT_ID);
    if (nextButton != null) {
        nextButton.setText(Messages.getString("ImportProjectsAction.actionTitle")); //$NON-NLS-1$
        nextButton.setToolTipText(Messages.getString("ImportProjectsAction.actionTooltip", //$NON-NLS-1$
                brandingService.getShortProductName()));
        Point point = nextButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
        GridData data = new GridData(point.x, point.y);
        nextButton.setLayoutData(data);//  w  w  w.jav  a  2  s  .  c o  m
    }

    Button backButton = getButton(IDialogConstants.BACK_ID);
    if (backButton != null) {
        backButton.setText(Messages.getString("ImportProjectAsAction.actionTitle")); //$NON-NLS-1$
        backButton.setToolTipText(Messages.getString("ImportProjectAsAction.actionTooltip", //$NON-NLS-1$
                brandingService.getShortProductName()));
        Point point = backButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
        GridData data = new GridData(point.x, point.y);
        backButton.setLayoutData(data);
    }

    parent.redraw();
}

From source file:org.universaal.tools.packaging.tool.api.WizardDialogMod.java

License:Open Source License

@Override
public void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.HELP_ID: {
        helpPressed();/*from  www . j  a  v a 2s .c o m*/
        break;
    }
    case IDialogConstants.BACK_ID: {
        WizardPageMod page = (WizardPageMod) getCurrentPage();
        if (page.backPressed()) // to handle custom events
            backPressed();
        break;
    }
    case IDialogConstants.NEXT_ID: {

        WizardPageMod page = (WizardPageMod) getCurrentPage();
        if (page.nextPressed()) // to handle custom events
            nextPressed();
        break;
    }
    case IDialogConstants.FINISH_ID: {
        finishPressed();
        break;
    }
    }
}