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

The following examples show how to use org.openide.nodes.Node#Handle . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NbSheet.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** 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
Source File: ConnectionSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** @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
Source File: TopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** 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
Source File: ExplorerActionsTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle () {
    return new H ();
}
 
Example 5
Source File: ConnectionSupportTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle () {
    return new H ();
}
 
Example 6
Source File: NbSheet.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** 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 7
Source File: TopComponent.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** 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 8
Source File: OptionsAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle () {
    return new H ();
}
 
Example 9
Source File: EnvironmentNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle () {
    return new EnvironmentHandle (filter);
}
 
Example 10
Source File: EditActionTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle() { 
    return null; 
}
 
Example 11
Source File: OpenActionTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle() { 
    return null; 
}
 
Example 12
Source File: PrintActionTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Node.Handle getHandle() { 
    return null; 
}
 
Example 13
Source File: ProjectsRootNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Node.Handle getHandle() {        
    return new Handle(type);
}