Hi Julia,
Just to see if I understand the use case, you want to do a specific thing when the current opened XML file is closed, right?
Could you elaborate on what you want to do? I could consider adding some more API for this.
Anyway, in any place of the code you can use static access to the entire workspace like:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().addEditorChangeListener(....., PluginWorkspace.MAIN_EDITING_AREA);
but ideally if you add a listener from an opened editor, when the XML editor is closed you should remove the listener, otherwise the main plugin workspace will keep a reference to the listener which will keep a reference to the opened editor, so when you will close the editor the Java garbage collector will no longer de-allocate the memory used by it.
Something like:
Code: Select all
WSEditorChangeListener editorListener = null;
private addTheListener() {
editorListener = new WSEditorChangeListener(){
/**
* @see ro.sync.exml.workspace.api.listeners.WSEditorChangeListener#editorClosed(java.net.URL)
*/
@Override
public void editorClosed(URL editorLocation) {
//Do something here...
//And remove the listener
PluginWorkspaceProvider.getPluginWorkspace().removeEditorChangeListener(editorListener, PluginWorkspace.MAIN_EDITING_AREA);
}
};
PluginWorkspaceProvider.getPluginWorkspace().addEditorChangeListener(editorListener, PluginWorkspace.MAIN_EDITING_AREA);
}
Or you can create a plugin for Oxygen (a Workspace Access plugin) which adds the editor listener and does various things. And the end user would need to install both the plugin and the custom framework.
Regards,
Radu