public ProjectNode getRootProjectNode() { ProjectNode root = this; while (root.getParentProjectNode() != null) { root = root.getParentProjectNode(); } return root; }
protected Object getTaskViewElement(Object element) { // 'convert' ProjectNode to IProject in order to render the Gradle project decorators like in // all other Eclipse views if (element instanceof ProjectNode) { ProjectNode projectNode = (ProjectNode) element; Optional<IProject> workspaceProject = projectNode.getWorkspaceProject(); return workspaceProject.isPresent() ? workspaceProject.get() : projectNode; } else { return element; } }
private Optional<File> getBuildScriptFor(ProjectNode projectNode) { Maybe<OmniGradleScript> buildScript = projectNode.getGradleProject().getBuildScript(); return buildScript.isPresent() ? Optional.fromNullable(buildScript.get().getSourceFile()) : Optional.<File>absent(); }