sreda, 31. avgust 2016


In NetBeans Platform you can implement your own SaveAs action like this:
- put this into
public class MyTopComponent .... {
    private final InstanceContent myContent = new InstanceContent();
    private final Lookup myLookup = new AbstractLookup(myContent);
    private FileObject fo;

    MyTopComponent() {
        editorContent.add(new SQLEditorSaveAs());

    public void setFo(FileObject 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(;

    private class MySaveAs implements SaveAsCapable {
        public void saveAs(FileObject folder, String name) throws IOException {
            // save to file, database, ...
Objavite komentar