Change of RecentFile behaviour at NetBeans Platform
Join the DZone community and get the full member experience.
Join For FreeIf a netbeans platform application uses the module org.netbeans.modules.utilities it provides an action for opening recently opened files. A file would be added to the list of recently opened files when it is closed within the application. (See https://blogs.oracle.com/geertjan/entry/integrating_with_the_netbeans_platform for more information)
For users of Microsoft products like office it seems to be unusual that a file will be only added to the list of recent files only if the file has been closed within the application but when the whole application has been closed after the file has been opened.
To change that behaviour a developer needs to get the sources from that module and change the class org.netbeans.modules.openfile.RecentFiles.WindowRegistryL. The change to be made is published by this code snippet. The changes are made based on NetBeans Platform Version 8.
/** Receives info about opened and closed TopComponents from window system.
*/
private static class WindowRegistryL implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
String name = evt.getPropertyName();
if (TopComponent.Registry.PROP_TC_OPENED.equals(name)) {
addFile((TopComponent) evt.getNewValue());
}
}
}
Opinions expressed by DZone contributors are their own.
Comments