Class AbstractExplorerPanel
java.lang.Object
de.luckymcdev.foundryengine.client.editor.panel.Panel
de.luckymcdev.foundryengine.client.editor.panel.editor.EditorPanel
de.luckymcdev.foundryengine.client.editor.panel.explorer.AbstractExplorerPanel
- Direct Known Subclasses:
FileExplorerPanel, ResourceExplorerPanel
Abstract base for browser panels (ResourceBrowserPanel, FileExplorerPanel).
Provides common rendering logic for tree-based resource browsing.
-
Nested Class Summary
Nested classes/interfaces inherited from class Panel
Panel.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcontent()protected net.minecraft.resources.IdentifiergenerateEditorId(String prefix, String resourcePath) Builds a stable, filesystem-safeIdentifierfor an editor tab from an arbitrary resource path string.protected @Nullable CodeEditorgetExistingEditor(net.minecraft.resources.Identifier editorId) If aCodeEditorforeditorIdalready exists, focuses it and returns it.protected booleanisResourceOpen(net.minecraft.resources.Identifier editorId) Returnstrueif an editor for the given ID is already registered and open.protected abstract voidopenResource(net.minecraft.resources.Identifier id) Handle opening/editing a resource identified by an Identifier.protected abstract voidrefresh()Refresh the browser tree structure.protected abstract voidRender the main browsing tree.protected voidRenders a namespace/root resource node and recurses into its children.protected voidrenderResourceFile(net.minecraft.resources.Identifier id) Renders a single resource file leaf node.protected voidRenders the contents of a resource folder: sub-folders first, then leaf files.protected voidrenderSection(String label, String id, Runnable body) Renders a collapsible section with a bold framed header.Methods inherited from class EditorPanel
beginContent, endContent, setStatusMethods inherited from class Panel
close, customFlags, getFormattedLabel, getId, getLabel, getShortcut, handleRender, handleTick, isFocused, isOpen, menuBar, onClosed, onOpened, open, requireLevel, requireLevel, requireLevelOnServer, requireLocal, requireWorld, requireWorld, setDefaultRequirements, tick
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
initialized
protected boolean initialized
-
-
Constructor Details
-
AbstractExplorerPanel
-
-
Method Details
-
refresh
protected abstract void refresh()Refresh the browser tree structure. Implement to populate nodes. -
renderBrowser
protected abstract void renderBrowser()Render the main browsing tree. Override for custom layout. -
openResource
protected abstract void openResource(net.minecraft.resources.Identifier id) Handle opening/editing a resource identified by an Identifier. -
content
-
renderSection
Renders a collapsible section with a bold framed header. Thebodyrunnable is called only when the section is open.- Parameters:
label- display label (may include an icon prefix)id- unique ImGui ID string (prefix with##)body- content to render inside the section
-
renderNamespaceNode
Renders a namespace/root resource node and recurses into its children. The node is shown with a cube icon and the namespace name. -
renderResourceFolder
Renders the contents of a resource folder: sub-folders first, then leaf files. -
renderResourceFile
protected void renderResourceFile(net.minecraft.resources.Identifier id) Renders a single resource file leaf node. Double-clicking opens the resource; subclasses may override for custom behaviour. -
generateEditorId
Builds a stable, filesystem-safeIdentifierfor an editor tab from an arbitrary resource path string.- Parameters:
prefix- short type hint, e.g."res"or"res_tex"resourcePath- raw resource path (colons, slashes, etc. are sanitised)
-
isResourceOpen
protected boolean isResourceOpen(net.minecraft.resources.Identifier editorId) Returnstrueif an editor for the given ID is already registered and open. -
getExistingEditor
If aCodeEditorforeditorIdalready exists, focuses it and returns it. Returnsnullif no such editor exists yet.
-