Edit online

Save a New Document with a Predefined File Name Pattern


Is it possible to get Oxygen XML Developer to automatically generate a file name comprising a UUID plus file extension using the SDK?


This could be done implementing a plugin for Oxygen XML Developer using the Plugins SDK.

There is a type of plugin called Workspace Access that can be used to add a listener to be notified before an opened editor is saved. The implemented plugin would intercept the save events when a newly created document is untitled and display an alternative chooser dialog box, then save the topic with the proper name.

The Java code would look like this:
  private static class CustomEdListener extends WSEditorListener{
    private final WSEditor editor;
    private final StandalonePluginWorkspace
    private boolean saving = false;
    public CustomEdListener
(StandalonePluginWorkspace pluginWorkspaceAccess, WSEditor editor) {
            this.pluginWorkspaceAccess = pluginWorkspaceAccess;
            this.editor = editor;
    public boolean editorAboutToBeSavedVeto(int operationType) {
      if(! saving &&
        editor.getEditorLocation().toString().contains("Untitled")) {
        File chosenDir = pluginWorkspaceAccess.chooseDirectory();
        if(chosenDir != null) {
          final File chosenFile = 
new File(chosenDir, UUID.randomUUID().toString() + ".dita");         
        SwingUtilities.invokeLater(new Runnable() {
              public void run() {
              try {               
                saving = true;
                editor.saveAs(new URL(chosenFile.toURI().toASCIIString()));
              } catch (MalformedURLException e) {
              } finally {
                saving = false;           
        //Reject the original save request.
        return false;
      return true;
    public void applicationStarted
(final StandalonePluginWorkspace pluginWorkspaceAccess) {   
    pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
      public void editorOpened(URL editorLocation) {
        final WSEditor editor = pluginWorkspaceAccess.getEditorAccess
(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
      if(editor != 
null && editor.getEditorLocation().toString().contains("Untitled")) {
        //Untitled editor
 editor.addEditorListener(new CustomEdListener(pluginWorkspaceAccess, editor));