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:org.apache.directory.studio.openldap.config.editor.dialogs.OverlayDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from ww  w.  ja v  a 2 s  .co  m
@Override
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);
    composite.setLayoutData(gd);

    // Checking if we need to show the overlay type selection
    if (allowOverlayTypeSelection) {
        createOverlayTypeSelection(composite);

        BaseWidgetUtils.createSeparator(composite, 1);
    }

    // Creating the configuration composites
    configurationComposite = BaseWidgetUtils.createColumnContainer(composite, 1, 1);
    createConfigurationInnerComposite();

    // Checking for empty overlay
    if (overlay == null) {
        // Assigning a default one
        overlay = new OlcAccessLogConfig();

        // Select the correct value on the combo viewer (if required)
        if (allowOverlayTypeSelection) {
            overlayTypeCombo.setText(OverlayTypeEnum.ACCESS_LOG.getName());
        }
    }

    // Initializing the dialog with the overlay
    initWithOverlay();

    // Adding the listener on the combo viewer  (if required)
    if (allowOverlayTypeSelection) {
        overlayTypeCombo.addSelectionListener(overlayTypeComboViewerSelectionChangedListener);
    }

    applyDialogFont(composite);

    return composite;
}

From source file:org.apache.directory.studio.openldap.config.editor.dialogs.RwmMappingDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///w w  w.  ja  v  a  2s  . c o  m
@Override
protected Control createDialogArea(Composite parent) {
    // Creating the dialog composites
    Composite dialogComposite = (Composite) super.createDialogArea(parent);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    //        gridData.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
    dialogComposite.setLayoutData(gridData);
    Composite composite = BaseWidgetUtils.createColumnContainer(dialogComposite, 2, 1);

    // Type
    BaseWidgetUtils.createLabel(composite, "Type:", 1);
    typeComboViewer = new ComboViewer(composite);
    typeComboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    typeComboViewer.setContentProvider(new ArrayContentProvider());
    typeComboViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof OlcRwmMapValueTypeEnum) {
                OlcRwmMapValueTypeEnum type = (OlcRwmMapValueTypeEnum) element;

                switch (type) {
                case ATTRIBUTE:
                    return "Attribute Type";
                case OBJECTCLASS:
                    return "Object Class";
                }
            }

            return super.getText(element);
        }
    });
    typeComboViewer.setInput(new OlcRwmMapValueTypeEnum[] { OlcRwmMapValueTypeEnum.ATTRIBUTE,
            OlcRwmMapValueTypeEnum.OBJECTCLASS });

    // Local Name
    BaseWidgetUtils.createLabel(composite, "Local Name:", 1);
    localNameComboViewer = new ComboViewer(new Combo(composite, SWT.DROP_DOWN));
    localNameComboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    localNameComboViewer.setContentProvider(new ArrayContentProvider());

    // Foreign Name
    BaseWidgetUtils.createLabel(composite, "Foreign Name:", 1);
    foreignNameComboViewer = new ComboViewer(new Combo(composite, SWT.DROP_DOWN));
    foreignNameComboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    foreignNameComboViewer.setContentProvider(new ArrayContentProvider());

    initFromValue();

    addListeners();

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.openldap.config.editor.dialogs.ValueSortingValueDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///www.jav  a  2 s  .c o  m
@Override
protected Control createDialogArea(Composite parent) {
    // Creating the dialog composites
    Composite dialogComposite = (Composite) super.createDialogArea(parent);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    //        gridData.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 4 / 3;
    dialogComposite.setLayoutData(gridData);
    Composite composite = BaseWidgetUtils.createColumnContainer(dialogComposite, 2, 1);

    // Attribute
    BaseWidgetUtils.createLabel(composite, "Attribute:", 1);
    attributeComboViewer = new ComboViewer(new Combo(composite, SWT.DROP_DOWN));
    attributeComboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    attributeComboViewer.setContentProvider(new ArrayContentProvider());
    attributeComboViewer.setInput(connectionAttributeTypes);

    // Base DN
    BaseWidgetUtils.createLabel(composite, "Base DN:", 1);
    baseDnEntryWidget = new EntryWidget(browserConnection);
    baseDnEntryWidget.createWidget(composite);
    baseDnEntryWidget.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));

    // Sort Method
    BaseWidgetUtils.createLabel(composite, "Sort Method:", 1);
    sortMethodComboViewer = new ComboViewer(composite);
    sortMethodComboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    sortMethodComboViewer.setContentProvider(new ArrayContentProvider());
    sortMethodComboViewer.setLabelProvider(new OlcValSortMethodEnumLabelProvider());
    sortMethodComboViewer.setInput(new Object[] { OlcValSortMethodEnum.ALPHA_ASCEND,
            OlcValSortMethodEnum.ALPHA_DESCEND, OlcValSortMethodEnum.NUMERIC_ASCEND,
            OlcValSortMethodEnum.NUMERIC_DESCEND, WEIGHTED_OPTION });

    // Secondary Sort Method
    BaseWidgetUtils.createLabel(composite, "Secondary Sort Method:", 1);
    secondarySortMethodComboViewer = new ComboViewer(composite);
    secondarySortMethodComboViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    secondarySortMethodComboViewer.setContentProvider(new ArrayContentProvider());
    secondarySortMethodComboViewer.setLabelProvider(new OlcValSortMethodEnumLabelProvider());
    secondarySortMethodComboViewer.setInput(
            new Object[] { NONE_OPTION, OlcValSortMethodEnum.ALPHA_ASCEND, OlcValSortMethodEnum.ALPHA_DESCEND,
                    OlcValSortMethodEnum.NUMERIC_ASCEND, OlcValSortMethodEnum.NUMERIC_DESCEND });

    initFromValue();

    addListeners();

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.schemaeditor.view.dialogs.MessageDialogWithTextarea.java

