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.hangum.tadpole.mongodb.core.dialogs.users.UserManagerDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (APPEND_USER_ID == buttonId) {
        String id = textID.getText().trim();
        String passwd = textPassword.getText().trim();
        String passwd2 = textRePassword.getText().trim();
        boolean isReadOnly = btnReadOnly.getSelection();

        if ("".equals(id)) { //$NON-NLS-1$
            MessageDialog.openError(null, "Error", Messages.UserManagerDialog_11); //$NON-NLS-1$
            textID.setFocus();/*from   ww  w  . j  av  a  2 s.c om*/
            return;
        } else if ("".equals(passwd)) { //$NON-NLS-1$
            MessageDialog.openError(null, "Error", Messages.UserManagerDialog_14); //$NON-NLS-1$
            textPassword.setFocus();
            return;
        } else if ("".equals(passwd2)) { //$NON-NLS-1$
            MessageDialog.openError(null, "Error", Messages.UserManagerDialog_17); //$NON-NLS-1$
            textRePassword.setFocus();
            return;
        } else if (!passwd.equals(passwd2)) {
            MessageDialog.openError(null, "Error", Messages.UserManagerDialog_19); //$NON-NLS-1$
            textPassword.setFocus();
            return;
        }

        try {
            MongoDBQuery.addUser(userDB, id, passwd2, isReadOnly);

            initTable();
        } catch (Exception e) {
            logger.error("mongodb add user", e); //$NON-NLS-1$

            Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); //$NON-NLS-1$
            ExceptionDetailsErrorDialog.openError(null, "Error", "Add User Exception", errStatus); //$NON-NLS-1$ //$NON-NLS-2$

            return;
        }
    } else if (buttonId == DELETE_ID) {
        IStructuredSelection is = (IStructuredSelection) tableViewerUser.getSelection();
        Object selElement = is.getFirstElement();

        if (selElement instanceof UserDTO) {
            if (MessageDialog.openConfirm(null, "Confirm", Messages.UserManagerDialog_22)) { //$NON-NLS-1$
                UserDTO user = (UserDTO) selElement;
                try {
                    MongoDBQuery.deleteUser(userDB, user.getId());

                    listUser.remove(user);
                    tableViewerUser.refresh();
                } catch (Exception e1) {
                    logger.error("mongodb delete user", e1); //$NON-NLS-1$

                    Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e1.getMessage(), e1); //$NON-NLS-1$
                    ExceptionDetailsErrorDialog.openError(null, "Error", "Delete User Exception", errStatus); //$NON-NLS-1$ //$NON-NLS-2$
                }
            }
        } else {
            MessageDialog.openError(null, "Confirm", "  ? ? .");
        }
    } else if (buttonId == IDialogConstants.CANCEL_ID) {
        super.cancelPressed();
    }

}

From source file:com.hangum.tadpole.mongodb.core.dialogs.users.UserManagerDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//from w w  w  .j av a 2  s.c om
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, DELETE_ID, Messages.UserManagerDialog_4, false);
    createButton(parent, APPEND_USER_ID, "Add User", true);
    //      createButton(parent, IDialogConstants.OK_ID, Messages.UserManagerDialog_6, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.UserManagerDialog_7, false);
}

From source file:com.hangum.tadpole.mongodb.core.ext.editors.javascript.dialog.EvalInputDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from w  ww . j a v  a2  s  .  c  o m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, "OK", true);
    createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
}

From source file:com.hangum.tadpole.monitoring.core.dialogs.schedule.AddScheduleDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//w w w .j  av  a 2s  .  c om
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.AddScheduleDialog_26, false);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.AddScheduleDialog_27, false);
}

From source file:com.hangum.tadpole.monitoring.core.dialogs.schedule.AddSQLDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from   w ww.j  a v  a 2s . c o  m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.AddSQLDialog_7, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.AddSQLDialog_8, false);
}

From source file:com.hangum.tadpole.notes.core.dialogs.NewNoteDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//from   w ww .  j  av a2s  .co m
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.NewNoteDialog_6, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.NewNoteDialog_7, false);
}

From source file:com.hangum.tadpole.notes.core.dialogs.ViewDialog.java

License:Open Source License

/**
 * Create contents of the button bar.// w  w  w . j  a v  a 2s.co  m
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.ViewDialog_6, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.ViewDialog_7, false);
}

From source file:com.hangum.tadpole.preference.dialogs.user.ChangePasswordDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from  www .j av a 2 s.c  om*/
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, CommonMessages.get().Save, true);
    createButton(parent, IDialogConstants.CANCEL_ID, CommonMessages.get().Cancel, false);
}

From source file:com.hangum.tadpole.preference.dialogs.user.ChangeUsePersonalToGrouprDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from w w w  .  ja  v a  2s.  c  om*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, Messages.get().Save, true);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.get().Cancel, false);
}

From source file:com.hangum.tadpole.rdb.core.dialog.db.UpdateDeleteConfirmDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//  w  ww  .j  ava  2  s .com
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, CommonMessages.get().Yes, false);
    createButton(parent, IDialogConstants.CANCEL_ID, CommonMessages.get().No, true);
}