/** * Returns the parent UI element based on the provided path. * * @param path Format is <tab name>\<tree node path> * @return The parent UI element. * @throws Exception Unspecified exception. */ private ElementUI parentFromPath(String path) throws Exception { if (TOOLBAR_PATH.equalsIgnoreCase(path)) { return getDesktop().getToolbar(); } String[] pieces = path.split(delim, 2); ElementTabPane tabPane = pieces.length == 0 ? null : findTabPane(pieces[0]); ElementUI parent = pieces.length < 2 ? null : getPathResolver().resolvePath(tabPane, pieces[1]); return parent == null ? tabPane : parent; }
/** * Returns the path resolver implementation. This implementation determines where in the layout * the plugin should be placed based on a path. A default implementation is provided. * * @return The path resolver. */ public PathResolver getPathResolver() { if (pathResolver == null) { pathResolver = new PathResolver(ElementTreeView.class, ElementTreePane.class); } return pathResolver; }
/** * Resolves the path, returning the UI element to be used as the parent of the plugin. * * @param tabPane Tab pane. * @param path Path to resolve. * @return The plugin parent */ protected ElementUI resolvePath(ElementTabPane tabPane, String path) { return getElement(path, getRoot(tabPane), childClass); }