Class ActionSupport

java.lang.Object
org.praxislive.ide.pxr.api.ActionSupport

public final class ActionSupport extends Object
Support class for Actions in PXR editors.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Action ID for the Add Child action.
    static final String
    Action category for all PXR action.
    static final String
    Action ID for the Expose Controls action.
    static final String
    Action ID for the Root configuration action.
    static final String
    Action ID for the Root start action.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.praxislive.ide.core.api.Task.WithResult<String>
    createAddChildTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, org.praxislive.core.ComponentType type)
    Create a task to add a component to the container.
    static Action
    createCopyAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
    Create a copy action for the provided editor and explorer.
    static org.praxislive.ide.core.api.Task
    createCopyTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, List<String> children)
    Create a task to copy the given children of the container to the clipboard.
    static Action
    createDeleteAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
    Create a delete action for the provided editor and explorer.
    static org.praxislive.ide.core.api.Task
    createDeleteTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, List<String> children, List<org.praxislive.core.Connection> connections)
    Create a task to delete the given children and/or connections from the given container.
    static Action
    createDuplicateAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
    Create a duplicate action for the provided editor and explorer.
    static Action
    createExportAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
    Create an export action for the provided editor and explorer.
    static org.praxislive.ide.core.api.Task
    createExportTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, List<String> children)
    Create a task to export the given children of the container to a subgraph file.
    static org.praxislive.ide.core.api.Task
    createImportTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, org.openide.filesystems.FileObject file)
    Create a task to import the provided subgraph file in to the provided container.
    static Action
    createPasteAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
    Create a paste action for the provided editor and explorer.
    static org.praxislive.ide.core.api.Task.WithResult<List<String>>
    createPasteTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container)
    Create a task to handle pasting the clipboard contents into the provided container.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CATEGORY

      public static final String CATEGORY
      Action category for all PXR action. For use with ActionID, Actions.forID(java.lang.String, java.lang.String), etc.
      See Also:
    • ADD_CHILD

      public static final String ADD_CHILD
      Action ID for the Add Child action. For use with ActionID, Actions.forID(java.lang.String, java.lang.String), etc.
      See Also:
    • EXPOSE_CONTROLS

      public static final String EXPOSE_CONTROLS
      Action ID for the Expose Controls action. For use with ActionID, Actions.forID(java.lang.String, java.lang.String), etc.
      See Also:
    • ROOT_CONFIG

      public static final String ROOT_CONFIG
      Action ID for the Root configuration action. For use with ActionID, Actions.forID(java.lang.String, java.lang.String), etc.
      See Also:
    • ROOT_START

      public static final String ROOT_START
      Action ID for the Root start action. For use with ActionID, Actions.forID(java.lang.String, java.lang.String), etc.
      See Also:
  • Method Details

    • createAddChildTask

      public static org.praxislive.ide.core.api.Task.WithResult<String> createAddChildTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, org.praxislive.core.ComponentType type)
      Create a task to add a component to the container. The task will show a dialog for the user to enter the component ID. The task result on success is the ID of the added component.
      Parameters:
      editor - active root editor
      container - container to add child to
      type - component type of child
      Returns:
      child creation task
    • createCopyAction

      public static Action createCopyAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
      Create a copy action for the provided editor and explorer. The action calls through to
      invalid reference
      #createCopyTask(org.praxislive.ide.pxr.spi.RootEditor, org.praxislive.ide.model.ContainerProxy, java.util.Set)
      . The action may be used in an ActionMap linked to the global copy action key, or standalone in popups. The action implements Disposable and it is recommended to pass to Disposable.dispose(java.lang.Object) rather than relying on GC to clear listeners.
      Parameters:
      editor - root editor
      explorer - explorer manager
      Returns:
      copy action
    • createCopyTask

      public static org.praxislive.ide.core.api.Task createCopyTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, List<String> children)
      Create a task to copy the given children of the container to the clipboard. The task will call in to the hub to serialize the components, so will complete asynchronously.
      Parameters:
      editor - active root editor
      container - container of children to copy
      children - set of child IDs to copy
      Returns:
      copy task
    • createDeleteAction

      public static Action createDeleteAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
      Create a delete action for the provided editor and explorer. The action calls through to createDeleteTask(org.praxislive.ide.pxr.spi.RootEditor, org.praxislive.ide.model.ContainerProxy, java.util.List, java.util.List). The action may be used in an ActionMap linked to the global delete action key, or standalone in popups. The action implements Disposable and it is recommended to pass to Disposable.dispose(java.lang.Object) rather than relying on GC to clear listeners.

      The connections list passed to the task will always be empty as the explorer manager has no notion of selected connections. A root editor needing to handle connection deletions separately should use a custom action that calls the deletion task.

      Parameters:
      editor - root editor
      explorer - explorer manager
      Returns:
      delete action
    • createDeleteTask

      public static org.praxislive.ide.core.api.Task createDeleteTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, List<String> children, List<org.praxislive.core.Connection> connections)
      Create a task to delete the given children and/or connections from the given container. A confirmation dialog will be shown if the list of children is not empty.
      Parameters:
      editor - active root editor
      container - container
      children - child IDs to delete
      connections - connections to delete
      Returns:
      delete task
    • createDuplicateAction

      public static Action createDuplicateAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
      Create a duplicate action for the provided editor and explorer. The action may be used in an ActionMap linked to the global duplicate action key, or standalone in popups. The action implements Disposable and it is recommended to pass to Disposable.dispose(java.lang.Object) rather than relying on GC to clear listeners.
      Parameters:
      editor - root editor
      explorer - explorer manager
      Returns:
      duplicate action
    • createExportAction

      public static Action createExportAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
      Create an export action for the provided editor and explorer. The action calls through to createExportTask(org.praxislive.ide.pxr.spi.RootEditor, org.praxislive.ide.model.ContainerProxy, java.util.List). The action implements Disposable and it is recommended to pass to Disposable.dispose(java.lang.Object) rather than relying on GC to clear listeners.
      Parameters:
      editor - root editor
      explorer - explorer manager
      Returns:
      export action
    • createExportTask

      public static org.praxislive.ide.core.api.Task createExportTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, List<String> children)
      Create a task to export the given children of the container to a subgraph file. The task will complete asynchronously, first calling in to the hub to serialize the components, then writing to the file. A dialog will be shown for the user to select the export file name and other properties.
      Parameters:
      editor - active root editor
      container - container of children to export
      children - child IDs to include in export
      Returns:
      export task
    • createImportTask

      public static org.praxislive.ide.core.api.Task createImportTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container, org.openide.filesystems.FileObject file)
      Create a task to import the provided subgraph file in to the provided container. A dialog will be shown to allow the user to change the IDs of components added to the container.
      Parameters:
      editor - active root editor
      container - container for import
      file - subgraph file
      Returns:
      import task
    • createPasteAction

      public static Action createPasteAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer)
      Create a paste action for the provided editor and explorer. The action calls through to createPasteTask(org.praxislive.ide.pxr.spi.RootEditor, org.praxislive.ide.model.ContainerProxy). The action may be used in an ActionMap linked to the global paste action key, or standalone in popups. The action implements Disposable and it is recommended to pass to Disposable.dispose(java.lang.Object) rather than relying on GC to clear listeners.
      Parameters:
      editor - root editor
      explorer - explorer manager
      Returns:
      paste action
    • createPasteTask

      public static org.praxislive.ide.core.api.Task.WithResult<List<String>> createPasteTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container)
      Create a task to handle pasting the clipboard contents into the provided container. The clipboard contents should match the format of subgraph files, as produced by the copy task. A dialog will be shown to allow the user to change the IDs of components added to the container. The result of the task is a list of the IDs of direct children added to the container.
      Parameters:
      editor - active root editor
      container - container for paste
      Returns:
      paste task