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
Modifier and TypeClassDescriptionstatic class
SnippetManager.Builder<B extends SnippetManager.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionSnippetManager
(MemorySegment address) Create a SnippetManager proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SnippetManager
asParent()
Returns this instance as if it were its parent type.static SnippetManager.Builder
<? extends SnippetManager.Builder> builder()
ASnippetManager.Builder
object constructs aSnippetManager
with the specified properties.static SnippetManager
Returns the defaultGtkSourceSnippetManager
instance.String[]
Gets the list directories where this SnippetManager looks for snippet files.getSnippet
(@Nullable String group, @Nullable String languageId, String trigger) Queries the known snippets for the first matchinggroup
,languageId
, and/ortrigger
.static Type
getType()
Get the GType of the SnippetManager classlistAll()
Gets aListModel
of 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
.void
setSearchPath
(@Nullable String[] dirs) Sets the list of directories in which theGtkSourceSnippetManager
looks 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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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 defaultGtkSourceSnippetManager
instance.- Returns:
- a
GtkSourceSnippetManager
which 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 bylm
and must not be modified.
-
getSnippet
public Snippet getSnippet(@Nullable @Nullable String group, @Nullable @Nullable String languageId, String trigger) Queries the known snippets for the first matchinggroup
,languageId
, and/ortrigger
.If
group
orlanguageId
arenull
, they will be ignored.- Parameters:
group
- a group name ornull
languageId
- aGtkSourceLanguage
:id ornull
trigger
- the trigger for the snippet- Returns:
- a
GtkSourceSnippet
ornull
if 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 @Nullable String group, @Nullable @Nullable String languageId, @Nullable @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
ListModel
only 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 ornull
languageId
- aGtkSourceLanguage
:id ornull
triggerPrefix
- a prefix for a trigger to activate- Returns:
- a
GListModel
ofGtkSourceSnippet
.
-
setSearchPath
Sets the list of directories in which theGtkSourceSnippetManager
looks for snippet files.If
dirs
isnull
, 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.Builder
object constructs aSnippetManager
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSnippetManager.Builder.build()
.
-