Class SnippetManager
- All Implemented Interfaces:
Proxy
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(java.lang.String, java.lang.String, java.lang.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 org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SnippetManager.SnippetManager(MemorySegment address) Create a SnippetManager proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SnippetManagerasParent()Returns 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.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 classlistAll()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 org.gnome.gobject.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, getMemoryLayout, 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 org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SnippetManager
Create a SnippetManager proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SnippetManager
public SnippetManager()Creates a new SnippetManager.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
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 matchinggroup,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 matchinggroup,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 untilListModel.getItem(int)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 theGtkSourceSnippetManagerlooks 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
-