License:Apache License

@Override
protected Control createCustomArea(Composite parent) {
    textArea = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    textArea.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2));
    gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 4);
    textArea.setLayoutData(gd);/*from   w w  w .  ja v  a  2  s.c  om*/
    //textArea.setBackground( parent.getBackground() );
    textArea.setText(detailMessage);

    return textArea;
}

From source file:org.apache.directory.studio.valueeditors.address.AddressDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from w w w . j a  v a2 s  .co  m
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gd);

    // text widget
    text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setText(initialAddress.replaceAll("\\$", BrowserCoreConstants.LINE_SEPARATOR)); //$NON-NLS-1$
    // GridData gd = new GridData(GridData.GRAB_HORIZONTAL |
    // GridData.HORIZONTAL_ALIGN_FILL);
    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2);
    text.setLayoutData(gd);

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.valueeditors.administrativerole.AdministrativeRoleDialog.java

License:Apache License

/**
 * {@inheritDoc}/*from   www  .ja v  a 2  s . com*/
 */
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(gd);

    // attribute combo with field decoration and content proposal
    administrativeRoleCombo = BaseWidgetUtils.createCombo(composite, new String[0], -1, 1);
    administrativeRoleCombo.setVisibleItemCount(20);
    administrativeRoleCombo.setItems(administrativeRoleValues);
    administrativeRoleCombo.setText(initialValue);
    new ExtendedContentAssistCommandAdapter(administrativeRoleCombo, new ComboContentAdapter(),
            new ListContentProposalProvider(administrativeRoleCombo.getItems()), null, null, true);

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.valueeditors.certificate.CertificateDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *//*from   www.  j a  v  a2  s  .  c o  m*/
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);

    Composite certificateInfoContainer = BaseWidgetUtils.createColumnContainer(composite, 1, 1);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH * 3 / 2);
    gd.heightHint = convertVerticalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    certificateInfoContainer.setLayoutData(gd);

    certificateInfoComposite = new CertificateInfoComposite(certificateInfoContainer, SWT.NONE);
    if (currentData != null && currentData.length > 0) {
        updateInput();
    }

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.valueeditors.objectclass.ObjectClassDialog.java

