Class SnippetManager
- All Implemented Interfaces:
Proxy
Provides access to Snippet.
GtkSourceSnippetManager is an object which processes snippet description
files and creates Snippet objects.
Use getDefault() to retrieve the default
instance of GtkSourceSnippetManager.
Use getSnippet(String, String, String) to retrieve snippets for
a given snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSnippetManager.Builder<B extends SnippetManager.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new SnippetManager.SnippetManager(MemorySegment address) Create a SnippetManager instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SnippetManagerasParent()Return this instance as if it were its parent type.static SnippetManager.Builder<? extends SnippetManager.Builder> builder()ASnippetManager.Builderobject constructs aSnippetManagerwith the specified properties.static SnippetManagerReturns the defaultGtkSourceSnippetManagerinstance.static MemoryLayoutThe memory layout of the native struct.String[]Gets the list directories where this SnippetManager looks for snippet files.@Nullable SnippetgetSnippet(@Nullable String group, @Nullable String languageId, String trigger) Queries the known snippets for the first matchinggroup,languageId,and/ortrigger.static @Nullable TypegetType()Get the GType of the SnippetManager class.listAll()Gets aListModelof all snippets.String[]List all the known groups within the snippet manager.listMatching(@Nullable String group, @Nullable String languageId, @Nullable String triggerPrefix) Queries the known snippets for those matchinggroup,languageId,and/ortriggerPrefix.voidsetSearchPath(@Nullable String @Nullable [] dirs) Sets the list of directories in which theGtkSourceSnippetManagerlooks for snippet files.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SnippetManager
Create a SnippetManager instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SnippetManager
public SnippetManager()Create a new SnippetManager.
-
-
Method Details
-
getType
Get the GType of the SnippetManager class.- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
getDefault
Returns the defaultGtkSourceSnippetManagerinstance.- Returns:
- a
GtkSourceSnippetManagerwhich is owned by GtkSourceView library and must not be unref'd.
-
getSearchPath
Gets the list directories where this SnippetManager looks for snippet files.- Returns:
null-terminated array containing a list of snippet files directories. The array is owned bylmand must not be modified.
-
getSnippet
public @Nullable Snippet getSnippet(@Nullable String group, @Nullable String languageId, String trigger) Queries the known snippets for the first matching
group,languageId,and/ortrigger.If
grouporlanguageIdarenull, they will be ignored.- Parameters:
group- a group name ornulllanguageId- aGtkSourceLanguage:id ornulltrigger- the trigger for the snippet- Returns:
- a
GtkSourceSnippetornullif no matching snippet was found.
-
listAll
-
listGroups
List all the known groups within the snippet manager.
The result should be freed with g_free(), and the individual strings are owned by this SnippetManager and should never be freed by the caller.
- Returns:
- An array of strings which should be freed with g_free().
-
listMatching
public ListModel listMatching(@Nullable String group, @Nullable String languageId, @Nullable String triggerPrefix) Queries the known snippets for those matching
group,languageId,and/ortriggerPrefix.If any of these are
null, they will be ignored when filtering the available snippets.The
ListModelonly contains information about the available snippets until ListModel#getItem is called for a specific snippet. This helps reduce the number ofGObject's that are created at runtime to those needed by the calling application.- Parameters:
group- a group name ornulllanguageId- aGtkSourceLanguage:id ornulltriggerPrefix- a prefix for a trigger to activate- Returns:
- a
GListModelofGtkSourceSnippet.
-
setSearchPath
Sets the list of directories in which the
GtkSourceSnippetManagerlooks for snippet files.If
dirsisnull, the search path is reset to default.At the moment this function can be called only before the snippet files are loaded for the first time. In practice to set a custom search path for a
GtkSourceSnippetManager, you have to call this function right after creating it.- Parameters:
dirs- anull-terminated array of strings ornull.
-
builder
ASnippetManager.Builderobject constructs aSnippetManagerwith the specified properties. Use the variousset...()methods to set properties, and finish construction withSnippetManager.Builder.build().- Returns:
- the builder object
-