Search in sources :

Example 1 with ICompletionProposalCollector

use of org.eclipse.wst.json.ui.contentassist.ICompletionProposalCollector in project webtools.sourceediting by eclipse.

the class CompletionProposalCollectorsRegistryReader method readElement.

protected void readElement(IConfigurationElement element) {
    if (TAG_CONTRIBUTION.equals(element.getName())) {
        try {
            ICompletionProposalCollector collector = (ICompletionProposalCollector) element.createExecutableExtension("class");
            JSONPath[] paths = createPaths(element.getAttribute("paths"));
            Collection<TargetType> targets = createTargets(element.getAttribute("targets"));
            String contentTypeId = element.getAttribute("contentTypeId");
            CompletionProposalMatcher matcher = new CompletionProposalMatcher(targets, paths, collector);
            Collection<CompletionProposalMatcher> matchersByContentType = matchers.get(contentTypeId);
            if (matchersByContentType == null) {
                matchersByContentType = new ArrayList<CompletionProposalMatcher>();
                matchers.put(contentTypeId, matchersByContentType);
            }
            matchersByContentType.add(matcher);
        } catch (CoreException e) {
            Logger.logException(e);
        }
    }
}
Also used : ICompletionProposalCollector(org.eclipse.wst.json.ui.contentassist.ICompletionProposalCollector) JSONPath(org.eclipse.json.jsonpath.JSONPath) CoreException(org.eclipse.core.runtime.CoreException) TargetType(org.eclipse.wst.json.ui.contentassist.ICompletionProposalCollector.TargetType)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 JSONPath (org.eclipse.json.jsonpath.JSONPath)1 ICompletionProposalCollector (org.eclipse.wst.json.ui.contentassist.ICompletionProposalCollector)1 TargetType (org.eclipse.wst.json.ui.contentassist.ICompletionProposalCollector.TargetType)1