@Override public Object getParent(Object element) {//must be an instance of <code>IPreferenceNode</code>. IPreferenceNode targetNode = (IPreferenceNode) element; IPreferenceNode root = manager.getRoot(); return findParent(root, targetNode); }
@Override public Object getParent(Object element) {//must be an instance of <code>IPreferenceNode</code>. IPreferenceNode targetNode = (IPreferenceNode) element; IPreferenceNode root = manager.getRoot(); return findParent(root, targetNode); }
public Object getParent(Object element) {//must be an instance of <code>IPreferenceNode</code>. IPreferenceNode targetNode = (IPreferenceNode) element; IPreferenceNode root = manager.getRoot(); return findParent(root, targetNode); }
/** * Find the parent of the provided node. Will search recursivly through the * preference tree. * * @param parent the possible parent node. * @param target the target child node. * @return the parent node of the child node. */ private IPreferenceNode findParent(IPreferenceNode parent, IPreferenceNode target) { if (parent.getId().equals(target.getId())) { return null; } IPreferenceNode found = parent.findSubNode(target.getId()); if (found != null) { return parent; } IPreferenceNode[] children = parent.getSubNodes(); for (int i = 0; i < children.length; i++) { found = findParent(children[i], target); if (found != null) { return found; } } return null; }
/** * Find the parent of the provided node. Will search recursivly through the * preference tree. * * @param parent the possible parent node. * @param target the target child node. * @return the parent node of the child node. */ private IPreferenceNode findParent(IPreferenceNode parent, IPreferenceNode target) { if (parent.getId().equals(target.getId())) { return null; } IPreferenceNode found = parent.findSubNode(target.getId()); if (found != null) { return parent; } IPreferenceNode[] children = parent.getSubNodes(); for (IPreferenceNode element : children) { found = findParent(element, target); if (found != null) { return found; } } return null; }
/** * Find the parent of the provided node. Will search recursivly through the * preference tree. * * @param parent the possible parent node. * @param target the target child node. * @return the parent node of the child node. */ private IPreferenceNode findParent(IPreferenceNode parent, IPreferenceNode target) { if (parent.getId().equals(target.getId())) { return null; } IPreferenceNode found = parent.findSubNode(target.getId()); if (found != null) { return parent; } IPreferenceNode[] children = parent.getSubNodes(); for (int i = 0; i < children.length; i++) { found = findParent(children[i], target); if (found != null) { return found; } } return null; }