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:net.heartsome.license.OfflineActiveDialog.java

@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button backBtn = createButton(parent, IDialogConstants.BACK_ID,
            Messages.getString("license.OfflineActiveDialog.backBtn"), false);

    backBtn.addSelectionListener(new SelectionAdapter() {

        @Override/*  w w  w .ja v a  2 s. c  om*/
        public void widgetSelected(SelectionEvent e) {
            setReturnCode(OK);
            Point p = getShell().getLocation();
            close();
            ActiveMethodDialog dialog = new ActiveMethodDialog(getShell(), p);
            dialog.open();
        }

    });

    super.createButtonsForButtonBar(parent);
    Button nextBtn = getButton(IDialogConstants.OK_ID);
    nextBtn.setText(Messages.getString("license.LicenseAgreementDialog.nextBtn"));
    Button exitBtn = getButton(IDialogConstants.CANCEL_ID);
    exitBtn.setText(Messages.getString("license.LicenseAgreementDialog.exitBtn"));
}

From source file:net.refractions.udig.catalog.ui.FileConnectionPage.java

License:Open Source License

private void selectAndContinueWizard() {
    boolean okPressed;
    list.clear();/*  w ww  . j  a  v a 2s .co  m*/
    okPressed = openFileDialog(comp);
    viewer.setInput(list);
    getContainer().updateButtons();

    /*
     * XXX I'm not liking this. I think the workflow should be used to drive the pages because
     * by trying to put the buttons it is dependent the implementation of
     * ConnectionPageDecorator's isPageComplete method as well as what order the
     * WorkflowWizard's canFinish method is implemented. IE if canFinish does not call
     * isPageComplete before calling dryRun() the finish button will not be activated.
     */
    if (okPressed) {
        if (findButton(getShell().getChildren(), IDialogConstants.FINISH_ID).isEnabled()) {
            pushButton(IDialogConstants.FINISH_ID);
        } else {
            pushButton(IDialogConstants.NEXT_ID);
        }
    } else {
        pushButton(IDialogConstants.BACK_ID);
    }

}

From source file:net.refractions.udig.ui.PlatformGIS.java

License:Open Source License

/**
 * Runs a blocking task in a ProgressDialog. It is ran in such a way that even if the task
 * blocks it can be cancelled. This is unlike the normal ProgressDialog.run(...) method which
 * requires that the {@link IProgressMonitor} be checked and the task to "nicely" cancel.
 * // w  w  w  . j  av  a 2s  .  c  o  m
 * @param dialogTitle The title of the Progress dialog
 * @param showRunInBackground if true a button added to the dialog that will make the job be ran
 *        in the background.
 * @param runnable the task to execute.
 * @param runASync if true the runnable will be ran asynchronously
 */
public static void runInProgressDialog(final String dialogTitle, final boolean showRunInBackground,
        final IRunnableWithProgress runnable, boolean runASync) {

    Runnable object = new Runnable() {
        public void run() {
            Shell shell = Display.getDefault().getActiveShell();
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell) {
                @Override
                protected void configureShell(Shell shell) {
                    super.configureShell(shell);
                    shell.setText(dialogTitle);
                }

                @Override
                protected void createButtonsForButtonBar(Composite parent) {
                    if (showRunInBackground)
                        createBackgroundButton(parent);
                    super.createButtonsForButtonBar(parent);
                }

                private void createBackgroundButton(Composite parent) {
                    createButton(parent, IDialogConstants.BACK_ID, Messages.PlatformGIS_background, true);
                }

                @Override
                protected void buttonPressed(int buttonId) {
                    if (buttonId == IDialogConstants.BACK_ID) {
                        getShell().setVisible(false);
                    } else
                        super.buttonPressed(buttonId);
                }
            };
            try {

                dialog.run(true, true, new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor) {
                        try {
                            runBlockingOperation(new IRunnableWithProgress() {

                                public void run(IProgressMonitor monitor)
                                        throws InvocationTargetException, InterruptedException {
                                    runnable.run(monitor);
                                }
                            }, monitor);
                        } catch (Exception e) {
                            UiPlugin.log("", e); //$NON-NLS-1$
                        }

                    }
                });
            } catch (Exception e) {
                UiPlugin.log("", e); //$NON-NLS-1$
            }
        }
    };

    if (runASync)
        Display.getDefault().asyncExec(object);
    else
        syncInDisplayThread(object);
}

From source file:net.refractions.udig.ui.PlatformJobs.java

License:Open Source License

/**
 * Runs a blocking task in a ProgressDialog. It is ran in such a way that even if the task
 * blocks it can be cancelled. This is unlike the normal ProgressDialog.run(...) method which
 * requires that the {@link IProgressMonitor} be checked and the task to "nicely" cancel.
 * /* w w  w . jav  a2s. c  o m*/
 * @param dialogTitle The title of the Progress dialog
 * @param showRunInBackground if true a button added to the dialog that will make the job be ran
 *        in the background.
 * @param runnable the task to execute.
 * @param runASync if true the runnable will be ran asynchronously
 */
