- put this into MyTopComponent.java:
public class MyTopComponent .... { private final InstanceContent myContent = new InstanceContent(); private final Lookup myLookup = new AbstractLookup(myContent); private FileObject fo; MyTopComponent() { ... editorContent.add(new SQLEditorSaveAs()); associateLookup(editorLookup); } public void setFo(FileObject fo) { this.fo = fo; // load the file and display it in TextArea // this is optional, but putting file's DataObject into this TopComponent's lookup // will make FileChooser for the SaveAS action start in the folder where fo is located DataObject myDataObject = DataObject.find(this.fo); myContent.add(myDataObject); } private class MySaveAs implements SaveAsCapable { @Override public void saveAs(FileObject folder, String name) throws IOException { // save to file, database, ... } } }
Ni komentarjev:
Objavite komentar