Interface Workspace

All Superinterfaces:
ApplicationInformationAccess, ColorThemeUtilities, WorkspaceUtilities
All Known Subinterfaces:
AuthorWorkspaceAccess, EclipsePluginWorkspace, PluginWorkspace, StandalonePluginWorkspace, WebappPluginWorkspace

@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface Workspace extends WorkspaceUtilities
Provides access to workspace specific information and actions.
Since:
11.2
  • Method Details

    • open

      boolean open(URL url)
      Opens the file at the specified URL in a new editor. If the URL is already opened, the editor tab which contains it will be brought to front.
      Parameters:
      url - The URL of the file to be opened.
      Returns:
      true if the operation has succeeded.
    • open

      boolean open(URL url, String imposedPage)
      Opens the file at the specified URL in a new editor. If the URL is already opened, the editor tab which contains it will be brought to front.
      Parameters:
      url - The URL of the file to be opened.
      imposedPage - The imposed page for opening the URL. One of the page related constants from EditorPageConstants.
      Returns:
      true if the operation has succeeded.
      Since:
      13
    • open

      boolean open(URL url, String imposedPage, String imposedContentType)
      Opens the file at the specified URL in a new editor by specifying an imposed page and an imposed content type. If the URL is already opened, the editor tab which contains it will be brought to front. The imposed content type is used only in the Oxygen standalone application, it is not used in the Author Component and Eclipse plugin applications.
      Parameters:
      url - The URL of the file to be opened.
      imposedPage - The imposed page for opening the URL. Can be null to perform the default behavior.
      imposedContentType - The imposed content type, one of the constants in the interface ro.sync.exml.editor.ContentTypes.
      This is useful if for example the URL does not have a file extension (maybe it is a CMS resource) but the caller of the API knows that it is XML. In this case the caller can provide the "text/xml" imposed content type for it to avoid Oxygen asking what type of resource the URL is.
      Another use case is for DITA Map URLs without an extension. The caller can pass the "application/ditamap" content type value to the API. In the standalone application Oxygen will ask the user where to open the DITA Map (DITA Maps Manager or the main editor) and will continue the open procedure.
      In the Oxygen Eclipse plugin the DITA Map will be opened directly in the DITA Maps Manager view.
      Can be null to perform the default behavior.
      Returns:
      true if the operation has succeeded.
      Since:
      15.2
    • saveAll

      void saveAll()
      Saves the content of all opened and unsaved editors.
    • close

      boolean close(URL url)
      Closes the editor specified by the URL.

      If the editor has unsaved content, the user will be given the opportunity to save it.

      Parameters:
      url - The url of the editor to be closed.
      Returns:
      true if the editor was successfully closed, and false if the editor could not be closed.
    • closeAll

      boolean closeAll()
      Closes all the editors.

      If there are editors with unsaved content, the user will be given the opportunity to save them.

      Returns:
      true if the editors were successfully closed, and false if the editors are still open.
    • delete

      void delete(URL url) throws IOException
      Delete the resource identified by the specified URL. Currently supported protocols are:
      • file://
      • zip://
      • ftp://
      • sftp://
      • http://
      • https://
      Parameters:
      url - The URL from where to delete a resource.
      Throws:
      IOException - If an I/O exception occurs.
    • refreshInProject

      void refreshInProject(URL url)
      If a new file appeared as a child of a folder in the project, use this method to refresh the parent folder.
      Parameters:
      url - The new resource
    • createNewEditor

      URL createNewEditor(String extension, String contentType, String content)
      This is available only in the standalone Oxygen version (not available in the Oxygen Eclipse plugin).
      Create a new "Untitled" editor. The editor content is not saved on disk, this method is equivalent to using the "File -> New" action.
      Parameters:
      extension - The editor extension ("xml" or "dita" or "xsl" or "xsd", etc...)
      contentType - The content type which can take values like: "text/xml" or "text/xsl" or "text/xsd", etc... If NULL, the content type will be automatically detected from the extension.
      content - The XML content will be used to load the new editor from.
      Returns:
      The URL of the created new editor.
      Since:
      12.1
    • createNewEditor

      URL createNewEditor(URL saveTo, String extension, String contentType, String content)
      This is available only in the standalone Oxygen version (not available in the Oxygen Eclipse plugin).
      Create a new "Untitled" editor. The editor content is not saved on disk, this method is equivalent to using the "File -> New" action.
      Parameters:
      saveTo - The URL where the new file will be saved when the save operation is invoked for the first time.
      extension - The editor extension ("xml" or "dita" or "xsl" or "xsd", etc...). May be null if the saveTo URL is specified.
      contentType - The content type which can take values like: "text/xml" or "text/xsl" or "text/xsd", etc... If NULL, the content type will be automatically detected from the extension.
      content - The XML content will be used to load the new editor from.
      Returns:
      The URL of the created new editor. Can be null if the URL is already opened in the application.
      Since:
      22
    • isStandalone

      @Deprecated boolean isStandalone()
      Deprecated.
      This method returns false also when running inside the WebApp. Use ApplicationInformationAccess.getPlatform() instead.
      Check if the extension is used in the Oxygen stand alone or Eclipse plugin version.
      Returns:
      true if this is the stand-alone Oxygen version or false if it is the Oxygen Eclipse plug-in version.
    • setParentFrameTitle

      void setParentFrameTitle(String parentFrameTitle)
      Set a title on the parent frame. This is available only in the standalone Oxygen version (not available in the Oxygen Eclipse plugin). If NULL, will reset to the default title.
      Parameters:
      parentFrameTitle - The new title to set on the parent frame. If NULL, will reset to the default title.
      Since:
      12.1