Search in sources :

Example 1 with InvalidRegistryObjectException

use of org.eclipse.core.runtime.InvalidRegistryObjectException in project che by eclipse.

the class ProposalSorterHandle method sortProposals.

/**
	 * Safely computes completion proposals through the described extension. If the extension throws
	 * an exception or otherwise does not adhere to the contract described in
	 * {@link AbstractProposalSorter}, the list is returned as is.
	 *
	 * @param context the invocation context passed on to the extension
	 * @param proposals the list of computed completion proposals to be sorted (element type:
	 *        {@link ICompletionProposal}), must be writable
	 */
public void sortProposals(ContentAssistInvocationContext context, List<ICompletionProposal> proposals) {
    IStatus status;
    try {
        AbstractProposalSorter sorter = getSorter();
        PerformanceStats stats = startMeter(SORT, sorter);
        sorter.beginSorting(context);
        Collections.sort(proposals, sorter);
        sorter.endSorting();
        status = stopMeter(stats, SORT);
        // valid result
        if (status == null)
            return;
        status = createAPIViolationStatus(SORT);
    } catch (InvalidRegistryObjectException x) {
        status = createExceptionStatus(x);
    } catch (CoreException x) {
        status = createExceptionStatus(x);
    } catch (RuntimeException x) {
        status = createExceptionStatus(x);
    }
    JavaPlugin.log(status);
    return;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) AbstractProposalSorter(org.eclipse.jdt.ui.text.java.AbstractProposalSorter) PerformanceStats(org.eclipse.core.runtime.PerformanceStats) CoreException(org.eclipse.core.runtime.CoreException) InvalidRegistryObjectException(org.eclipse.core.runtime.InvalidRegistryObjectException)

Example 2 with InvalidRegistryObjectException

use of org.eclipse.core.runtime.InvalidRegistryObjectException in project tdi-studio-se by Talend.

the class TalendPaletteSearchIndex method getTalendDocPlugins.

protected PluginVersionInfo getTalendDocPlugins() {
    Set<String> totalIds = new HashSet<String>();
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = registry.getExtensionPoint(TocFileProvider.EXTENSION_POINT_ID_TOC);
    IExtension[] extensions = extensionPoint.getExtensions();
    for (IExtension extension : extensions) {
        try {
            totalIds.add(extension.getNamespaceIdentifier());
        } catch (InvalidRegistryObjectException e) {
        // ignore this extension and move on
        }
    }
    Collection<String> additionalPluginIds = BaseHelpSystem.getLocalSearchManager().getPluginsWithSearchParticipants();
    totalIds.addAll(additionalPluginIds);
    Iterator<String> idIter = totalIds.iterator();
    while (idIter.hasNext()) {
        String id = idIter.next();
        if (!id.startsWith("org.talend.")) {
            idIter.remove();
        }
    }
    return new PluginVersionInfo(INDEXED_CONTRIBUTION_INFO_FILE, totalIds, indexDir, !exists());
}
Also used : IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) IExtension(org.eclipse.core.runtime.IExtension) InvalidRegistryObjectException(org.eclipse.core.runtime.InvalidRegistryObjectException) HashSet(java.util.HashSet) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry) PluginVersionInfo(org.eclipse.help.internal.search.PluginVersionInfo)

Aggregations

InvalidRegistryObjectException (org.eclipse.core.runtime.InvalidRegistryObjectException)2 HashSet (java.util.HashSet)1 CoreException (org.eclipse.core.runtime.CoreException)1 IExtension (org.eclipse.core.runtime.IExtension)1 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)1 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)1 IStatus (org.eclipse.core.runtime.IStatus)1 PerformanceStats (org.eclipse.core.runtime.PerformanceStats)1 PluginVersionInfo (org.eclipse.help.internal.search.PluginVersionInfo)1 AbstractProposalSorter (org.eclipse.jdt.ui.text.java.AbstractProposalSorter)1