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

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

Introduction

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

Prototype

int MINIMUM_MESSAGE_AREA_WIDTH

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

Click Source Link

Document

Minimum width of message area in dialog units (value 300).

Usage

From source file:net.sf.jasperreports.eclipse.ui.util.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates and
 * lays out a composite and calls <code>createMessageArea</code> and
 * <code>createCustomArea</code> to populate it. Subclasses should override
 * <code>createCustomArea</code> to add contents below the message.
 */// w w w  . ja  va2s. c om
@Override
protected Control createDialogArea(Composite parent) {
    createMessageArea(parent);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
                    convertVerticalDLUsToPixels(100))
            .applyTo(messageLabel);
    return parent;
}

From source file:net.sf.jmoney.gnucashXML.AccountChooser.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);

    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);// w  w  w.  ja v  a2  s .c  o m
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }

    text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    text.setFont(parent.getFont());

    errorMessageLabel = new Label(composite, SWT.NONE);
    errorMessageLabel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageLabel.setFont(parent.getFont());

    return composite;
}

From source file:net.sf.jmoney.qif.AccountChooser.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);

    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);//from   w  w  w .ja  va  2 s .  co m
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }

    text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    text.setFont(parent.getFont());

    errorMessageLabel = new Label(composite, SWT.NONE);
    errorMessageLabel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageLabel.setFont(parent.getFont());

    return composite;
}

From source file:net.sf.jmoney.reconciliation.reconcilePage.ImportStatementDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    Label label = new Label(composite, SWT.WRAP);
    label.setText("You may restrict the import to a range of dates.");

    GridData messageData = new GridData();
    Rectangle rect = getShell().getMonitor().getClientArea();
    messageData.widthHint = rect.width / 2;
    label.setLayoutData(messageData);/*from www.j a va2  s.  c o m*/

    Composite alternativeContentContainer = new Composite(composite, 0);
    alternativeContentLayout = new AlternativeContentLayout();
    alternativeContentContainer.setLayout(alternativeContentLayout);

    Label startDateLabel = new Label(composite, SWT.NONE);
    startDateLabel.setText("Start Date:");
    GridData numberLabelData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    numberLabelData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    startDateLabel.setLayoutData(numberLabelData);
    startDateLabel.setFont(parent.getFont());

    startDateControl = new DateControl(composite);
    startDateControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    startDateControl.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            boolean isDateValid = (startDateControl.getDate() != null);
            setErrorMessage(isDateValid ? null
                    : "Date must be in the format " + JMoneyPlugin.getDefault().getDateFormat());
        }
    });

    Label endDateLabel = new Label(composite, SWT.NONE);
    endDateLabel.setText("End Date:");
    GridData dateLabelData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    dateLabelData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    endDateLabel.setLayoutData(dateLabelData);
    endDateLabel.setFont(parent.getFont());

    endDateControl = new DateControl(composite);
    endDateControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    endDateControl.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            boolean isDateValid = (endDateControl.getDate() != null);
            setErrorMessage(isDateValid ? null
                    : "Date must be in the format " + JMoneyPlugin.getDefault().getDateFormat());
        }
    });

    errorMessageText = new Text(composite, SWT.READ_ONLY);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    startDateControl.setDate(startDate);
    endDateControl.setDate(endDate);

    applyDialogFont(composite);
    return composite;
}

