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:ca.mt.wb.devtools.tx.InheritanceView.java

License:unlicense.org

/**
 * Creates the menu and toolbar actions.
 *//*from  ww  w .j av a 2s.c om*/
private void makeActions() {

    addNodeAction = new Action() {
        public void run() {
            try {
                SelectionDialog dialog = JavaUI.createTypeDialog(getSite().getShell(),
                        new ProgressMonitorDialog(getSite().getShell()), SearchEngine.createWorkspaceScope(),
                        IJavaElementSearchConstants.CONSIDER_ALL_TYPES, true);
                dialog.setTitle("Add type(s)...");
                dialog.setMessage("Type(s) to add?");
                if (dialog.open() == IDialogConstants.CANCEL_ID) {
                    return;
                }
                Object[] types = dialog.getResult();
                if (types == null || types.length == 0) {
                    return;
                }
                for (int i = 0; i < types.length; i++) {
                    addType((IType) types[i]);
                }
            } catch (JavaModelException e) {
                /* do nothing */
            }
        }
    };

    addNodeAction.setText("Add Type");
    addNodeAction.setToolTipText("Add a new class or interface");
    addNodeAction.setImageDescriptor(getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD));

    expandElementAction = new Action() {
        public void run() {
            for (IType t : getSelectedTypes()) {
                addSubTypes(t);
            }
        }
    };
    expandElementAction.setText("Add Subtypes");
    expandElementAction.setToolTipText("Add subtypes of selected element");
    expandElementAction.setImageDescriptor(getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD));

    // create the action that deletes the selected node
    deleteNodeAction = new Action() {
        public void run() {
            // ISelection = viewer.getSelection();
            ComparisonModel model = ((ComparisonModel) viewer.getInput()).copy();
            boolean modified = false;
            for (IType t : getSelectedTypes()) {
                if (model.remove(t)) {
                    modified = true;
                }
            }
            if (modified) {
                viewer.setInput(model);
            }
            setEnabled(false);
        }
    };
    deleteNodeAction.setEnabled(false);
    deleteNodeAction.setText("Delete Node");
    deleteNodeAction.setToolTipText("Delete the selected node");
    deleteNodeAction.setImageDescriptor(getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE));
    deleteNodeAction.setDisabledImageDescriptor(
            getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE_DISABLED));

    clearAction = new Action() {
        public void run() {
            viewer.setInput(new ComparisonModel());
            // viewer.refresh();
        }
    };
    clearAction.setText("Clear");
    clearAction.setToolTipText("Remove all elements");
    clearAction.setImageDescriptor(getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_CLEAR));
    clearAction.setDisabledImageDescriptor(
            getSharedImages().getImageDescriptor(ISharedImages.IMG_ETOOL_CLEAR_DISABLED));

    openInEditorAction = new Action() {
        public void run() {
            openInEditor(getSelectedTypes().get(0));
        }
    };

    layoutActions = new ArrayList<IAction>();
    layoutActions
            .add(createLayoutAction("Spring", new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)));
    layoutActions
            .add(createLayoutAction("Radial", new RadialLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)));
    layoutActions.add(createLayoutAction("Directed",
            new DirectedGraphLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)));
    layoutActions
            .add(createLayoutAction("Tree", new TreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)));
    layoutActions.add(createLayoutAction("Horizontal Tree",
            new HorizontalTreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)));

}

From source file:ca.uvic.chisel.feature.research.ui.internal.ResearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create the standard OK and cancel buttons, but reset their text
    super.createButtonsForButtonBar(parent);
    Button b = getButton(IDialogConstants.OK_ID);
    b.setText("Participate >");
    b = getButton(IDialogConstants.CANCEL_ID);
    b.setText("Later");
}

From source file:ca.uvic.cs.tagsea.research.UserIDDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    okay = createButton(parent, IDialogConstants.OK_ID, "Get ID", true);
    // create OK and Cancel buttons by default
    finish = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, false);
    cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    finish.setEnabled(false);//from   ww w. ja v a2 s.c  o  m
}

