Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] org.eclipse.dltk.ui.completion + proposalLabelProvider / proposalFactory

Hi Robert,

If I understand your case correctly it can be done by implementing
org.eclipse.dltk.ui.text.completion.IScriptCompletionProposalFactory.
Which is designed as external extensibility, while
CompletionProposalLabelProvider is an internal one at the moment.

Regards,
Alex

2011/7/8 Robert Gründler <r.gruendler@xxxxxxxxx>:
> Hi,
>
> i would like to add custom labels and infos to specific modelelements in the
> codeassist popup dialog. there's the
> org.eclipse.dltk.ui.completion extension, which let's developers define a
> proposalLabelProvider and a proposalFactory.
>
> However, this extension always uses the first registered extension:
>
> public class CompletionProposalLabelProviderRegistry {
>
>     public static CompletionProposalLabelProvider create(String natureId) {
>         final NatureExtensionManager<CompletionProposalLabelProvider>
> manager = new NatureExtensionManager<CompletionProposalLabelProvider>(
>                 DLTKUIPlugin.PLUGIN_ID + ".completion",
>                 CompletionProposalLabelProvider.class) {
>             @Override
>             protected boolean isValidElement(IConfigurationElement element)
> {
>                 return "proposalLabelProvider".equals(element.getName());
>             }
>         };
>         Object[] instances = manager.getInstances(natureId);
>         if (instances != null && instances.length != 0) {
>             return (CompletionProposalLabelProvider) instances[0];
>         } else {
>             return new CompletionProposalLabelProvider();
>         }
>     }
> }
>
> Now my extensions is built on top of PDT, so my label provider can never be
> instantiated, as PDT uses the same extension point for PHP elements.
> As a workaround, i've simply implemented another
> org.eclipse.dltk.ui.scriptCompletionProposalComputer which creates proposals
> for the domain
> specific elements.
>
> This will display each proposal twice though, as the PDT default-proposal is
> shown too.
>
> Is there a way to override the label providers / factories from other
> extensions ?
>
>
> thanks!
>
>
> -robert
>
>
>
>
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
>


Back to the top