Class AgiContext
java.lang.Object
uno.anahata.asi.intellij.internal.AgiContext
Bridge between IntelliJ
VirtualFile selections and the per-session Anahata
ResourceManager, backing the Project-view "AGI Context" node decorator and popup
action.
This is the IntelliJ counterpart of the NetBeans FilesContextActionLogic. It adds
and removes files (recursing into directories) from a session's context, and reports
membership so the decorator can badge in-context files. All session lookups go through the
live IntellijAsiContainer.getInstances() registry.
- Author:
- anahata
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all active sessions across every live tool-window container.static intAdds the selection (directories expanded to their files) to the session's context.static booleanallInContext(Agi agi, com.intellij.openapi.vfs.VirtualFile[] files) Tests whether every file in the selection (directories expanded to their files) is in the given session's context.collect(com.intellij.openapi.vfs.VirtualFile[] files) Expands a selection into concrete local file paths, recursing into directories.private static voidcollectInto(com.intellij.openapi.vfs.VirtualFile file, List<Path> out) Recursively accumulates local files under a node into the target list.private static StringpathKey(com.intellij.openapi.vfs.VirtualFile file) Canonical resource key for a local file, matching howregisterPathsstores it.static intRemoves the selection (directories expanded to their files) from the session's context.static intsessionsContaining(com.intellij.openapi.vfs.VirtualFile file) Counts how many active sessions currently hold the given file in context.
-
Field Details
-
ACTOR
The actor recorded when files are added to context from the Project view.- See Also:
-
-
Constructor Details
-
AgiContext
private AgiContext()Non-instantiable utility holder.
-
-
Method Details
-
activeSessions
-
sessionsContaining
public static int sessionsContaining(com.intellij.openapi.vfs.VirtualFile file) Counts how many active sessions currently hold the given file in context.- Parameters:
file- the file to test.- Returns:
- the number of sessions containing the file (0 if none, or if it is a directory).
-
allInContext
Tests whether every file in the selection (directories expanded to their files) is in the given session's context.- Parameters:
agi- the session.files- the selected files/folders.- Returns:
trueif the selection is non-empty and fully in context.
-
add
Adds the selection (directories expanded to their files) to the session's context.- Parameters:
agi- the session.files- the selected files/folders.- Returns:
- the number of files registered.
-
remove
Removes the selection (directories expanded to their files) from the session's context.- Parameters:
agi- the session.files- the selected files/folders.- Returns:
- the number of resources unregistered.
-
collect
-
collectInto
-
pathKey
Canonical resource key for a local file, matching howregisterPathsstores it.- Parameters:
file- the file.- Returns:
- the absolute path string key.
-

