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.StartWithParametersDialog.java

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * /*w  w  w  .j av  a  2s  . c o m*/
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        try {
            if (parseArguments()) {
                close();
            }
        } catch (Exception ex) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(), "Argument definition error",
                    ex.getLocalizedMessage());
        }
        break;
    case IDialogConstants.CANCEL_ID:
        m_argExpression = null;
        close();
    }
}

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

License:Open Source License

/***************************************************************************
 * Called when one of the buttons of the button bar is pressed.
 * //from  w w w .j  a  v a 2  s.c  o  m
 * @param buttonId
 *            The button identifier.
 **************************************************************************/
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        m_answer = m_text.getText();
        if (m_answer.length() == 0) {
            return;
        }
        setReturnCode(TitleAreaDialog.OK);
        break;
    case IDialogConstants.CANCEL_ID:
        m_answer = null;
        setReturnCode(TitleAreaDialog.CANCEL);
        break;
    }
    close();
}

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

License:Open Source License

/***************************************************************************
 * Create the button bar buttons./*  w w  w. j a v  a2 s  .  com*/
 * 
 * @param parent
 *            The Button Bar.
 **************************************************************************/
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, "Replay", false);
    createButton(parent, SAVE_ID, "Save as...", false);
    getButton(IDialogConstants.OK_ID).setEnabled(false);
    getButton(SAVE_ID).setEnabled(false);
    createButton(parent, IDialogConstants.CANCEL_ID, "Close", true);
}

From source file:com.astra.ses.spell.gui.views.ProcedureView.java

License:Open Source License

/***************************************************************************
 * Called when the procedure view is about to close and the procedure status
 * implies that the procedure is not directly closeable
 **************************************************************************/
@Override/*from w ww  .j  a  v a  2 s.  c  o m*/
public int promptToSaveOnClose() {
    Logger.debug("Procedure not directly closeable, asking user", Level.GUI, this);
    Shell shell = Display.getCurrent().getActiveShell();
    ExecutorStatus st = getModel().getStatus();
    ClientMode mode = getModel().getInfo().getMode();
    String status = st.toString();
    String name = m_model.getProcName();
    boolean onPrompt = m_model.isWaitingInput();
    CloseProcDialog dialog = new CloseProcDialog(shell, name, status, mode, onPrompt);
    int retcode = dialog.open();
    Logger.debug("User selection " + retcode, Level.GUI, this);
    if (retcode == IDialogConstants.CANCEL_ID) {
        Logger.debug("Cancelling closure", Level.GUI, this);
        return ISaveablePart2.CANCEL;
    } else if (retcode == CloseProcDialog.DETACH) {
        m_closeMode = CloseMode.DETACH;
    } else if (retcode == CloseProcDialog.KILL) {
        if (onPrompt)
            cancelPrompt();
        m_closeMode = CloseMode.KILL;
    } else if (retcode == CloseProcDialog.CLOSE) {
        m_closeMode = CloseMode.CLOSE;
    }
    return ISaveablePart2.NO;
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.dialogs.AbstractCrucibleReviewActionDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    Button summarizeButton = createButton(parent, IDialogConstants.CLIENT_ID + 1, actionText, false);
    summarizeButton.addSelectionListener(new SelectionAdapter() {
        @Override/*w  w  w  .j  av  a2s.  c  o m*/
        public void widgetSelected(SelectionEvent e) {
            doAction();
        }
    });

    Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
            false);

    cancelButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            cancelPressed();
        }
    });

}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.dialogs.CrucibleAddCommentDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    saveButton = createButton(parent, IDialogConstants.CLIENT_ID + 2, SAVE_LABEL, false);
    saveButton.addSelectionListener(new SelectionAdapter() {
        @Override/*from  www  . j a v  a  2 s. c  om*/
        public void widgetSelected(SelectionEvent e) {
            addComment();
        }
    });
    saveButton.setEnabled(false);
    if (!edit) { // if it is a new reply, saving as draft is possible
        saveDraftButton = createButton(parent, IDialogConstants.CLIENT_ID + 2, DRAFT_LABEL, false);
        saveDraftButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                draft = true;
                addComment();
            }
        });
        saveDraftButton.setEnabled(false);
    }
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false)
            .addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    cancelPressed();
                }
            });
}

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.dialogs.CrucibleEditCommentDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {

    updateButton = createButton(parent, IDialogConstants.CLIENT_ID + 2, UPDATE_LABEL, false);
    updateButton.addSelectionListener(new SelectionAdapter() {
        @Override/*www .  j  a  va  2  s  .c o  m*/
        public void widgetSelected(SelectionEvent e) {
            updateComment(false);
        }
    });
    updateButton.setEnabled(false);
    if (CrucibleUtil.canPublishDraft(comment)) {
        saveDraftButton = createButton(parent, IDialogConstants.CLIENT_ID + 2, DRAFT_LABEL, false);
        saveDraftButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                updateComment(true);
            }
        });
        saveDraftButton.setEnabled(false);
    }
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false)
            .addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    cancelPressed();
                }
            });
}

From source file:com.bdaum.zoom.ui.internal.dialogs.CategorizeDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (size > 1) {
        createButton(parent, BACK_ID, Messages.CategorizeDialog_back,
                Messages.CategorizeDialog_previous_tooltip, false);
        createButton(parent, NEXT_ID, Messages.CategorizeDialog_next, Messages.CategorizeDialog_next_tooltip,
                false);/*from   w  w  w . j av  a2s  . c o m*/
        createButton(parent, CLONE_ID, Messages.CategorizeDialog_clone, Messages.CategorizeDialog_clone_tooltip,
                true);
    }
    createButton(parent, DONE_ID, Messages.CategorizeDialog_done, Messages.CategorizeDialog_done_tooltip, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
            Messages.CategorizeDialog_cancel_tooltip, false);
}

From source file:com.bdaum.zoom.ui.internal.dialogs.CategorizeDialog.java

License:Open Source License

@Override
public void keyPressed(KeyEvent e) {
    switch (e.character) {
    case SWT.CR:/*from  w w  w  .ja  va2  s.  c om*/
        buttonPressed(DONE_ID);
        break;
    case SWT.ESC:
        buttonPressed(IDialogConstants.CANCEL_ID);
        break;
    default:
        switch (e.keyCode & SWT.KEY_MASK) {
        case SWT.ARROW_LEFT:
            if (current > 1)
                buttonPressed(BACK_ID);
            break;
        case SWT.ARROW_RIGHT:
            if (current < size - 1) {
                if ((e.stateMask & SWT.CTRL) == SWT.CTRL) {
                    if (current > 1)
                        buttonPressed(CLONE_ID);
                } else
                    buttonPressed(NEXT_ID);
            }
            break;
        }
        break;
    }
}

From source file:com.bdaum.zoom.ui.internal.dialogs.PurgeEmptyDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, UNDO, Messages.PurgeEmptyDialog_undo, false).setEnabled(false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}