Example usage for org.eclipse.jface.dialogs Dialog getReturnCode

List of usage examples for org.eclipse.jface.dialogs Dialog getReturnCode

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog getReturnCode.

Prototype

public int getReturnCode() 

Source Link

Document

Returns this window's return code.

Usage

From source file:org.eclipse.jubula.client.ui.rcp.properties.ProjectGeneralPropertyPage.java

License:Open Source License

/**
 * @param parent The parent <code>Composite</code>
 *//*  ww  w  .ja  v a 2s  . c  o  m*/
private void createTrackChangesDeleteDataButton(Composite parent) {
    m_deleteChanges = new Button(parent, SWT.PUSH);
    m_deleteChanges.setText(Messages.PrefPageTrackChangesDeleteData);
    GridData gridData = new GridData(SWT.END, SWT.BEGINNING, false, false);
    gridData.horizontalSpan = 1;
    gridData.grabExcessHorizontalSpace = false;
    m_deleteChanges.setLayoutData(gridData);

    m_deleteChanges.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Dialog qDialog = new MessageDialog(getShell(), Messages.UtilsConfirmation, null,
                    Messages.PrefPageTrackChangesDeleteDataQuestion, MessageDialog.QUESTION,
                    new String[] { Messages.UtilsYes, Messages.UtilsNo }, 0);
            qDialog.setBlockOnOpen(true);
            qDialog.open();
            if (qDialog.getReturnCode() == 0) {
                // delete all tracked changes
                try {
                    PlatformUI.getWorkbench().getProgressService().run(true, false,
                            new DeleteTrackedChangesOperation());
                } catch (InvocationTargetException ite) {
                    // nothing
                } catch (InterruptedException ie) {
                    // nothing
                }
            }
        }
    });
}

From source file:org.eclipse.jubula.client.ui.rcp.widgets.TreeElementChooserComposite.java

License:Open Source License

/**
 * Handles the selectionEvent of the selectionTwoToOneButton.
 *///  www . j  av  a  2  s.  c om
protected void handleSelectionUsedToAvailableButtonEvent() {
    if (m_selectionUsedToAvailableButton.getEnabled()) {
        String[] usedSelection = m_usedList.getSelection();

        if (checkSelectionUsedToAvailable(usedSelection) == null) {
            for (String sel : m_usedList.getSelection()) {
                IChooserCompositeGuiObject guiObj = m_listItemsToGuiObjects.get(sel);
                makeObjectAvailable(guiObj, false);
            }

            checkButtons();
            fireListModified();

        } else {
            Dialog dialog = ErrorHandlingUtil
                    .createMessageDialog(MessageIDs.I_COULD_NOT_REMOVE_REUSED_PROJECTS);
            dialog.getReturnCode();
        }
    }
}

From source file:org.eclipse.jubula.client.ui.rcp.widgets.TreeElementChooserComposite.java

License:Open Source License

/**
 * Handles the selectionEvent of the allTwoToOneButton.
 *///www. j  a v  a  2 s .  co m
protected void handleAllUsedToAvailableButtonEvent() {

    String[] usedItems = m_usedList.getItems();
    String errorMsg = checkSelectionUsedToAvailable(usedItems);
    if (errorMsg == null) {
        for (String listItem : usedItems) {
            makeObjectAvailable(m_listItemsToGuiObjects.get(listItem), false);
        }
        m_usedList.removeAll();
        fireListModified();
        checkButtons();
    } else {
        Dialog dialog = ErrorHandlingUtil.createMessageDialog(MessageIDs.I_COULD_NOT_REMOVE_REUSED_PROJECTS);
        dialog.getReturnCode();
    }
}

From source file:org.nuxeo.ide.sdk.server.ui.SDKPreferencePage.java

License:Open Source License

public void downloadSDK() {
    SDKTableWidget sdkWidget = (SDKTableWidget) form.getWidget("sdks");
    Shell shell = sdkWidget.getControl().getParent().getShell();
    String text = "Would you like to open the Nuxeo SDK download page in you web browser ?\n\nFrom there, you can download the latest SDK and extract it to the location of your choice. Register it to eclipse with the \"Add\" button.\n";
    Dialog dialog = new MessageDialog(shell, "Download SDK", null, text, MessageDialog.QUESTION,
            new String[] { "open browser", "cancel" }, 0);
    dialog.open();/*  w  w w  . jav a  2  s  . com*/
    if (dialog.getReturnCode() != Dialog.OK) {
        return;
    }
    Program.launch("http://doc.nuxeo.com/x/b4KE");
}