Skip to main content

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

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





Back to the top