Interface WorkspaceUtilities

    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      java.io.File chooseDirectory()
      Displays a directory chooser for selecting a directory.
      java.io.File chooseDirectory​(java.io.File startingDir)
      Displays a directory chooser.
      java.io.File chooseFile​(java.io.File currentFileContext, java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr, boolean usedForSave)
      Displays a file chooser for selecting a File.
      java.io.File chooseFile​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr)
      Displays a file chooser for selecting a File.
      java.io.File chooseFile​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr, boolean openForSave)
      Displays a file chooser for selecting a File.
      java.io.File[] chooseFiles​(java.io.File currentFileContext, java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr)
      Displays a file chooser for selecting multiple Files.
      java.net.URL chooseURL​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr)
      Displays an URL chooser for selecting an URL.
      java.net.URL chooseURL​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr, java.lang.String initialURL)
      Displays an URL chooser for selecting an URL.
      java.net.URL chooseURL​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr, java.lang.String initialURL, java.lang.String urlLabel, java.lang.String okLabel)
      Displays an URL chooser for selecting an URL.
      java.lang.String chooseURLPath​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr)
      Displays an URL chooser for selecting an URL.
      java.lang.String chooseURLPath​(java.lang.String title, java.lang.String[] allowedExtensions, java.lang.String filterDescr, java.lang.String initialURL)
      Displays an URL chooser for selecting an URL.
      void clearImageCache()
      Deprecated.
      ProcessController createJavaProcess​(java.lang.String additionalJavaArguments, java.lang.String[] classpath, java.lang.String mainClass, java.lang.String additionalArguments, java.util.Map<java.lang.String,​java.lang.String> environmentalVariables, java.io.File startDirectory, ProcessListener processListener)
      Prepare a Java process for execution.
      ProcessController createProcess​(ProcessListener processListener, java.lang.String name, java.io.File workingDirectory, java.lang.String cmdLine, boolean showConsole)
      Create a process that executes a given command line.
      ro.sync.exml.workspace.api.options.DataSourceAccess getDataSourceAccess()
      Get information about the configured data source connections.
      ImageUtilities getImageUtilities()
      Get access to image related utilities, support to register custom image handlers or to reset the images cache.
      java.lang.Object getParentFrame()
      Get the parent main frame.
      TemplateManager getTemplateManager()
      Get access to all new file templates.
      void openInExternalApplication​(java.lang.String url, boolean preferAssociatedApplication, java.lang.String mediaType)
      Open in the associated system application.
      void openInExternalApplication​(java.net.URL url, boolean preferAssociatedApplication)
      Open in the associated system application
      void openInExternalApplication​(java.net.URL url, boolean preferAssociatedApplication, java.lang.String mediaType)
      Open in the associated system application
      int showConfirmDialog​(java.lang.String title, java.lang.String message, java.lang.String[] buttonNames, int[] buttonIds)
      Shows a question message dialog.
      int showConfirmDialog​(java.lang.String title, java.lang.String message, java.lang.String[] buttonNames, int[] buttonIds, int initialSelectedIndex)
      Shows a question message dialog.
      void showErrorMessage​(java.lang.String message)
      Presents an error message dialog.
      void showErrorMessage​(java.lang.String message, java.lang.Throwable exception)
      Presents an error message dialog.
      void showInformationMessage​(java.lang.String message)
      Presents an information message dialog.
      void showStatusMessage​(java.lang.String statusMessage)
      Show a status message.
      void showStatusMessage​(java.lang.String statusMessage, OperationStatus status)
      Show a status message and set a corresponding status color.
      int showWarningDialog​(java.lang.String title, java.lang.String message, java.lang.String[] buttonNames, int[] buttonIds)
      Shows a warning message dialog.
      int showWarningDialog​(java.lang.String title, java.lang.String message, java.lang.String[] buttonNames, int[] buttonIds, int initialSelectedIndex)
      Shows a warning message dialog.
      void showWarningMessage​(java.lang.String message)
      Presents a warning message dialog.
      void startProcess​(java.lang.String name, java.io.File workingDirectory, java.lang.String cmdLine, boolean showConsole)
      Start a process that executes a given command line.
    • Method Detail

      • getParentFrame

        java.lang.Object getParentFrame()
        Get the parent main frame.
        Returns:
        The parent frame ({javax.swing.JFrame or java.awt.Frame (when running as a JApplet)}) of the Oxygen application or the parent shell ({org.eclipse.swt.widgets.Shell}) if this is the Eclipse implementation.
      • chooseFile

        java.io.File chooseFile​(java.lang.String title,
                                java.lang.String[] allowedExtensions,
                                java.lang.String filterDescr,
                                boolean openForSave)
        Displays a file chooser for selecting a File.
        Parameters:
        title - The file chooser title.
        allowedExtensions - Allowed file extensions. Can be null if you want all files filter. Example: new String[] {"xml", "dita"}.
        filterDescr - Description for the file filter.
        openForSave - true when the file chooser is used for saving, false if it is used for opening an existing file.
        Returns:
        The chosen file or null if the user canceled the dialog.
      • chooseFile

        java.io.File chooseFile​(java.io.File currentFileContext,
                                java.lang.String title,
                                java.lang.String[] allowedExtensions,
                                java.lang.String filterDescr,
                                boolean usedForSave)
        Displays a file chooser for selecting a File.
        Parameters:
        currentFileContext - The file which will be selected in the file chooser. If it is a directory, it will be used as a default directory. If it is a file (even non-existing) and the file chooser is shown for a save operation its name will also be selected in the chooser. Can be set null in order to use the default behavior.
        title - The file chooser title.
        allowedExtensions - Allowed file extensions. Can be null if you want all files filter. Example: new String[] {"xml", "dita"}.
        filterDescr - Description for the file filter.
        usedForSave - true when the file chooser is used for saving, false if it is used for opening an existing file.
        Returns:
        The chosen file or null if the user canceled the dialog.
        Since:
        14
      • chooseFile

        java.io.File chooseFile​(java.lang.String title,
                                java.lang.String[] allowedExtensions,
                                java.lang.String filterDescr)
        Displays a file chooser for selecting a File.
        Parameters:
        title - The file chooser title.
        allowedExtensions - Allowed file extensions. Can be null if you want all files filter. Example: new String[] {"xml", "dita"}.
        filterDescr - Description for the file filter.
        Returns:
        The chosen file or null if the user canceled the dialog.
      • chooseFiles

        java.io.File[] chooseFiles​(java.io.File currentFileContext,
                                   java.lang.String title,
                                   java.lang.String[] allowedExtensions,
                                   java.lang.String filterDescr)
        Displays a file chooser for selecting multiple Files.
        Parameters:
        currentFileContext - The file which will be selected in the file chooser. If it is a directory, it will be used as a default directory. If it is a file (even non-existing) and the file chooser is shown for a save operation its name will also be selected in the chooser. Can be set null in order to use the default behavior.
        title - The file chooser title.
        allowedExtensions - Allowed file extensions. Can be null if you want all files filter. Example: new String[] {"xml", "dita"}.
        filterDescr - Description for the file filter.
        Returns:
        The chosen files or null if the user canceled the dialog.
        Since:
        15.2
      • chooseDirectory

        java.io.File chooseDirectory()
        Displays a directory chooser for selecting a directory.
        Returns:
        The chosen directory or null if the user canceled the dialog.
        Since:
        15
      • chooseDirectory

        java.io.File chooseDirectory​(java.io.File startingDir)
        Displays a directory chooser. Available for the stand-alone oXygen and the Eclipse plugin.
        Parameters:
        startingDir - The starting directory. May be null.
        Returns:
        The chosen directory or null if the user canceled the dialog.
        Since:
        21.1
      • chooseURL

        java.net.URL chooseURL​(java.lang.String title,
                               java.lang.String[] allowedExtensions,
                               java.lang.String filterDescr)
        Displays an URL chooser for selecting an URL.
        Parameters:
        title - The chooser dialog title.
        allowedExtensions - Allowed extensions.
        filterDescr - Description for the filter.
        Returns:
        The chosen URL or null if the user canceled the dialog.
      • chooseURL

        java.net.URL chooseURL​(java.lang.String title,
                               java.lang.String[] allowedExtensions,
                               java.lang.String filterDescr,
                               java.lang.String initialURL)
        Displays an URL chooser for selecting an URL.
        Parameters:
        title - The chooser dialog title.
        allowedExtensions - Allowed extensions.
        filterDescr - Description for the filter.
        initialURL - Default value for the URL (given as string). Can be null.
        Returns:
        The chosen URL or null if the user canceled the dialog.
        Since:
        14.2
      • chooseURL

        java.net.URL chooseURL​(java.lang.String title,
                               java.lang.String[] allowedExtensions,
                               java.lang.String filterDescr,
                               java.lang.String initialURL,
                               java.lang.String urlLabel,
                               java.lang.String okLabel)
        Displays an URL chooser for selecting an URL.
        Parameters:
        title - The chooser dialog title.
        allowedExtensions - Allowed extensions.
        filterDescr - Description for the filter.
        initialURL - Default value for the URL (given as string). Can be null.
        urlLabel - The label used for describing the URL field. If null, the value will be: "URL:".
        okLabel - The label of the "OK" button. If null the value will be "OK".
        Returns:
        The chosen URL or null if the user canceled the dialog.
        Since:
        25.0
      • chooseURLPath

        java.lang.String chooseURLPath​(java.lang.String title,
                                       java.lang.String[] allowedExtensions,
                                       java.lang.String filterDescr)
        Displays an URL chooser for selecting an URL. If the user sets a relative path in the chooser, that path will be returned.
        Parameters:
        title - The chooser dialog title.
        allowedExtensions - Allowed extensions.
        filterDescr - Description for the filter.
        Returns:
        The chosen URL as String or null if the user canceled the dialog.
        Since:
        14
      • chooseURLPath

        java.lang.String chooseURLPath​(java.lang.String title,
                                       java.lang.String[] allowedExtensions,
                                       java.lang.String filterDescr,
                                       java.lang.String initialURL)
        Displays an URL chooser for selecting an URL. If the user sets a relative path in the chooser, that path will be returned.
        Parameters:
        title - The chooser dialog title.
        allowedExtensions - Allowed extensions.
        filterDescr - Description for the filter.
        initialURL - The initial URL to set in the field.
        Returns:
        The chosen URL as String or null if the user canceled the dialog.
        Since:
        16.1
      • showWarningDialog

        int showWarningDialog​(java.lang.String title,
                              java.lang.String message,
                              java.lang.String[] buttonNames,
                              int[] buttonIds)
        Shows a warning message dialog.
        Parameters:
        title - The dialog title.
        message - The message to be presented to the user.
        buttonNames - The names of the buttons representing the choices in the dialog.
        buttonIds - The id for each button. Used to identify which button was pressed. All Ids must be greater or equal to 0.
        Returns:
        the id of the pressed button or -1 if the dialog was closed by other means.
        Since:
        26.0

        *********************************
        EXPERIMENTAL - Subject to change
        ********************************

        Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.

      • showWarningDialog

        int showWarningDialog​(java.lang.String title,
                              java.lang.String message,
                              java.lang.String[] buttonNames,
                              int[] buttonIds,
                              int initialSelectedIndex)
        Shows a warning message dialog.
        Parameters:
        title - The dialog title.
        message - The message to be presented to the user.
        buttonNames - The names of the buttons representing the choices in the dialog.
        buttonIds - The id for each button. Used to identify which button was pressed.
        initialSelectedIndex - The index of the initial selected button. 0 based. All Ids must be greater or equal to 0.
        Returns:
        the id of the pressed button or -1 if the dialog was closed by other means.
        Since:
        26.0

        *********************************
        EXPERIMENTAL - Subject to change
        ********************************

        Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.

      • showConfirmDialog

        int showConfirmDialog​(java.lang.String title,
                              java.lang.String message,
                              java.lang.String[] buttonNames,
                              int[] buttonIds)
        Shows a question message dialog.
        Parameters:
        title - The dialog title.
        message - The message to be presented to the user.
        buttonNames - The names of the buttons representing the choices in the dialog.
        buttonIds - The id for each button. Used to identify which button was pressed. All Ids must be greater or equal to 0.
        Returns:
        the id of the pressed button or -1 if the dialog was closed by other means.
      • showConfirmDialog

        int showConfirmDialog​(java.lang.String title,
                              java.lang.String message,
                              java.lang.String[] buttonNames,
                              int[] buttonIds,
                              int initialSelectedIndex)
        Shows a question message dialog.
        Parameters:
        title - The dialog title.
        message - The message to be presented to the user.
        buttonNames - The names of the buttons representing the choices in the dialog.
        buttonIds - The id for each button. Used to identify which button was pressed.
        initialSelectedIndex - The index of the initial selected button. 0 based. All Ids must be greater or equal to 0.
        Returns:
        the id of the pressed button or -1 if the dialog was closed by other means.
        Since:
        13.1
      • showErrorMessage

        void showErrorMessage​(java.lang.String message)
        Presents an error message dialog.
        Parameters:
        message - The error message.
      • showErrorMessage

        void showErrorMessage​(java.lang.String message,
                              java.lang.Throwable exception)
        Presents an error message dialog.
        Parameters:
        message - The error message.
        exception - An exception for which the stack trace will be shown when the "More details" link is clicked.
        Since:
        19.1
      • showWarningMessage

        void showWarningMessage​(java.lang.String message)
        Presents a warning message dialog.
        Parameters:
        message - The warning message.
        Since:
        17.1
      • showInformationMessage

        void showInformationMessage​(java.lang.String message)
        Presents an information message dialog.
        Parameters:
        message - The information message.
      • showStatusMessage

        void showStatusMessage​(java.lang.String statusMessage)
        Show a status message.
        Parameters:
        statusMessage - The status message
      • showStatusMessage

        void showStatusMessage​(java.lang.String statusMessage,
                               OperationStatus status)
        Show a status message and set a corresponding status color.
        Parameters:
        statusMessage - The message.
        status - The status that gives the color.
        Since:
        20
      • openInExternalApplication

        void openInExternalApplication​(java.net.URL url,
                                       boolean preferAssociatedApplication)
        Open in the associated system application
        Parameters:
        url - The URL to open.
        preferAssociatedApplication - If true will prefer the system associated application and if this fails, open in the browser if false will open in the browser.
        Since:
        12
      • openInExternalApplication

        void openInExternalApplication​(java.net.URL url,
                                       boolean preferAssociatedApplication,
                                       java.lang.String mediaType)
        Open in the associated system application
        Parameters:
        url - The URL to open.
        preferAssociatedApplication - If true will prefer the system associated application and if this fails, open in the browser if false will open in the browser.
        mediaType - The media type of the URL to open.
        Since:
        18.1
      • openInExternalApplication

        void openInExternalApplication​(java.lang.String url,
                                       boolean preferAssociatedApplication,
                                       java.lang.String mediaType)
        Open in the associated system application.
        Parameters:
        url - The URL to open.
        preferAssociatedApplication - If true, it will prefer the system associated application and if this fails, it will open in the browser. If false the resource will be opened in the browser.
        mediaType - The media type of the URL to open.
        Since:
        19.1
      • createJavaProcess

        ProcessController createJavaProcess​(java.lang.String additionalJavaArguments,
                                            java.lang.String[] classpath,
                                            java.lang.String mainClass,
                                            java.lang.String additionalArguments,
                                            java.util.Map<java.lang.String,​java.lang.String> environmentalVariables,
                                            java.io.File startDirectory,
                                            ProcessListener processListener)
        Prepare a Java process for execution. It also sets on the Java process the Oxygen HTTP proxy configuration.
        Parameters:
        additionalJavaArguments - Additional Java arguments like "-Xmx256m"
        classpath - The classpath.
        mainClass - The main class
        additionalArguments - The additional process arguments
        environmentalVariables - Additional environmental variables. Can be null
        startDirectory - The directory where the process should start. Can be null
        processListener - The process listener. Can be null
        Returns:
        Access to the process.


        Sample usage:
        ProcessListener processListener = new ProcessListener() {
        public void newErrorLine(String line) {
        System.err.println("Error from process " + line);
        }
        public void processCouldNotStart(String message) {
        System.err.println("Could not start process " + message);
        }
        public void processEnded(int exitCode) {
        System.err.println("Process ended " + exitCode);
        }
        public void newOutputLine(String line) {
        System.out.println("Output from process: " + line);
        }
        };
        final ProcessController processController = standalonePluginWorkspace.createJavaProcess("-Xmx256m",
        new String[] {"lib/oxygen.jar", "classes"},
        //The main Oxygen class
        "ro.sync.exml.Oxygen",
        //The URL which Oxygen will attempt to load on startup
        "file:/D:/projects/eXml/samples/dita/flowers/topics/copyright.xml",
        //Environmental variables to set to the process, none in mu case
        null, new File("."), processListener);
        //You can start a new thread here and send messages to the process using the ProcessControler
        //Start the process, will block until process has finished
        processController.start();
        Since:
        12.1
      • startProcess

        void startProcess​(java.lang.String name,
                          java.io.File workingDirectory,
                          java.lang.String cmdLine,
                          boolean showConsole)
        Start a process that executes a given command line. If the process is already running, it will not be started again. Does not wait for the process to finish.
        Parameters:
        name - The name of the process.
        workingDirectory - The directory where the process is started.
        cmdLine - The command line to be executed. Can contain editor variables.
        showConsole - True to show the console.
        Since:
        18.1
      • createProcess

        ProcessController createProcess​(ProcessListener processListener,
                                        java.lang.String name,
                                        java.io.File workingDirectory,
                                        java.lang.String cmdLine,
                                        boolean showConsole)
        Create a process that executes a given command line.
        Parameters:
        processListener - The process handler
        name - The name of the process.
        workingDirectory - The directory where the process is started.
        cmdLine - The command line to be executed. Can contain editor variables.
        showConsole - True to show the console.
        Returns:
        The process controller of the started process if process could be started, otherwise null if for example the process is already running.
        Since:
        23.1
      • clearImageCache

        @Deprecated
        void clearImageCache()
        Deprecated.
        Clear the cache of images used to display images fast in the Author page. You can use the ImageUtilities API to clear the image cache.
        Since:
        13
      • getDataSourceAccess

        ro.sync.exml.workspace.api.options.DataSourceAccess getDataSourceAccess()
        Get information about the configured data source connections.
        Returns:
        The DataSourceAccess capable of providing information about the data source connections.
        Since:
        14.1
      • getImageUtilities

        ImageUtilities getImageUtilities()
        Get access to image related utilities, support to register custom image handlers or to reset the images cache.
        Returns:
        access to image related utilities.
        Since:
        18
      • getTemplateManager

        TemplateManager getTemplateManager()
        Get access to all new file templates.
        Returns:
        access to all new file templates.
        Since:
        18