Class DerivedSourceSearchParticipantRegistry
- All Implemented Interfaces:
EventListener, org.eclipse.core.runtime.IRegistryEventListener
org.eclipse.jdt.core.derivedSourceSearchParticipant extension point.
Each contributed participant declares a set of file extensions it handles. The registry maps file extensions to eagerly-instantiated participant instances.
The registry listens for extension additions and removals via
IRegistryEventListener, so dynamically loaded or unloaded bundles
are reflected automatically without restart.
-
Method Summary
Modifier and TypeMethodDescriptionvoidadded(org.eclipse.core.runtime.IExtension[] extensions) voidadded(org.eclipse.core.runtime.IExtensionPoint[] extensionPoints) voiddispose()Disposes this registry by removing its extension registry listener.static voidDisposes the singleton instance of this registry.static DerivedSourceSearchParticipant[]Returns all contributed search participants.static StringgetFileExtension(String fileName) Returns the file extension from a file name, ornullif none.static StringgetLanguageId(String fileExtension) Returns the LSP language identifier for the given file extension, ornullif no search participant is registered for it.getParticipant(String fileExtension) Returns the search participant registered for the given file extension, ornullif none.static booleanhasParticipant(String fileExtension) Returns whether the given file extension has a registered search participant.voidremoved(org.eclipse.core.runtime.IExtension[] extensions) voidremoved(org.eclipse.core.runtime.IExtensionPoint[] extensionPoints) static voidreset()Resets the registry, forcing a fresh reload from the extension registry.
-
Method Details
-
dispose
public void dispose()Disposes this registry by removing its extension registry listener.This should be called during JavaCore/JavaModelManager shutdown to avoid the extension registry retaining references to this classloader after the
org.eclipse.jdt.corebundle is stopped or updated. -
disposeInstance
public static void disposeInstance()Disposes the singleton instance of this registry.Intended to be invoked from JavaCore/JavaModelManager shutdown.
-
getParticipant
Returns the search participant registered for the given file extension, ornullif none.- Parameters:
fileExtension- file extension without dot, e.g."kt"- Returns:
- the search participant, or
null
-
getContributedParticipants
Returns all contributed search participants. Does not include the default Java search participant.- Returns:
- array of contributed participants (may be empty, never null)
-
getLanguageId
Returns the LSP language identifier for the given file extension, ornullif no search participant is registered for it.If the participant's extension point registration includes a
languageIdattribute, that value is returned. Otherwise, the file extension itself is used as the language identifier.- Parameters:
fileExtension- file extension without dot, e.g."kt"- Returns:
- the language identifier (e.g.
"kotlin"), ornull
-
hasParticipant
Returns whether the given file extension has a registered search participant.- Parameters:
fileExtension- file extension without dot- Returns:
- true if a participant is registered for this extension
-
reset
public static void reset()Resets the registry, forcing a fresh reload from the extension registry. Intended for testing only. -
getFileExtension
-
added
public void added(org.eclipse.core.runtime.IExtension[] extensions) - Specified by:
addedin interfaceorg.eclipse.core.runtime.IRegistryEventListener
-
removed
public void removed(org.eclipse.core.runtime.IExtension[] extensions) - Specified by:
removedin interfaceorg.eclipse.core.runtime.IRegistryEventListener
-
added
public void added(org.eclipse.core.runtime.IExtensionPoint[] extensionPoints) - Specified by:
addedin interfaceorg.eclipse.core.runtime.IRegistryEventListener
-
removed
public void removed(org.eclipse.core.runtime.IExtensionPoint[] extensionPoints) - Specified by:
removedin interfaceorg.eclipse.core.runtime.IRegistryEventListener
-