Class SnippetChunk
- All Implemented Interfaces:
Proxy
The GtkSourceSnippetChunk
represents a single chunk of text that
may or may not be an edit point within the snippet. Chunks that are
an edit point (also called a tab stop) have the
SnippetChunk:focus-position
property set.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
SnippetChunk.Builder<B extends SnippetChunk.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.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCreate a newGtkSourceSnippetChunk
that can be added to aSnippet
.SnippetChunk
(MemorySegment address) Create a SnippetChunk proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SnippetChunk
asParent()
Returns this instance as if it were its parent type.static SnippetChunk.Builder
<? extends SnippetChunk.Builder> builder()
ASnippetChunk.Builder
object constructs aSnippetChunk
with the specified properties.copy()
Copies the source snippet.Gets the context for the snippet insertion.int
Gets theSnippetChunk:focus-position
.getSpec()
Gets the specification for the chunk.getText()
Gets theSnippetChunk:text
property.boolean
Gets theSnippetChunk:text-set
property.static Type
getType()
Get the GType of the SnippetChunk classvoid
setContext
(SnippetContext context) void
setFocusPosition
(int focusPosition) Sets theSnippetChunk:focus-position
property.void
Sets the specification for the chunk.void
Sets the text for the snippet chunk.void
setTextSet
(boolean textSet) Sets theSnippetChunk:text-set
property.void
setTooltipText
(String tooltipText) Methods inherited from class org.gnome.gobject.InitiallyUnowned
getMemoryLayout
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, 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
-
SnippetChunk
Create a SnippetChunk proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
SnippetChunk
public SnippetChunk()Create a newGtkSourceSnippetChunk
that can be added to aSnippet
.
-
-
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.- Overrides:
asParent
in classInitiallyUnowned
-
copy
-
getContext
Gets the context for the snippet insertion.- Returns:
- A
GtkSourceSnippetContext
-
getFocusPosition
public int getFocusPosition()Gets theSnippetChunk:focus-position
.The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.
A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.
A focus-position of -1 means the chunk cannot be focused by the user.
- Returns:
- the focus-position
-
getSpec
Gets the specification for the chunk.The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the
SnippetChunk:text
andSnippetChunk:text-set
properties are updated.- Returns:
- the specification, if any
-
getText
Gets theSnippetChunk:text
property.The text property is updated when the user edits the text of the chunk. If it has not been edited, the
SnippetChunk:spec
property is returned.- Returns:
- the text of the chunk
-
getTextSet
public boolean getTextSet()Gets theSnippetChunk:text-set
property.This is typically set when the user has edited a snippet chunk.
-
getTooltipText
-
setContext
-
setFocusPosition
public void setFocusPosition(int focusPosition) Sets theSnippetChunk:focus-position
property.The focus-position is used to determine how many tabs it takes for the snippet to advanced to this chunk.
A focus-position of zero will be the last focus position of the snippet and snippet editing ends when it has been reached.
A focus-position of -1 means the chunk cannot be focused by the user.
- Parameters:
focusPosition
- the focus-position
-
setSpec
Sets the specification for the chunk.The specification is evaluated for variables when other chunks are edited within the snippet context. If the user has changed the text, the
SnippetChunk:text and
SnippetChunk:text-set
properties are updated.- Parameters:
spec
- the new specification for the chunk
-
setText
Sets the text for the snippet chunk.This is usually used by the snippet engine to update the text, but may be useful when creating custom snippets to avoid expansion of any specification.
- Parameters:
text
- the text of the property
-
setTextSet
public void setTextSet(boolean textSet) Sets theSnippetChunk:text-set
property.This is typically set when the user has edited a snippet chunk by the snippet engine.
- Parameters:
textSet
- the property value
-
setTooltipText
-
builder
ASnippetChunk.Builder
object constructs aSnippetChunk
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSnippetChunk.Builder.build()
.
-