I have a custom file type, created with the wizard.

I do not want the text editor associated with it. I just want a GUI. I've
been playing with this off and on for some time now.

My DataObject has its own DataNode with createNodeDelegate and TopComponent.

The DataNode inserts OpenCookie into the lookup.

In the end, this seems to work. The file type appears with the proper icon
in the Favorite window, I can double click and the gui opens, it marshals
my data, and I can open different ones at the same time. If I open the same
node again, it returns the original window.

However, from the file type wizard, my DataObject has several action
reference annotations

With this it has references to: Open, Cut, Copy, Delete, Rename,
SaveAsTemplate, among others, all referring to the openide actions, such as
org.openide.actions.OpenAction.

However, when realized, none of these manifest in the IDE. When I open the
file, the EDIT menu does not appear in the main menu, the right click menu
is nothing but Open, the toolbar is mostly blank.

I have a simple button that put a Savable in to the lookup from teh
TopCompont, but that seems to do nothing. In fact, there's not "save" or
action at all.

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
                                          Savable s = new Savable() {
            @Override
            public void save() throws IOException {
                System.out.println("Saving " +
getLookup().lookup(PersonaDataObject.class));
            }
        };
        ic.add(s);  //InstanceContent of TopComponent done in constructor
with  associateLookup(new AbstractLookup(ic));

    }

How do I tie this together to get these default IDE actions into my File
Type.

I have tried this with calling the registerEditor method, and not calling
it. The annotations are there to build up the layer.xml file, as I
understand it. I was thinking maybe I was stomping on the lookup with
DataNode when I added the OpenCookie.

    private PersonaDataNode(final PersonaDataObject obj, InstanceContent
ic) {
        super(obj, Children.LEAF, new AbstractLookup(ic));
        ic.add(new OpenCookie() {
            @Override
            public void open() {
                TopComponent tc = findTopComponent(obj);
                if (tc == null) {
                    tc = new PersonaTopComponent(obj);
                    tc.open();
                }
                tc.requestActive();
            }
        });
    }

But this code seems idiomatic to me.

I have most of the Netbeans books, but they don't explicitly address this.

There is some magic somewhere that I'm missing, I feel.

Thanks,

Will Hartung

Reply via email to