public static void runInProgressDialog(final String dialogTitle, final boolean showRunInBackground,
        final IRunnableWithProgress runnable, boolean runASync) {

    Runnable object = new Runnable() {
        public void run() {
            Shell shell = Display.getDefault().getActiveShell();
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell) {
                @Override
                protected void configureShell(Shell shell) {
                    super.configureShell(shell);
                    shell.setText(dialogTitle);
                }

                @Override
                protected void createButtonsForButtonBar(Composite parent) {
                    if (showRunInBackground)
                        createBackgroundButton(parent);
                    super.createButtonsForButtonBar(parent);
                }

                private void createBackgroundButton(Composite parent) {
                    createButton(parent, IDialogConstants.BACK_ID, Messages.get("PlatformGIS_background"),
                            true);
                }

                @Override
                protected void buttonPressed(int buttonId) {
                    if (buttonId == IDialogConstants.BACK_ID) {
                        getShell().setVisible(false);
                    } else
                        super.buttonPressed(buttonId);
                }
            };
            try {
                final Display display = Display.getCurrent();
                dialog.run(true, true, new IRunnableWithProgress() {
                    public void run(final IProgressMonitor monitor) {
                        try {
                            UICallBack.runNonUIThreadWithFakeContext(display, new Runnable() {
                                public void run() {
                                    try {
                                        // thread already forked by the dialog
                                        runnable.run(monitor);
                                    } catch (InvocationTargetException e) {
                                        throw new RuntimeException("", e.getTargetException());
                                    } catch (InterruptedException e) {
                                        throw new RuntimeException(e.getMessage());
                                    }
                                }
                            });

                            //                                runSync(new IRunnableWithProgress(){
                            //
                            //                                    public void run( IProgressMonitor monitor )
                            //                                            throws InvocationTargetException, InterruptedException {
                            //                                        runnable.run(monitor);
                            //                                    }
                            //                                }, monitor);
                        } catch (Exception e) {
                            UiPlugin.log("", e); //$NON-NLS-1$
                        }

                    }
                });
            } catch (Exception e) {
                UiPlugin.log("", e); //$NON-NLS-1$
            }
        }
    };

    Display.getCurrent().syncExec(object);
    //        if (runASync)
    //            Display.getDefault().asyncExec(object);
    //        else
    //            PlatformGIS.syncInDisplayThread(object);
}

From source file:net.sf.eclipsecs.ui.config.RuleConfigurationEditDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {

    Button defautlt = createButton(parent, IDialogConstants.BACK_ID,
            Messages.RuleConfigurationEditDialog_btnDefaul, false);
    defautlt.setEnabled(!mReadonly);/*from   w w w .  ja  v  a  2  s .  c  om*/

    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:net.sf.eclipsecs.ui.config.RuleConfigurationEditDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
 *///from   w  w w . j a  v  a  2  s  .  co m
protected void buttonPressed(int buttonId) {
    if (IDialogConstants.BACK_ID == buttonId) {

        if (MessageDialog.openConfirm(getShell(), Messages.RuleConfigurationEditDialog_titleRestoreDefault,
                Messages.RuleConfigurationEditDialog_msgRestoreDefault)) {

            if (mRule.getMetaData().hasSeverity()) {
                mSeverityCombo
                        .setSelection(new StructuredSelection(mRule.getMetaData().getDefaultSeverityLevel()));
                mCommentText.setText(new String());
            }

            // restore the default value for the properties
            int size = mConfigPropertyWidgets != null ? mConfigPropertyWidgets.length : 0;
            for (int i = 0; i < size; i++) {
                mConfigPropertyWidgets[i].restorePropertyDefault();
            }
        }
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:net.sf.eclipsecs.ui.stats.views.internal.CheckstyleMarkerFilterDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *///from w ww. j a va 2  s  .  c  o  m
protected void createButtonsForButtonBar(Composite parent) {

    mBtnDefault = createButton(parent, IDialogConstants.BACK_ID,
            Messages.CheckstyleMarkerFilterDialog_btnRestoreDefault, false);
    mBtnDefault.addSelectionListener(mController);

    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:org.bonitasoft.studio.connector.model.definition.dialog.ConnectorDefinitionWizardDialog.java

License:Open Source License

@Override
public void showPage(IWizardPage page) {
    super.showPage(page);
    if (page instanceof PageWidgetsWizardPage) {
        ExtensibleWizard wizard = (ExtensibleWizard) getWizard();
        wizard.addAdditionalPage(page);//from   www  . j a v  a 2 s .  c  o  m
        updateButtons();
        getButton(IDialogConstants.FINISH_ID).setText(Messages.apply);
        getButton(IDialogConstants.NEXT_ID).setVisible(false);
        getButton(IDialogConstants.BACK_ID).setVisible(false);
    } else {
        getButton(IDialogConstants.NEXT_ID).setVisible(true);
        getButton(IDialogConstants.BACK_ID).setVisible(true);
        getButton(IDialogConstants.FINISH_ID).setText(IDialogConstants.FINISH_LABEL);
    }
}

From source file:org.continuousassurance.swamp.eclipse.dialogs.PlatformDialog.java

License:Apache License

/**
 * Creates buttons for the window's button bar
 *
 * @param parent the parent Composite that the buttons will be placed on 
 * top of/* w  ww . j  a  v  a2  s  .co m*/
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false));
    Button clear = createButton(parent, IDialogConstants.NO_ID, DialogUtil.CLEAR_CAPTION, false);
    clear.addSelectionListener(new ClearButtonSelectionListener());
    createButton(parent, IDialogConstants.BACK_ID, DialogUtil.BACK_CAPTION, false);
    createButton(parent, IDialogConstants.OK_ID, DialogUtil.OK_CAPTION, true);
    createButton(parent, IDialogConstants.CANCEL_ID, DialogUtil.CANCEL_CAPTION, false);
}

From source file:org.continuousassurance.swamp.eclipse.dialogs.PlatformDialog.java

License:Apache License

/**
 * Method for handling button presses on this dialog
 *
 * @param buttonID the ID of the button that was selected
 *//*from  ww w.ja  v  a2 s .  com*/
@Override
public void buttonPressed(int buttonID) {
    switch (buttonID) {
    case IDialogConstants.OK_ID:
        okPressed();
        break;
    case IDialogConstants.BACK_ID:
        backPressed();
        break;
    case IDialogConstants.CANCEL_ID:
        super.cancelPressed();
    }
}