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

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

Introduction

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

Prototype

int CANCEL_ID

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

Click Source Link

Document

Button id for a "Cancel" button (value 1).

Usage

From source file:com.astra.ses.spell.gui.dialogs.AttachModeDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//from   w w  w  . j  a v a  2  s.co m
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:com.astra.ses.spell.gui.dialogs.AttachModeDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * //from   w  ww  . j av  a2  s .c  om
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    setReturnCode(buttonId);
    switch (buttonId) {
    case IDialogConstants.OK_ID:
    case IDialogConstants.CANCEL_ID:
        close();
        break;
    }
}

From source file:com.astra.ses.spell.gui.dialogs.CloseAllDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//  www  .  ja v  a2 s  . c om
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, DETACH, "Detach all", false);
    createButton(parent, CLOSE, "Close all", false);
    createButton(parent, KILL, "Kill all", false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

From source file:com.astra.ses.spell.gui.dialogs.CloseProcDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//  w ww.  j  a  v a  2  s . c  om
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    if (m_mode != ClientMode.CONTROLLING) {
        createButton(parent, DETACH, "Stop monitor", false);
    } else {
        if (!m_promptActive) {
            createButton(parent, DETACH, "Release control", false);
            createButton(parent, CLOSE, "Stop execution", false);
        }
        createButton(parent, KILL, "Kill execution", false);
    }
    Button cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
    cancel.setFocus();
}

From source file:com.astra.ses.spell.gui.dialogs.ConditionDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons.//  w w w.  j a  v  a 2  s.c om
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

From source file:com.astra.ses.spell.gui.dialogs.ConditionDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * //  www  .ja  v  a2 s . c o  m
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    m_condition = null;
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        try {
            if (m_absTimeOption.getSelection()) {
                parseAbsTimeCondition();
            } else if (m_relTimeOption.getSelection()) {
                parseRelTimeCondition();
            } else if (m_tmOption.getSelection()) {
                parseTmCondition();
            }
            //            else if (m_customOption.getSelection())
            //            {
            //               parseCustomCondition();
            //            }
            Logger.debug("Scheduling condition: " + m_condition, Level.PROC, this);
            close();
        } catch (ParseException ex) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(), "Condition definition error",
                    ex.getLocalizedMessage());
        }
        break;
    case IDialogConstants.CANCEL_ID:
        close();
    }
}

From source file:com.astra.ses.spell.gui.dialogs.ConfirmDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * /*from   www.j a v  a 2  s.c om*/
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        setReturnCode(1);
        break;
    case IDialogConstants.CANCEL_ID:
        setReturnCode(0);
        break;
    }
    close();
}

From source file:com.astra.ses.spell.gui.dialogs.DefaultsDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*from   w ww . j  a va  2 s .co  m*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*www. j  a v a 2  s .co  m*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (!m_readOnly) {
        createButton(parent, IDialogConstants.BACK_ID, "Revert Changes", false);
        createButton(parent, IDialogConstants.OK_ID, "Apply and Close", false);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        getButton(IDialogConstants.BACK_ID).setEnabled(false);
    }
    createButton(parent, IDialogConstants.CANCEL_ID, "Close", true);
}

From source file:com.astra.ses.spell.gui.dialogs.DictionaryEditorDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * /*from   w w w  .jav a 2  s.c  o  m*/
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        if (m_container.hasChanges()) {
            boolean mergeNew = false;
            // The button can be null for dialogs without file import
            if (m_chkMergeNew != null) {
                m_chkMergeNew.getSelection();
            }
            UpdateDataContainerJob job = new UpdateDataContainerJob(m_procId, m_container, mergeNew);
            CommandHelper.executeInProgress(job, true, true);
            m_varTable.refresh();
            if (job.result == CommandResult.FAILED) {
                MessageDialog.openError(getShell(), "Update Error",
                        "Failed to update changes to dictionary:\n" + job.error);
                return;
            }
        }
    } else if (buttonId == IDialogConstants.BACK_ID) {
        doRevert();
        return;
    } else if (buttonId == IDialogConstants.CANCEL_ID) {
        if (m_container.hasChanges()) {
            if (!MessageDialog.openConfirm(getShell(), "Changes made",
                    "There are changes made to the data container variables.\n\n"
                            + "If you close the dialog, these changes will be lost. "))
                return;
        }
        if (!m_fileContainer.getVariables().isEmpty()) {
            if (!MessageDialog.openConfirm(getShell(), "File loaded",
                    "There are NO changes made to the data container variables, but an input file was loaded.\n\n"
                            + "If you close the dialog, no changes will be applied. Are you sure to close?"))
                return;
        }
    }
    close();
}