Java Code Examples for org.openide.nodes.Node.Handle

The following are Jave code examples for showing how to use Handle of the org.openide.nodes.Node class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: NbSheet.java   Source Code and License Vote up 6 votes
/** Serialize this property sheet */
@Override
public void writeExternal (ObjectOutput out)
throws IOException {
    super.writeExternal(out);

    if (global) {
        // write dummy array
        out.writeObject (null);
    } else {
        Node.Handle[] arr = NodeOp.toHandles (nodes);
        out.writeObject(arr);
    }

    out.writeBoolean(global);
}
 
Example 2
Project: incubator-netbeans   File: ConnectionSupport.java   Source Code and License Vote up 5 votes
/** @param t the type of the event
* @param h the listener's handle
* @exception IOException if handle is null
*/
public Pair (ConnectionCookie.Type t, Node.Handle h) throws IOException {

    if (h == null) throw new IOException ();

    type = t;
    value = h;
}
 
Example 3
Project: incubator-netbeans   File: TopComponent.java   Source Code and License Vote up 5 votes
/** Serialize this top component.
* Subclasses wishing to store state must call the super method, then write to the stream.
* @param out the stream to serialize to
*/
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeObject(new Short(serialVersion));
    out.writeInt(closeOperation);
    out.writeObject(getName());
    out.writeObject(getToolTipText());

    if (getDisplayName() != null) {
        out.writeObject(getDisplayName());
    }

    Node n = (nodeName == null) ? null : nodeName.getNode();
    Node.Handle h = (n == null) ? null : n.getHandle();
    out.writeObject(h);
}
 
Example 4
Project: incubator-netbeans   File: ProjectsRootNode.java   Source Code and License Vote up 4 votes
@Override
public Node.Handle getHandle() {        
    return new Handle(type);
}
 
Example 5
Project: incubator-netbeans   File: ExplorerActionsTest.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle () {
    return new H ();
}
 
Example 6
Project: incubator-netbeans   File: ConnectionSupportTest.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle () {
    return new H ();
}
 
Example 7
Project: incubator-netbeans   File: NbSheet.java   Source Code and License Vote up 4 votes
/** Deserialize this property sheet. */
@Override
public void readExternal (ObjectInput in)
throws IOException, ClassNotFoundException {
    try {
        super.readExternal(in);
    } catch (SafeException se) {
        // ignore--we really do not care about the explorer manager that much
        //System.err.println("ignoring a SafeException: " + se.getLocalizedMessage ());
    }
    Object obj = in.readObject ();

    if (obj instanceof NbMarshalledObject || obj instanceof ExplorerManager) {
        // old version read the Boolean
        global = ((Boolean)in.readObject()).booleanValue();
    } else {
        Node[] ns;

        if (obj == null) {
            // handles can also be null for global 
            // property sheet
            ns = TopComponent.getRegistry().getActivatedNodes();
        } else {
            // new version, first read the nodes and then the global boolean
            Node.Handle[] arr = (Node.Handle[])obj;

            try {
                ns = NodeOp.fromHandles (arr);
            } catch (IOException ex) {
                Exceptions.attachLocalizedMessage(ex,
                                                  NbBundle.getBundle(NbSheet.class).getString("EXC_CannotLoadNodes"));
                Logger.getLogger(NbSheet.class.getName()).log(Level.WARNING, null, ex);
                ns = new Node[0];
            }
        }

        global = in.readBoolean ();

        setNodes(ns, true, "readExternal"); // NOI18N
    }

    /*
          if (obj instanceof Boolean) {
            global = (Boolean)in.readObject ()

          global = ((Boolean)in.readObject()).booleanValue();
    /*
          // start global listening if needed, but wait until
          // deserialization is done (ExplorerManager is uses
          // post-deserialization validating too, so we are forced
          // to use it)
          ((ObjectInputStream)in).registerValidation(
            new ObjectInputValidation () {
              public void validateObject () {
                updateGlobalListening(false);
              }
            }, 0
          );
    */
    // JST: I guess we are not and moreover the type casting is really ugly
    //      updateGlobalListening (global);
}
 
Example 8
Project: incubator-netbeans   File: TopComponent.java   Source Code and License Vote up 4 votes
/** Deserialize this top component.
* Subclasses wishing to store state must call the super method, then read from the stream.
* @param in the stream to deserialize from
*/
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    Object firstObject = in.readObject();

    if (firstObject instanceof Integer) {
        // backward compatibility read
        serialVersion = 0;

        closeOperation = ((Integer) firstObject).intValue();

        // BCR: this is backward compatibility read and is likely not needed
        // BCR: anymore. So let's just ignore the read of the data object
        // BCR:     DataObject obj = (DataObject)in.readObject();
        in.readObject();

        super.setName((String) in.readObject());
        setToolTipText((String) in.readObject());

        // initialize the connection to a data object

        /* BCR: Remove this as we ignore the DataObject
                    if (obj != null) {
                        nodeName = new NodeName (this);
                        nodeName.attach (obj.getNodeDelegate ());
                    }
        */
    } else {
        // new serialization
        serialVersion = ((Short) firstObject).shortValue();

        closeOperation = in.readInt();
        super.setName((String) in.readObject());
        setToolTipText((String) in.readObject());

        Object obj = in.readObject();

        if (obj instanceof String) {
            setDisplayName((String) obj);
            obj = in.readObject();
        }

        Node.Handle h = (Node.Handle) obj;

        if (h != null) {
            Node n = h.getNode();
            NodeName.connect(this, n);
        }
    }

    if ((closeOperation != CLOSE_EACH) && (closeOperation != CLOSE_LAST)) {
        throw new IOException("invalid closeOperation: " + closeOperation); // NOI18N
    }
}
 
Example 9
Project: incubator-netbeans   File: OptionsAction.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle () {
    return new H ();
}
 
Example 10
Project: incubator-netbeans   File: EnvironmentNode.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle () {
    return new EnvironmentHandle (filter);
}
 
Example 11
Project: incubator-netbeans   File: EditActionTest.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle() { 
    return null; 
}
 
Example 12
Project: incubator-netbeans   File: OpenActionTest.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle() { 
    return null; 
}
 
Example 13
Project: incubator-netbeans   File: PrintActionTest.java   Source Code and License Vote up 4 votes
public Node.Handle getHandle() { 
    return null; 
}