From source file:net.sf.jmoney.reconciliation.reconcilePage.NewStatementDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    if (lastStatement == null) {
        statementIdType = NOT_YET_DETERMINED;

        Label label = new Label(composite, SWT.WRAP);
        label.setText("You are creating the first statement for this account.  "
                + "Some banks number their statements (common in United Kingdom) while some bank do not (common in United States).  "
                + "If the statements are not numbered then you must identify each statement by date.");

        GridData messageData = new GridData();
        Rectangle rect = getShell().getMonitor().getClientArea();
        messageData.widthHint = rect.width / 2;
        label.setLayoutData(messageData);

        Button byNumberButton = new Button(composite, SWT.RADIO);
        byNumberButton.setText("Identify Bank Statements by Sequence Number");
        byNumberButton.addSelectionListener(new SelectionAdapter() {
            @Override/*from w  w  w .j ava  2 s  . co  m*/
            public void widgetSelected(SelectionEvent e) {
                promptForNumber();
            }
        });

        Button byDateButton = new Button(composite, SWT.RADIO);
        byDateButton.setText("Identify Bank Statements by Date");
        byDateButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                promptForDate();
            }
        });
    }

    Composite alternativeContentContainer = new Composite(composite, 0);
    alternativeContentLayout = new AlternativeContentLayout();
    alternativeContentContainer.setLayout(alternativeContentLayout);

    // create composite for getting statement by number
    byNumberComposite = new Composite(alternativeContentContainer, 0);
    byNumberComposite.setLayout(new GridLayout());

    Label numberLabel = new Label(byNumberComposite, SWT.WRAP);
    numberLabel.setText("Number of the new statement:");
    GridData numberLabelData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    numberLabelData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    numberLabel.setLayoutData(numberLabelData);
    numberLabel.setFont(parent.getFont());

    text = new Text(byNumberComposite, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            Pattern numberPattern = Pattern.compile("^(\\d){1,4}$");
            Matcher m = numberPattern.matcher(text.getText());
            boolean b = m.matches();
            setErrorMessage(b ? null : "Statement number must be a number in the range 1 to 9999");
        }
    });

    // create composite for getting statement by number
    byDateComposite = new Composite(alternativeContentContainer, 0);
    byDateComposite.setLayout(new GridLayout());

    Label dateLabel = new Label(byDateComposite, SWT.WRAP);
    dateLabel.setText("Date of the new statement:");
    GridData dateLabelData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    dateLabelData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    dateLabel.setLayoutData(dateLabelData);
    dateLabel.setFont(parent.getFont());

    dateControl = new DateControl(byDateComposite/*, SWT.SINGLE | SWT.BORDER*/);
    dateControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    dateControl.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            boolean isDateValid = (dateControl.getDate() != null);
            setErrorMessage(isDateValid ? null
                    : "Statement date must be in the format " + JMoneyPlugin.getDefault().getDateFormat());
        }
    });

    errorMessageText = new Text(composite, SWT.READ_ONLY);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    if (lastStatement != null) {
        if (lastStatement.isNumber()) {
            statementIdType = BY_NUMBER;
            text.setText(Integer.toString(lastStatement.getNumber() + 1));
        } else {
            statementIdType = BY_DATE;
            Date initialDate = lastStatement.getStatementDate();

            Calendar calendar = Calendar.getInstance();
            calendar.setTime(initialDate);
            calendar.add(Calendar.MONTH, 1);
            dateControl.setDate(calendar.getTime());
        }
    }

    switch (statementIdType) {
    case BY_NUMBER:
        alternativeContentLayout.show(byNumberComposite);
        text.setFocus();
        text.selectAll();
        break;
    case BY_DATE:
        alternativeContentLayout.show(byDateComposite);
        dateControl.setFocus();
        break;
    }

    applyDialogFont(composite);
    return composite;
}

From source file:net.sourceforge.taggerplugin.dialog.AbstractDetailsDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part of this dialog (above the button bar). This includes an image, if specified, and a message.
 * /*from  ww  w . j  a va  2 s  .  c  o m*/
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (image != null) {
        ((GridLayout) composite.getLayout()).numColumns = 2;
        Label label = new Label(composite, 0);
        image.setBackground(label.getBackground());
        label.setImage(image);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }

    Label label = new Label(composite, SWT.WRAP);
    if (message != null) {
        label.setText(message);
    }

    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(data);
    label.setFont(parent.getFont());

    return composite;
}

From source file:net.ssehub.easy.producer.ui.productline_editor.MessageDialogWithCopy.java

License:Apache License

@Override
protected Control createMessageArea(final Composite composite) {
    Image image = getImage();//from   www .  j av a  2s .  c  o  m
    if (image != null) {
        imageLabel = new Label(composite, SWT.NULL);
        image.setBackground(imageLabel.getBackground());
        imageLabel.setImage(image);

        imageLabel.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, false, false));
    }

    // Use Text control for message to allow copy

    if (message != null) {
        Text msg = new Text(composite, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP);
        //            msg.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

        msg.setText(message);

        GridData data = new GridData(SWT.FILL, SWT.TOP, true, false);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);

        msg.setLayoutData(data);
    }

    return composite;
}

