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.ui.DataSourceSelectionPage.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
 *///from w w w  . j av  a 2 s  . c  o m
public void createControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayout(new FillLayout());

    DataSourceSelectionState state = (DataSourceSelectionState) getState();
    List<UDIGConnectionFactoryDescriptor> descriptorList;
    if (state.getShortlist() != null) {
        descriptorList = state.getShortlist();
    } else {
        descriptorList = getDescriptors();
    }

    viewer = new WizardViewer(comp, SWT.SINGLE | SWT.BORDER);
    viewer.setInput(descriptorList.toArray());
    viewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IWizardContainer container = getContainer();
            if (container instanceof Dialog) {
                Dialog d = (Dialog) container;
                Button button = findButton(d.buttonBar, IDialogConstants.NEXT_ID);
                if (button != null)
                    button.notifyListeners(SWT.Selection, new Event());
            }
        }
    });
    viewer.addSelectionChangedListener(this);

    // check the state for an initial selection
    if (state.getDescriptor() != null) {
        viewer.setSelection(new StructuredSelection(state.getDescriptor()));
    }
    setControl(comp);
}

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

License:Apache License

@objid("d657c887-910f-11e0-9de7-002564c97630")
@Override//  w  w w .ja va  2 s.  c om
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  ww w . ja v  a2s .  co  m*/
 * @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.polymap.kaps.ui.form.WohnungSearcher.java

License:Open Source License

public void run() {
    try {/*ww  w.jav  a2s  . c o m*/

        WohnungTableDialog dialog = new WohnungTableDialog();
        dialog.setBlockOnOpen(true);
        int returnCode = dialog.open();
        if (returnCode == IDialogConstants.OK_ID || returnCode == IDialogConstants.NEXT_ID) {
            assert dialog.sel.length == 1 : "Selected: " + dialog.sel.length;
            final IFeatureTableElement sel = dialog.sel[0];
            WohnungComposite wohnung = Iterables.find(content, new Predicate<WohnungComposite>() {

                public boolean apply(WohnungComposite input) {
                    return input.id().equals(sel.fid());
                }
            });

            if (returnCode == IDialogConstants.NEXT_ID) {
                // fortfhrung erstellen
                wohnung = KapsRepository.instance().clone(WohnungComposite.class, wohnung);
                Integer fortf = wohnung.wohnungsFortfuehrung().get();

                wohnung.wohnungsFortfuehrung()
                        .set(fortf == null ? Integer.valueOf(0) : Integer.valueOf(fortf.intValue() + 1));
            }
            adopt(wohnung);
        }
    } catch (Exception e) {
        PolymapWorkbench.handleError(KapsPlugin.PLUGIN_ID, this, "Fehler beim ffnen der Wohnungstabelle.", e);
    }
}

From source file:org.rssowl.ui.internal.dialogs.fatal.ErrorInfoPage.java

License:Open Source License

@Override
public void setVisible(boolean visible) {
    super.setVisible(visible);

    /* Transfer Focus to Buttons, otherwise a link is focussed which looks weird */
    if (visible) {
        Button focusButton = ((CustomWizardDialog) getContainer()).getButton(IDialogConstants.NEXT_ID);
        if (focusButton == null)
            focusButton = ((CustomWizardDialog) getContainer()).getButton(IDialogConstants.FINISH_ID);

        if (focusButton != null)
            focusButton.setFocus();//from  www. j a v  a 2  s. com
    }
}

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();//w ww. j  av  a2s.c  om
    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.RegisterWizardPage1.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {

    if (IDialogConstants.NEXT_ID == buttonId) {
        emailStr = getEmail();/*from w  ww. ja v  a2  s.  co m*/
        setEmailStr(emailStr);
        countryStr = getCountry();
        boolean alreadyRegistered = false;
        String firstname = "";//$NON-NLS-N$
        String lastname = "";//$NON-NLS-N$
        String pseudonym = "";//$NON-NLS-N$
        String password = "";//$NON-NLS-N$

        try {
            String userInfos = RegisterManagement.getInstance().checkUser(emailStr, isProxyEnable, proxyHost,
                    proxyPort, proxyUser, proxyPassword);
            if (userInfos != null && !"".equals(userInfos)) {
                alreadyRegistered = true;
                String[] split = userInfos.split(",");//$NON-NLS-N$
                if (split.length > 2) {

                    firstname = split[0];
                    if (split[0] != null && split[0].length() > 1 && split[0].startsWith("\"")
                            && split[0].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
                        firstname = split[0].substring(1, split[0].length() - 1);
                    }
                    if (split[1] != null && split[1].length() > 1 && split[1].startsWith("\"")
                            && split[1].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
                        lastname = split[1].substring(1, split[1].length() - 1);
                    }
                    if (split[2] != null && split[2].length() > 1 && split[2].startsWith("\"")
                            && split[2].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
                        pseudonym = split[2].substring(1, split[2].length() - 1);
                    }
                    //                        if (split[3] != null && split[3].length() > 1 && split[3].startsWith("\"") && split[3].endsWith("\"")) {//$NON-NLS-N$//$NON-NLS-N$
                    // password = split[3].substring(1, split[3].length() - 1);
                    // }
                }

            }
        } catch (BusinessException e) {
            alreadyRegistered = false;
            // MessageBoxExceptionHandler.process(e);

        }

        close();
        RegisterWizard registerWizard = new RegisterWizard();
        RegisterWizardPage2 dialog = new RegisterWizardPage2(this.getShell(), registerWizard, emailStr,
                countryStr, alreadyRegistered, firstname, lastname, pseudonym, password, isProxyEnable,
                proxyHost, proxyPort);
        dialog.open();
    } else if (IDialogConstants.CANCEL_ID == buttonId) {
        RegisterManagement.decrementTry();
        RegisterManagement.increaseFailRegisterTimes();
        close();
    } else if (IDialogConstants.HELP_ID == buttonId) {
        NetworkSettingDialog netSettingDialog = new NetworkSettingDialog(getParentShell());
        if (netSettingDialog.open() == Dialog.OK) {
            String[] proxyString = netSettingDialog.getProxyString();
            proxyHost = proxyString[0];
            proxyPort = proxyString[1];
            proxyUser = proxyString[2];
            proxyPassword = proxyString[3];
            if (proxyHost != null && !"".equals(proxyHost)) {//$NON-NLS-N$
                isProxyEnable = true;
            }
        } else {
            proxyHost = null;
            proxyPort = null;
            proxyUser = null;
            proxyPassword = null;
            isProxyEnable = false;
        }
    }
}

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

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.HELP_ID, Messages.getString("RegisterWizardPage.netWorkSetting"),
            true);//from ww  w.  ja v  a 2 s .co  m
    new Label(parent, SWT.NONE);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("RegisterWizardPage.registerLater"),
            true);
    new Label(parent, SWT.NONE);
    new Label(parent, SWT.NONE);
    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, true);
    if (emailText.getText() != null && !"".equals(emailText.getText())) {
        nextButton.setEnabled(true);
    } else {
        nextButton.setEnabled(false);
    }
}

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 {//  ww  w .  ja v  a2s.c  o m
            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);
        }
    }

}