Example usage for org.eclipse.jface.fieldassist FieldDecorationRegistry registerFieldDecoration

List of usage examples for org.eclipse.jface.fieldassist FieldDecorationRegistry registerFieldDecoration

Introduction

In this page you can find the example usage for org.eclipse.jface.fieldassist FieldDecorationRegistry registerFieldDecoration.

Prototype

public void registerFieldDecoration(String id, String description, String imageId) 

Source Link

Document

Registers a field decoration using the specified id.

Usage

From source file:org.eclipse.birt.chart.ui.swt.fieldassist.FieldAssistHelper.java

License:Open Source License

private FieldDecoration getCueDecoration() {
    // We use our own decoration which is based on the JFace version.
    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    FieldDecoration dec = registry.getFieldDecoration(DEC_CONTENTASSIST_ID);
    if (dec == null) {
        // Get the standard one. We use its image and our own customized
        // text.// w  w w.j  a va  2  s. c  o m
        FieldDecoration standardDecoration = registry
                .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        registry.registerFieldDecoration(DEC_CONTENTASSIST_ID,
                Messages.getFormattedString("ssDecoratorContentAssist", //$NON-NLS-1$
                        getTriggerKeyText()),
                standardDecoration.getImage());
        dec = registry.getFieldDecoration(DEC_CONTENTASSIST_ID);
    } else {
        dec.setDescription(Messages.getFormattedString("ssDecoratorContentAssist", //$NON-NLS-1$
                getTriggerKeyText()));
    }
    return dec;
}

From source file:org.eclipse.ui.examples.fieldassist.FieldAssistTestDialog.java

License:Open Source License

FieldDecoration getCueDecoration() {
    // We use our own decoration which is based on the JFace version.
    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    FieldDecoration dec = registry.getFieldDecoration(FieldAssistPlugin.DEC_CONTENTASSIST);
    if (dec == null) {
        // Get the standard one. We use its image and our own customized
        // text.//from  www .j a  v a  2 s .  c o m
        FieldDecoration standardDecoration = registry
                .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
        registry.registerFieldDecoration(FieldAssistPlugin.DEC_CONTENTASSIST,
                NLS.bind(TaskAssistExampleMessages.Decorator_ContentAssist, triggerKey),
                standardDecoration.getImage());
        dec = registry.getFieldDecoration(FieldAssistPlugin.DEC_CONTENTASSIST);
    }
    return dec;
}

From source file:org.eclipse.ui.fieldassist.ContentAssistCommandAdapter.java

License:Open Source License

private FieldDecoration getContentAssistFieldDecoration() {
    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    // Look for a decoration installed for this particular command id.
    String decId = CONTENT_ASSIST_DECORATION_ID + getCommandId();
    FieldDecoration dec = registry.getFieldDecoration(decId);

    // If there is not one, base ours on the standard JFace one.
    if (dec == null) {
        FieldDecoration originalDec = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

        registry.registerFieldDecoration(decId, null, originalDec.getImage());
        dec = registry.getFieldDecoration(decId);
    }//from w ww.j  av  a  2  s.c  o  m
    // Always update the decoration text since the key binding may
    // have changed since it was last retrieved.
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getService(IBindingService.class);
    dec.setDescription(NLS.bind(WorkbenchMessages.ContentAssist_Cue_Description_Key,
            bindingService.getBestActiveBindingFormattedFor(getCommandId())));

    // Now return the field decoration
    return dec;
}

From source file:org.eclipse.ui.fieldassist.ContentAssistField.java

License:Open Source License

private FieldDecoration getFieldDecoration() {
    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    // Look for a decoration installed for this particular command id.
    String decId = CONTENT_ASSIST_DECORATION_ID + adapter.getCommandId();
    FieldDecoration dec = registry.getFieldDecoration(decId);

    // If there is not one, base ours on the standard JFace one.
    if (dec == null) {
        FieldDecoration originalDec = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

        registry.registerFieldDecoration(decId, null, originalDec.getImage());
        dec = registry.getFieldDecoration(decId);
    }/*from   w w  w  . ja v  a 2 s  .  c o m*/
    // Always update the decoration text since the key binding may
    // have changed since it was last retrieved.
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getService(IBindingService.class);
    dec.setDescription(NLS.bind(WorkbenchMessages.ContentAssist_Cue_Description_Key,
            bindingService.getBestActiveBindingFormattedFor(adapter.getCommandId())));

    // Now return the field decoration
    return dec;
}