License:Apache License

/**
 * {@inheritDoc}/*  w w w .j  a  va 2  s .  co  m*/
 */
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    composite.setLayoutData(gd);

    // combo widget
    String[] allOcNames = SchemaUtils.getNamesAsArray(schema.getObjectClassDescriptions());
    Arrays.sort(allOcNames);

    // attribute combo with field decoration and content proposal
    objectClassCombo = BaseWidgetUtils.createCombo(composite, new String[0], -1, 1);
    objectClassCombo.setVisibleItemCount(20);
    objectClassCombo.setItems(allOcNames);
    objectClassCombo.setText(initialValue);
    new ExtendedContentAssistCommandAdapter(objectClassCombo, new ComboContentAdapter(),
            new ListContentProposalProvider(objectClassCombo.getItems()), null, null, true);

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.directory.studio.valueeditors.password.PasswordDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 *///from  ww  w .ja va 2s .c o m
protected Control createDialogArea(Composite parent) {
    // Composite
    Composite composite = (Composite) super.createDialogArea(parent);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 3 / 2;
    gd.heightHint = convertVerticalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 2 / 3;
    composite.setLayoutData(gd);

    // Tab folder
    tabFolder = new TabFolder(composite, SWT.TOP);
    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
    tabFolder.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateTabFolder();
        }
    });

    // Checking the current password
    if (currentPassword != null && currentPassword.toBytes().length > 0) {
        // Setting the display mode
        displayMode = DisplayMode.CURRENT_AND_NEW_PASSWORD;

        // Creating the current password tab
        createCurrentPasswordTab();
    } else {
        // Setting the display mode
        displayMode = DisplayMode.NEW_PASSWORD_ONLY;
    }

    // Creating the new password tab
    createNewPasswordTab();

    addListeners();

    applyDialogFont(composite);
    return composite;
}

From source file:org.apache.sling.ide.eclipse.ui.actions.NewNodeDialog.java

License:Apache License

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

    Control[] children = composite.getChildren();
    Control errorMessageText = children[children.length - 1];
    GridData errorMessageGridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    errorMessageGridData.heightHint = convertHeightInCharsToPixels(2);
    errorMessageText.setLayoutData(errorMessageGridData);

    // now add the node type dropbox-combo
    Label label = new Label(composite, SWT.WRAP);
    label.moveAbove(errorMessageText);// www .  ja  v  a 2s .co m
    label.setText("Define node type");
    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());

    combo = new Combo(composite, SWT.DROP_DOWN);
    combo.moveAbove(errorMessageText);
    if (allowedChildren != null) {
        combo.setItems(allowedChildren.toArray(new String[0]));
    }
    combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            comboSelection = combo.getText();
            validateInput();
        }
    });
    combo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            comboSelection = combo.getText();
            validateInput();
        }

    });

    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(combo.getItems());
    proposalProvider.setFiltering(true);
    final ComboContentAdapter controlContentAdapter = new ComboContentAdapter() {
        @Override
        public void insertControlContents(Control control, String text, int cursorPosition) {
            Point selection = combo.getSelection();
            combo.setText(text);
            selection.x = selection.x + cursorPosition;
            selection.y = selection.x;
            combo.setSelection(selection);
        }

        @Override
        public Rectangle getInsertionBounds(Control control) {
            final Rectangle insertionBounds = super.getInsertionBounds(control);
            // always insert at start
            insertionBounds.x = 0;
            insertionBounds.y = 0;
            return insertionBounds;
        }

    };
    // this variant opens auto-complete on each character
    proposalAdapter = new ContentProposalAdapter(combo, controlContentAdapter, proposalProvider, null, null);
    // this variant opens auto-complete only when invoking the auto-complete hotkey
    if (allowedChildren != null && allowedChildren.size() == 1) {
        combo.setText(allowedChildren.iterator().next());
    } else if (allowedChildren != null) {
        if (allowedChildren.contains(lastChosenNodeType)) {
            combo.setText(lastChosenNodeType);
        }
    }

    return composite;
}