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:com.nokia.tools.startuptip.ui.StartupTipDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (IDialogConstants.OK_ID == buttonId) {
        okPressed();/*from  w  w  w. j  av a2s .c o  m*/
    } else if (IDialogConstants.NEXT_ID == buttonId) {
        nextPressed();
    } else if (StartupTipDialog.PREVIOUS_ID == buttonId) {
        previousPressed();
    }
}

From source file:com.nokia.tools.startuptip.ui.StartupTipDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    previousButton = createButton(parent, StartupTipDialog.PREVIOUS_ID, StartupTipDialog.PREVIOUS_LABEL, false);
    if (!tipSelector.previousAvailable()) {
        previousButton.setEnabled(false);
    }/*  ww w. j  a va  2s .c o m*/
    createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:dynamicrefactoring.interfaz.wizard.CustomWizardDialog.java

License:Open Source License

/**
 * Crea los botones del dilogo en que se muestra un asistente.
 * //w w w .ja va 2s. c  o  m
 * @param parent el componente padre que contendr los botones.
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    if (super.getButton(IDialogConstants.FINISH_ID) != null)
        super.getButton(IDialogConstants.FINISH_ID).setText(ButtonTextProvider.getFinishText());

    if (super.getButton(IDialogConstants.CANCEL_ID) != null)
        super.getButton(IDialogConstants.CANCEL_ID).setText(ButtonTextProvider.getCancelText());

    if (super.getButton(IDialogConstants.BACK_ID) != null)
        super.getButton(IDialogConstants.BACK_ID).setText(ButtonTextProvider.getBackText());

    if (super.getButton(IDialogConstants.NEXT_ID) != null)
        super.getButton(IDialogConstants.NEXT_ID).setText(ButtonTextProvider.getNextText());
}

From source file:es.cv.gvcase.ide.navigator.dialogs.NavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    backButton.setEnabled(false);/*w  w  w  .j  a va  2 s  .c o  m*/
    backButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == 0) {
                index = matchedObjects.size() - 1;
            }
            index--;
            if (index < 0) {
                index = 0;
            }
            StructuredSelection ss = new StructuredSelection(matchedObjects.get(index));
            viewer.setSelection(ss, true);
        }
    });

    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    nextButton.setEnabled(false);
    nextButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == matchedObjects.size() - 1) {
                index = -1;
            }
            index++;
            StructuredSelection ss = new StructuredSelection(matchedObjects.get(index));
            viewer.setSelection(ss, true);
        }
    });

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:eu.abc4trust.ri.ui.user.wizard.IssueWizardDialog.java

License:Open Source License

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

    Button ok = getButton(IDialogConstants.NEXT_ID);
    ok.setText("Get credential!");
    setButtonLayoutData(ok);//from   ww w  .  j  av a2s  .  c  o m
    ok.addMouseListener(new MouseListener() {
        private static final long serialVersionUID = 6732595815149773092L;

        @Override
        public void mouseDoubleClick(MouseEvent arg0) {
        }

        @Override
        public void mouseDown(MouseEvent arg0) {
            ProtocolHandler.doProtocol(wizard);
        }

        @Override
        public void mouseUp(MouseEvent arg0) {
        }

    });

    Button finish = getButton(IDialogConstants.FINISH_ID);
    finish.setText("Thanks!");
    setButtonLayoutData(finish);

    Button cancel = getButton(IDialogConstants.CANCEL_ID);
    cancel.setText("I changed my mind");
    setButtonLayoutData(cancel);
}

From source file:eu.aniketos.wp1.ststool.report.handlers.GenerateReportHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

    try {/*from w  ww .  jav  a2  s  .c om*/
        final IWorkbenchWindow window;
        if (event != null)
            window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
        else
            window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

        if (!(window.getActivePage().getActiveEditor() instanceof StsToolDiagramEditor))
            return null;
        GenerateReportWizard wizard = new GenerateReportWizard(
                (StsToolDiagramEditor) window.getActivePage().getActiveEditor());
        WizardDialog dialog = new WizardDialog(window.getShell(), wizard) {

            @Override
            public void updateButtons() {
                super.updateButtons();
                boolean canFlipToNextPage = false;
                if (getButton(IDialogConstants.NEXT_ID) != null) {
                    canFlipToNextPage = getCurrentPage().canFlipToNextPage();
                }
                if (canFlipToNextPage) {
                    getShell().setDefaultButton(getButton(IDialogConstants.NEXT_ID));
                } else {
                    getShell().setDefaultButton(getButton(IDialogConstants.FINISH_ID));
                }
            }

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

    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:eu.numberfour.n4js.ui.organize.imports.MultiElementListSelectionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fBackButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);

    // XXX: Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=279425
    boolean HAS_BUG_279425 = true;
    fNextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, !HAS_BUG_279425);
    fFinishButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.FINISH_LABEL, HAS_BUG_279425);

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:kr.co.apexsoft.stella.modeler.explorer.dialog.ApexNavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    backButton.setEnabled(false);/*from w  ww.  j ava2s.com*/
    nextButton.setEnabled(false);

    nextButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (currentIndex >= matchedObjects.size() - 1) {
                currentIndex = 0;
            } else {
                currentIndex++;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
        }

    });

    backButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (currentIndex <= 0) {
                currentIndex = matchedObjects.size() - 1;
            } else {
                currentIndex--;
            }
            fireSetSelection(new StructuredSelection(matchedObjects.get(currentIndex)), true);
        }

    });
}

From source file:net.geoprism.shapefile.LocalizedWizardDialog.java

License:Open Source 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  a 2s  .co m*/
 * 
 * @param parent
 *          the parent button bar
 * @return a composite containing the new buttons
 */
private Composite createPreviousAndNextButtons(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());
    backButton = createButton(composite, IDialogConstants.BACK_ID, Localizer.getMessage("BACK"), false);
    nextButton = createButton(composite, IDialogConstants.NEXT_ID, Localizer.getMessage("NEXT"), false);
    return composite;
}

From source file:net.refractions.udig.catalog.tests.ui.workflow.ConnectionFileTest.java

License:Open Source License

@Test
public void testButtonState() {
    Assertion a1 = new Assertion() {
        @Override//w  w  w  . j  av  a  2 s .c om
        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();
}