From source file:ca.uvic.cs.tagsea.research.UserIDDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.OK_ID:
        okPressed();/* w  w w  .  j  a v  a 2  s.co  m*/
        break;
    case IDialogConstants.CANCEL_ID:
        cancelPressed();
        break;
    case IDialogConstants.FINISH_ID:
        finishPressed();
        break;
    }
}

From source file:ca.uwinnipeg.proximity.desktop.AboutDialog.java

/**
 * Create contents of the button bar./*from w  w w .java 2s .c  o m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    // TODO: setup buttons properly
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, true);

    //    Button btnCredits = createButton(
    //        parent, 
    //        IDialogConstants.CLOSE_ID, 
    //        IDialogConstants.CLOSE_LABEL, 
    //        false);
    //    btnCredits.setText("Credits");
    //    
    //    Button btnLicence = createButton(
    //        parent, 
    //        IDialogConstants.CLOSE_ID, 
    //        IDialogConstants.CLOSE_LABEL, 
    //        false);
    //    btnLicence.setText("Licence");
}

From source file:ch.elexis.base.messages.MsgDetailDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    String sOK;/*from   w w  w  .j  av  a2 s. co  m*/
    if (incomingMsg == null) {
        sOK = Messages.MsgDetailDialog_send;
    } else {
        sOK = Messages.MsgDetailDialog_delete;
    }
    bOK = createButton(parent, IDialogConstants.OK_ID, sOK, false);
    parent.getShell().setDefaultButton(bOK);
    bAnswer = createButton(parent, IDialogConstants.CLIENT_ID + 1, Messages.MsgDetailDialog_reply, false);
    if (incomingMsg == null) {
        bAnswer.setEnabled(false);
    }
    createButton(parent, IDialogConstants.CLIENT_ID + 2, Messages.MsgDetailDialog_asReminder, false);
    createButton(parent, IDialogConstants.CANCEL_ID, Messages.MsgDetailDialog_cancel, false);
}

From source file:ch.elexis.core.ui.contacts.dialogs.AdvancedFilterDialog.java

License:Open Source License

/**
 * Create contents of the button bar.//from   w w  w. j  a v a 2 s. c  o m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button button_1 = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    button_1.setText("Filter anwenden");
    Button btnAbbrechen = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
            false);
    btnAbbrechen.setText("Abbrechen");
}

From source file:ch.elexis.core.ui.dialogs.KontaktSelektor.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    if (enableEmptyField) {
        parent.setLayout(new GridLayout(3, false));
        Button btnClear = createButton(parent, IDialogConstants.NO_ID, Messages.KontaktSelector_clearField,
                false);//from   ww w  .  ja v a  2 s . c  o  m
        btnClear.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                selection = null;
                vc.getContentProvider().stopListening();
                close();
            }
        });
    } else {
        parent.setLayout(new GridLayout(2, false));
    }

    createButton(parent, IDialogConstants.OK_ID, "OK", false);
    createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
}

From source file:ch.elexis.core.ui.dialogs.LoginDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    getButton(IDialogConstants.OK_ID).setText(Messages.LoginDialog_login);
    getButton(IDialogConstants.CANCEL_ID).setText(Messages.LoginDialog_terminate);
    // getButton(IDialogConstants.OK_ID).setEnabled(false);

}

From source file:ch.elexis.core.ui.stock.dialogs.ImportArticleDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    Button okBtn = super.getButton(IDialogConstants.OK_ID);
    if (okBtn != null) {
        okBtn.setText("Import");
    }/*from  ww  w.  ja  v a 2s. c o  m*/

    Button closeBtn = super.getButton(IDialogConstants.CANCEL_ID);
    if (closeBtn != null) {
        closeBtn.setText("Schlieen");
    }
}