Package org.praxislive.ide.pxr.api
Class ActionSupport
java.lang.Object
org.praxislive.ide.pxr.api.ActionSupport
Support class for Actions in PXR editors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAction ID for the Add Child action.static final StringAction category for all PXR action.static final StringAction ID for the Expose Controls action.static final StringAction ID for the Root configuration action.static final StringAction ID for the Root start action. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 ActioncreateCopyAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer) Create a copy action for the provided editor and explorer.static org.praxislive.ide.core.api.TaskcreateCopyTask(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 ActioncreateDeleteAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer) Create a delete action for the provided editor and explorer.static org.praxislive.ide.core.api.TaskcreateDeleteTask(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 ActioncreateDuplicateAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer) Create a duplicate action for the provided editor and explorer.static ActioncreateExportAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer) Create an export action for the provided editor and explorer.static org.praxislive.ide.core.api.TaskcreateExportTask(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.TaskcreateImportTask(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 ActioncreatePasteAction(RootEditor editor, org.openide.explorer.ExplorerManager explorer) Create a paste action for the provided editor and explorer.createPasteTask(RootEditor editor, org.praxislive.ide.model.ContainerProxy container) Create a task to handle pasting the clipboard contents into the provided container.
-
Field Details
-
CATEGORY
Action category for all PXR action. For use withActionID,Actions.forID(java.lang.String, java.lang.String), etc.- See Also:
-
ADD_CHILD
Action ID for the Add Child action. For use withActionID,Actions.forID(java.lang.String, java.lang.String), etc.- See Also:
-
EXPOSE_CONTROLS
Action ID for the Expose Controls action. For use withActionID,Actions.forID(java.lang.String, java.lang.String), etc.- See Also:
-
ROOT_CONFIG
Action ID for the Root configuration action. For use withActionID,Actions.forID(java.lang.String, java.lang.String), etc.- See Also:
-
ROOT_START
Action ID for the Root start action. For use withActionID,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 editorcontainer- container to add child totype- 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. The action may be used in an ActionMap linked to the global copy action key, or standalone in popups. The action implementsinvalid reference
#createCopyTask(org.praxislive.ide.pxr.spi.RootEditor, org.praxislive.ide.model.ContainerProxy, java.util.Set)Disposableand it is recommended to pass toDisposable.dispose(java.lang.Object)rather than relying on GC to clear listeners.- Parameters:
editor- root editorexplorer- 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 editorcontainer- container of children to copychildren- 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 tocreateDeleteTask(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 implementsDisposableand it is recommended to pass toDisposable.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 editorexplorer- 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 editorcontainer- containerchildren- child IDs to deleteconnections- 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 implementsDisposableand it is recommended to pass toDisposable.dispose(java.lang.Object)rather than relying on GC to clear listeners.- Parameters:
editor- root editorexplorer- 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 tocreateExportTask(org.praxislive.ide.pxr.spi.RootEditor, org.praxislive.ide.model.ContainerProxy, java.util.List). The action implementsDisposableand it is recommended to pass toDisposable.dispose(java.lang.Object)rather than relying on GC to clear listeners.- Parameters:
editor- root editorexplorer- 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 editorcontainer- container of children to exportchildren- 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 editorcontainer- container for importfile- 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 tocreatePasteTask(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 implementsDisposableand it is recommended to pass toDisposable.dispose(java.lang.Object)rather than relying on GC to clear listeners.- Parameters:
editor- root editorexplorer- 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 editorcontainer- container for paste- Returns:
- paste task
-