/** Overrides superclass method. Initializes editor component. */ protected void initializeCloneableEditor (CloneableEditor editor) { DataObject obj = getDataObject(); if(obj.isValid()) { org.openide.nodes.Node ourNode = obj.getNodeDelegate(); editor.setActivatedNodes(new org.openide.nodes.Node[] {ourNode}); editor.setIcon(ourNode.getIcon (java.beans.BeanInfo.ICON_COLOR_16x16)); NodeListener nl = new DataNodeListener(editor); ourNode.addNodeListener(org.openide.nodes.NodeOp.weakNodeListener (nl, ourNode)); nodeL = nl; } }
/** Annotates the editor with icon from the data object and also sets * appropriate selected node. But only in the case the data object is valid. * This implementation also listen to display name and icon chamges of the * node and keeps editor top component up-to-date. If you override this * method and not call super, please note that you will have to keep things * synchronized yourself. * * @param editor the editor that has been created and should be annotated */ protected void initializeCloneableEditor (CloneableEditor editor) { // Prevention to bug similar to #17134. Don't call getNodeDelegate // on invalid data object. Top component should be discarded later. if(obj.isValid()) { Node ourNode = obj.getNodeDelegate(); editor.setActivatedNodes (new Node[] { ourNode }); editor.setIcon(ourNode.getIcon (java.beans.BeanInfo.ICON_COLOR_16x16)); NodeListener nl = new DataNodeListener(editor); ourNode.addNodeListener(org.openide.nodes.NodeOp.weakNodeListener (nl, ourNode)); nodeL = nl; } }