/** A method that replaces instance of original node * with a new one */ private <T> T replaceNodes(T orig, Class<T> clazz) { if (isNodeQuery(clazz) && (orig == node.getOriginal()) && clazz.isInstance(node)) { return clazz.cast(node); } else { return orig; } }
public void resultChanged(LookupEvent ev) { if (Node.this instanceof FilterNode) { FilterNode f = (FilterNode) Node.this; // See #40734 and NodeLookupTest and CookieActionIsTooSlowTest. if (f.getOriginal() == NodeLookup.NO_COOKIE_CHANGE.get()) { // this is not real cookie change, do not fire it // issue 40734 return; } } fireCookieChange(); } }
/** Getter for node listener. */ synchronized NodeListener getNodeListener() { if (nodeL == null) { nodeL = createNodeListener(); getOriginal().addNodeListener(nodeL); } return nodeL; }
/** Changes the node we delegate to if necessary. * @param n the node to delegate to */ public Lookup checkNode() { Lookup l = node.getOriginal().getLookup(); if (delegate == l) { return l; } Iterator<ProxyResult> toCheck = null; synchronized (this) { if (l != delegate) { this.delegate = l; if (results != null) { toCheck = new ArrayList<ProxyResult>(results).iterator(); } } } if (toCheck != null) { // update while (toCheck.hasNext()) { ProxyResult p = toCheck.next(); if (p.updateLookup(l)) { p.resultChanged(null); } } } return delegate; }
/** Find a path (by name) from one node to the root or a parent. * @param node the node to start in * @param parent parent node to stop in (can be <code>null</code> for the root) * @return list of child names--i.e. a path from the parent to the child node * @exception IllegalArgumentException if <code>node</code>'s getName() * method returns <code>null</code> */ public static String[] createPath(Node node, Node parent) { LinkedList<String> ar = new LinkedList<String>(); while ((node != null) && (node != parent)) { if (node.getName() == null) { boolean isFilter = false; if (node instanceof FilterNode) { isFilter = true; } throw new IllegalArgumentException( "Node:" + node.getClass() // NOI18N +"[" + node.getDisplayName() + "]" // NOI18N +(isFilter ? (" of original:" + ((FilterNode) node).getOriginal().getClass()) : "") // NOI18N +" gets null name!" ); // NOI18N } ar.addFirst(node.getName()); node = node.getParentNode(); } String[] res = new String[ar.size()]; ar.toArray(res); return res; }
@Override public T getOriginal () { return (T) super.getOriginal(); } }
@Override public Node getOriginal() { return super.getOriginal(); } }
public Node getOriginalNode () { return super.getOriginal (); }
public void resultChanged(org.openide.util.LookupEvent ev) { if (Node.this instanceof FilterNode) { FilterNode f = (FilterNode)Node.this; // See #40734 and NodeLookupTest and CookieActionIsTooSlowTest. if (f.getOriginal () == NodeLookup.NO_COOKIE_CHANGE.get ()) { // this is not real cookie change, do not fire it // issue 40734 return; } } fireCookieChange(); } }
/** A method that replaces instance of original node * with a new one */ private Object replaceNodes (Object orig, Class clazz ) { if (isNodeQuery( clazz ) && orig == node.getOriginal() && clazz.isInstance( node )) { return node; } else { return orig; } }
/** A method that replaces instance of original node * with a new one */ private Object replaceNodes (Object orig, Class clazz ) { if (isNodeQuery( clazz ) && orig == node.getOriginal() && clazz.isInstance( node )) { return node; } else { return orig; } }
public void resultChanged(org.openide.util.LookupEvent ev) { if (Node.this instanceof FilterNode) { FilterNode f = (FilterNode)Node.this; // See #40734 and NodeLookupTest and CookieActionIsTooSlowTest. if (f.getOriginal () == NodeLookup.NO_COOKIE_CHANGE.get ()) { // this is not real cookie change, do not fire it // issue 40734 return; } } fireCookieChange(); } }
/** Getter for node listener. */ synchronized NodeListener getNodeListener () { if (nodeL == null) { nodeL = createNodeListener (); getOriginal().addNodeListener(nodeL); } return nodeL; }
/** Getter for node listener. */ synchronized NodeListener getNodeListener () { if (nodeL == null) { nodeL = createNodeListener (); getOriginal().addNodeListener(nodeL); } return nodeL; }
+ (isFilter ? (" of original:" + ((FilterNode)node).getOriginal().getClass()) : "") // NOI18N + " gets null name!"); // NOI18N
+ (isFilter ? (" of original:" + ((FilterNode)node).getOriginal().getClass()) : "") // NOI18N + " gets null name!"); // NOI18N
/** Changes the node we delegate to if necessary. * @param n the node to delegate to */ public Lookup checkNode () { Lookup l = node.getOriginal ().getLookup(); if (delegate == l) return l; Iterator toCheck = null; synchronized (this) { if (l != delegate) { this.delegate = l; if (results != null) { toCheck = Arrays.asList (results.toArray ()).iterator(); } } } if (toCheck != null) { // update Iterator it = toCheck; while (it.hasNext()) { ProxyResult p = (ProxyResult)it.next (); if (p.updateLookup (l)) { p.resultChanged (null); } } } return delegate; }
/** Changes the node we delegate to if necessary. * @param n the node to delegate to */ public Lookup checkNode () { Lookup l = node.getOriginal ().getLookup(); if (delegate == l) return l; Iterator toCheck = null; synchronized (this) { if (l != delegate) { this.delegate = l; if (results != null) { toCheck = Arrays.asList (results.toArray ()).iterator(); } } } if (toCheck != null) { // update Iterator it = toCheck; while (it.hasNext()) { ProxyResult p = (ProxyResult)it.next (); if (p.updateLookup (l)) { p.resultChanged (null); } } } return delegate; }