Example usage for org.eclipse.jface.fieldassist DecoratedField showDecoration

List of usage examples for org.eclipse.jface.fieldassist DecoratedField showDecoration

Introduction

In this page you can find the example usage for org.eclipse.jface.fieldassist DecoratedField showDecoration.

Prototype

public void showDecoration(FieldDecoration decoration) 

Source Link

Document

Show the specified decoration.

Usage

From source file:org2.eclipse.php.internal.ui.wizard.field.StringDialogField.java

License:Open Source License

/**
 * Creates or returns the created text control.
 * //from   ww  w.jav a 2 s .c o m
 * @param parent
 *            The parent composite or <code>null</code> when the widget has already been created.
 * @return Text
 */
public Text getTextControl(Composite parent) {
    if (fContentAssistProcessor != null) {
        DecoratedField fld = new DecoratedField(parent, SWT.NONE, new IControlCreator() {

            public Control createControl(Composite parent, int style) {
                createText(parent);
                return fTextControl;
            }

        });
        FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
                .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        fld.addFieldDecoration(fieldDecoration, SWT.TOP | SWT.LEFT, true);
        fld.showDecoration(fieldDecoration);
        final KeyStroke keyStroke = KeyStroke.getInstance(SWT.CONTROL, 32);

        contentProposalAdapter = new ContentProposalAdapter(fTextControl, new TextContentAdapter(),
                fContentAssistProcessor, keyStroke, null);
        contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
        contentProposalAdapter.setLabelProvider(labelProvider);
        return fTextControl;
    }
    createText(parent);
    return fTextControl;
}