Package ro.sync.exml.workspace.api
Interface WorkspaceUtilities
- All Superinterfaces:
ApplicationInformationAccess
,ColorThemeUtilities
- All Known Subinterfaces:
AuthorWorkspaceAccess
,EclipsePluginWorkspace
,PluginWorkspace
,StandalonePluginWorkspace
,WebappPluginWorkspace
,Workspace
@API(type=NOT_EXTENDABLE,
src=PUBLIC)
public interface WorkspaceUtilities
extends ColorThemeUtilities, ApplicationInformationAccess
Provides access to global utility methods.
- Since:
- 15
-
Method Summary
Modifier and TypeMethodDescriptionDisplays a directory chooser for selecting a directory.chooseDirectory
(File startingDir) Displays a directory chooser.chooseFile
(File currentFileContext, String title, String[] allowedExtensions, String filterDescr, boolean usedForSave) Displays a file chooser for selecting aFile
.chooseFile
(String title, String[] allowedExtensions, String filterDescr) Displays a file chooser for selecting aFile
.chooseFile
(String title, String[] allowedExtensions, String filterDescr, boolean openForSave) Displays a file chooser for selecting aFile
.File[]
chooseFiles
(File currentFileContext, String title, String[] allowedExtensions, String filterDescr) Displays a file chooser for selecting multipleFile
s.Displays an URL chooser for selecting anURL
.Displays an URL chooser for selecting anURL
.chooseURL
(String title, String[] allowedExtensions, String filterDescr, String initialURL, String urlLabel, String okLabel) Displays an URL chooser for selecting anURL
.chooseURLPath
(String title, String[] allowedExtensions, String filterDescr) Displays an URL chooser for selecting anURL
.chooseURLPath
(String title, String[] allowedExtensions, String filterDescr, String initialURL) Displays an URL chooser for selecting anURL
.void
Deprecated.createJavaProcess
(String additionalJavaArguments, String[] classpath, String mainClass, String additionalArguments, Map<String, String> environmentalVariables, File startDirectory, ProcessListener processListener) Prepare a Java process for execution.createProcess
(ProcessListener processListener, String name, File workingDirectory, String cmdLine, boolean showConsole) Create a process that executes a given command line.ro.sync.exml.workspace.api.options.DataSourceAccess
Get information about the configured data source connections.Get access to image related utilities, support to register custom image handlers or to reset the images cache.Get the parent main frame.Get access to all new file templates.void
openInExternalApplication
(String url, boolean preferAssociatedApplication, String mediaType) Open in the associated system application.void
openInExternalApplication
(URL url, boolean preferAssociatedApplication) Open in the associated system applicationvoid
openInExternalApplication
(URL url, boolean preferAssociatedApplication, String mediaType) Open in the associated system applicationint
showConfirmDialog
(String title, String message, String[] buttonNames, int[] buttonIds) Shows a question message dialog.int
showConfirmDialog
(String title, String message, String[] buttonNames, int[] buttonIds, int initialSelectedIndex) Shows a question message dialog.void
showErrorMessage
(String message) Presents an error message dialog.void
showErrorMessage
(String message, Throwable exception) Presents an error message dialog.void
showInformationMessage
(String message) Presents an information message dialog.void
showStatusMessage
(String statusMessage) Show a status message.void
showStatusMessage
(String statusMessage, OperationStatus status) Show a status message and set a corresponding status color.int
showWarningDialog
(String title, String message, String[] buttonNames, int[] buttonIds) Shows a warning message dialog.int
showWarningDialog
(String title, String message, String[] buttonNames, int[] buttonIds, int initialSelectedIndex) Shows a warning message dialog.void
showWarningMessage
(String message) Presents a warning message dialog.void
startProcess
(String name, File workingDirectory, String cmdLine, boolean showConsole) Start a process that executes a given command line.Methods inherited from interface ro.sync.exml.workspace.api.application.ApplicationInformationAccess
getApplicationName, getApplicationType, getLicenseInformationProvider, getPlatform, getPreferencesDirectory, getUserInterfaceLanguage, getVersion, getVersionBuildID
Methods inherited from interface ro.sync.exml.workspace.api.util.ColorThemeUtilities
getColorTheme, getImageInverter
-
Method Details
-
getParentFrame
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
Displays a file chooser for selecting aFile
.- Parameters:
title
- The file chooser title.allowedExtensions
- Allowed file extensions. Can benull
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
File chooseFile(File currentFileContext, String title, String[] allowedExtensions, String filterDescr, boolean usedForSave) Displays a file chooser for selecting aFile
.- 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 setnull
in order to use the default behavior.title
- The file chooser title.allowedExtensions
- Allowed file extensions. Can benull
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
Displays a file chooser for selecting aFile
.- Parameters:
title
- The file chooser title.allowedExtensions
- Allowed file extensions. Can benull
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
File[] chooseFiles(File currentFileContext, String title, String[] allowedExtensions, String filterDescr) Displays a file chooser for selecting multipleFile
s.- 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 setnull
in order to use the default behavior.title
- The file chooser title.allowedExtensions
- Allowed file extensions. Can benull
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
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
Displays a directory chooser. Available for the stand-alone oXygen and the Eclipse plugin.- Parameters:
startingDir
- The starting directory. May benull
.- Returns:
- The chosen directory or
null
if the user canceled the dialog. - Since:
- 21.1
-
chooseURL
Displays an URL chooser for selecting anURL
.- 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
Displays an URL chooser for selecting anURL
.- Parameters:
title
- The chooser dialog title.allowedExtensions
- Allowed extensions.filterDescr
- Description for the filter.initialURL
- Default value for the URL (given as string). Can benull
.- Returns:
- The chosen URL or
null
if the user canceled the dialog. - Since:
- 14.2
-
chooseURL
URL chooseURL(String title, String[] allowedExtensions, String filterDescr, String initialURL, String urlLabel, String okLabel) Displays an URL chooser for selecting anURL
.- Parameters:
title
- The chooser dialog title.allowedExtensions
- Allowed extensions.filterDescr
- Description for the filter.initialURL
- Default value for the URL (given as string). Can benull
.urlLabel
- The label used for describing the URL field. Ifnull
, the value will be: "URL:".okLabel
- The label of the "OK" button. Ifnull
the value will be "OK".- Returns:
- The chosen URL or
null
if the user canceled the dialog. - Since:
- 25.0
-
chooseURLPath
Displays an URL chooser for selecting anURL
. 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
String chooseURLPath(String title, String[] allowedExtensions, String filterDescr, String initialURL) Displays an URL chooser for selecting anURL
. 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
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
-
showWarningDialog
int showWarningDialog(String title, String message, 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
-
showConfirmDialog
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(String title, String message, 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
Presents an error message dialog.- Parameters:
message
- The error message.
-
showErrorMessage
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. In more recent application versions due to security related decisions the exception stack trace is no longer shown.- Since:
- 19.1
-
showWarningMessage
Presents a warning message dialog.- Parameters:
message
- The warning message.- Since:
- 17.1
-
showInformationMessage
Presents an information message dialog.- Parameters:
message
- The information message.
-
showStatusMessage
Show a status message.- Parameters:
statusMessage
- The status message
-
showStatusMessage
Show a status message and set a corresponding status color.- Parameters:
statusMessage
- The message.status
- The status that gives the color.- Since:
- 20
-
openInExternalApplication
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
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
Open in the associated system application.- Parameters:
url
- The URL to open.preferAssociatedApplication
- Iftrue
, it will prefer the system associated application and if this fails, it will open in the browser. Iffalse
the resource will be opened in the browser.mediaType
- The media type of the URL to open.- Since:
- 19.1
-
createJavaProcess
ProcessController createJavaProcess(String additionalJavaArguments, String[] classpath, String mainClass, String additionalArguments, Map<String, String> environmentalVariables, 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 classadditionalArguments
- The additional process argumentsenvironmentalVariables
- Additional environmental variables. Can benull
startDirectory
- The directory where the process should start. Can benull
processListener
- The process listener. Can benull
- 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
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, String name, File workingDirectory, String cmdLine, boolean showConsole) Create a process that executes a given command line.- Parameters:
processListener
- The process handlername
- 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.Replaced bygetImageUtilities()
Clear the cache of images used to display images fast in the Author page. You can use theImageUtilities
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
-
getImageUtilities()