From source file:org.acoveo.callcenter.sipclient.view.TransferDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);/*from w  w w. j av  a 2  s.com*/
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);

    Button blindTransferButton = new Button(composite, SWT.RADIO);
    blindTransferButton.setText(Messages.TransferDialog_1);
    if (blindOnly || defaultType == TransferType.BLIND_TRANSFER) {
        blindTransferButton.setSelection(true);
        transferType = defaultType;
    }
    if (blindOnly) {
        blindTransferButton.setEnabled(false);
    } else {
        blindTransferButton.addSelectionListener(new SelectionListener() {
            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
            }

            @Override
            public void widgetSelected(SelectionEvent e) {
                transferType = TransferType.BLIND_TRANSFER;
                text.setEnabled(true);
            }
        });
    }

    Button attendedTransferButton = new Button(composite, SWT.RADIO);

    attendedTransferButton.setText(Messages.TransferDialog_2);
    if (!blindOnly && defaultType == TransferType.ATTENDED_TRANSFER) {
        attendedTransferButton.setSelection(true);
        text.setEnabled(false);
        transferType = defaultType;
    }
    if (blindOnly) {
        attendedTransferButton.setEnabled(false);
    } else {
        attendedTransferButton.addSelectionListener(new SelectionListener() {
            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
            }

            @Override
            public void widgetSelected(SelectionEvent e) {
                transferType = TransferType.ATTENDED_TRANSFER;
                text.setEnabled(false);
            }
        });
    }

    Label explanationLabel = new Label(composite, SWT.WRAP);
    explanationLabel.setText(EXPLANATION);

    return composite;
}

From source file:org.apache.directory.studio.aciitemeditor.dialogs.ACIItemDialog.java

License:Apache License

/**
 * Creates the tabFolderComposite./*from   w  ww .j  a  v  a 2  s  . c o m*/
 * 
 * @param parent the parent
 * 
 * @return the control
 */
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 4 / 3;
    gd.heightHint = convertVerticalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 4 / 3;
    composite.setLayoutData(gd);

    tabFolderComposite = new ACIItemTabFolderComposite(composite, SWT.NONE);

    // set initial value
    if (context != null) {
        tabFolderComposite.setContext(context);
        tabFolderComposite.setInput(context.getACIItemValue());
    }

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.aciitemeditor.dialogs.ItemPermissionDialog.java

License:Apache License

/**
 * Creates all the dialog content.//from   w w w. j a va2  s .  c  o m
 * 
 * @param parent the parent
 * 
 * @return the control
 */
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    gd.heightHint = convertVerticalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 4 / 3;
    composite.setLayoutData(gd);

    // precedence
    Composite spinnerComposite = new Composite(composite, SWT.NONE);
    spinnerComposite.setLayout(new GridLayout(2, false));
    spinnerComposite.setLayoutData(new GridData());
    precedenceCheckbox = new Button(spinnerComposite, SWT.CHECK);
    precedenceCheckbox.setText(Messages.getString("ItemPermissionDialog.precedence.label")); //$NON-NLS-1$
    precedenceCheckbox.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            precedenceSpinner.setEnabled(precedenceCheckbox.getSelection());
        }
    });
    precedenceSpinner = new Spinner(spinnerComposite, SWT.BORDER);
    precedenceSpinner.setMinimum(0);
    precedenceSpinner.setMaximum(255);
    precedenceSpinner.setDigits(0);
    precedenceSpinner.setIncrement(1);
    precedenceSpinner.setPageIncrement(10);
    precedenceSpinner.setSelection(0);
    precedenceSpinner.setEnabled(false);
    GridData precedenceGridData = new GridData();
    precedenceGridData.grabExcessHorizontalSpace = true;
    precedenceGridData.verticalAlignment = GridData.CENTER;
    precedenceGridData.horizontalAlignment = GridData.BEGINNING;
    precedenceGridData.widthHint = 3 * 12;
    precedenceSpinner.setLayoutData(precedenceGridData);

    // user classes
    userClassesComposite = new ACIItemUserClassesComposite(composite, SWT.NONE);
    userClassesComposite.setContext(context);

    // grants and denial
    grantsAndDenialsComposite = new ACIItemGrantsAndDenialsComposite(composite, SWT.NONE);

    // set initial values
    if (initialItemPermission != null) {
        if ((initialItemPermission.getPrecedence() != null) && (initialItemPermission.getPrecedence() > -1)) {
            precedenceCheckbox.setSelection(true);
            precedenceSpinner.setEnabled(true);
            precedenceSpinner.setSelection(initialItemPermission.getPrecedence());
        }
        userClassesComposite.setUserClasses(initialItemPermission.getUserClasses());
        grantsAndDenialsComposite.setGrantsAndDenials(initialItemPermission.getGrantsAndDenials());
    }

    applyDialogFont(composite);
    return composite;
}