NetBeans Platform: Updating editor window content

118 views Asked by At

I'm writing a plugin for the NetBeans Platform and would like to know if it's possible to force an editor window to update it's content from harddrive. I'm in the situation that I know some file on the HDD has changed but NetBeans doesn't recognize that.

dataObject.getLookup().lookup(EditorCookie.class);
StyledDocument document = cookie.getDocument();
JEditorPane editor = cookie.getOpenedPanes()[0];

// Looking for something like
document.forceUpdate();
//or
editor.forceUpdate();
//or
dataObject.forceUpdate();
1

There are 1 answers

3
Radim On BEST ANSWER

FileObject.refresh() is what you're looking for. The editor should listen to its changes (through layers that you've mentioned).