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:at.bestsolution.efxclipse.tooling.pde.e4.project.NewApplicationWizardPage.java

License:Open Source License

/**
 * create Rect Set dialog/*from w ww .  j  a  v  a2s. com*/
 * 
 * @param parent
 * @param valueText
 * @return
 */
public Dialog createRectDialog(final Composite parent, final Text valueText) {
    return new Dialog(parent.getShell()) {
        Text xPointText, yPointText, widthText, heightText;

        @Override
        protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
            return super.createButton(parent, id, label, defaultButton);
        }

        @Override
        protected Control createDialogArea(final Composite parent) {
            Composite composite = (Composite) super.createDialogArea(parent);
            composite.getShell().setText("Set Rect");
            Group group = new Group(composite, SWT.NONE);
            group.setText("Rect");
            GridLayout gridLayout = new GridLayout();
            gridLayout.numColumns = 4;
            group.setLayout(gridLayout);

            Label xPointLabel = new Label(group, SWT.NONE);
            xPointLabel.setText("X:");
            xPointText = new Text(group, SWT.BORDER);
            VerifyListener verifyListener = createVerifyListener(parent.getShell());
            xPointText.addVerifyListener(verifyListener);
            Label yPointLabel = new Label(group, SWT.NONE);
            yPointLabel.setText("Y:");
            yPointText = new Text(group, SWT.BORDER);
            yPointText.addVerifyListener(verifyListener);
            Label widthLabel = new Label(group, SWT.NONE);
            widthLabel.setText("Width:");
            widthText = new Text(group, SWT.BORDER);
            widthText.addVerifyListener(verifyListener);
            Label heighttLabel = new Label(group, SWT.NONE);
            heighttLabel.setText("Height:");
            heightText = new Text(group, SWT.BORDER);
            heightText.addVerifyListener(verifyListener);

            return composite;
        }

        @Override
        protected void buttonPressed(int buttonId) {
            if (IDialogConstants.OK_ID == buttonId) {
                String xPoint = xPointText.getText();
                String yPoint = yPointText.getText();
                String width = widthText.getText();
                String height = heightText.getText();
                if (xPoint.length() == 0 || yPoint.length() == 0 || width.length() == 0
                        || height.length() == 0) {
                    MessageDialog.openWarning(parent.getShell(), "Input value empty",
                            "Value shoud not be empty!");
                } else {
                    valueText.setText(xPoint + "," + yPoint + "," + width + "," + height);
                    okPressed();
                }
            } else if (IDialogConstants.CANCEL_ID == buttonId) {
                cancelPressed();
            }
        }
    };
}

From source file:at.medevit.elexis.gdt.ui.dialog.NeueUntersuchungAnfordernDialog.java

License:Open Source License

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

}

From source file:at.medevit.elexis.impfplan.ui.dialogs.SupplementVaccinationDialog.java

License:Open Source License

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

From source file:at.medevit.menus.dialog.AddPersonDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from  w  ww  . j  a va 2s . com*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    m_bindingContext = initDataBindings();
}

From source file:at.spardat.xma.gui.mapper.BDInstanceSelectionDialog.java

License:Open Source License

/**
 * Adds buttons to this dialog's button bar.
 *///from  w ww.  ja  va 2s . c o  m
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:at.spardat.xma.gui.mapper.BDInstanceSelectionDialog.java

License:Open Source License

private void browseButtonSelected() {
    ProgressMonitorDialog pmd = new ProgressMonitorDialog(getShell());
    SelectionDialog selDialog = null;// www.  j  a  v  a 2 s .  c o  m
    try {
        selDialog = JavaUI.createTypeDialog(getShell(), pmd, SearchEngine.createWorkspaceScope(),
                IJavaElementSearchConstants.CONSIDER_CLASSES, false);
        selDialog.setTitle("Select BusinessData");
    } catch (Exception ex) {
        setErrorMessage(ex.toString());
    }
    if (selDialog != null) {
        if (selDialog.open() == IDialogConstants.CANCEL_ID)
            return;
        Object[] types = selDialog.getResult();
        if (types == null || types.length == 0)
            return;
        IType selectedType = (IType) types[0];
        className_.setText(selectedType.getFullyQualifiedName());
    }
}

From source file:at.spardat.xma.guidesign.presentation.dialog.table.TransformTableLayoutDialog.java

License:Open Source License

/**
 * Create a button bar with only a ok button
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *///  ww w  . j  a  v a  2  s. c  o m
protected void createButtonsForButtonBar(Composite parent) {
    // create OK button
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:au.gov.ga.earthsci.catalog.ui.handler.BrowseInputDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    //do this here because setting the text will set enablement on the ok
    // button/*  w  w w  .j  av  a  2s  .  c om*/
    text.setFocus();
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }
}

From source file:au.gov.ga.earthsci.discovery.csw.CSWURLSelectionDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    validate();// ww w. j ava2  s  . c  om
}

From source file:br.puc.molic.diagram.multiline.InputDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    //do this here because setting the text will set enablement on the OK
    // button/* w w  w .j  av  a2  s .  c om*/
    text.setFocus();
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }
}