private void syncBrowser() { if (myTree.getSelectionModel().getSelectionCount() != 1) { myBrowser.showEmpty(); } else { TreePath pathSelected = myTree.getSelectionModel().getLeadSelectionPath(); if (pathSelected != null) { final InspectionTreeNode node = (InspectionTreeNode) pathSelected.getLastPathComponent(); if (node instanceof RefElementNode) { final RefElementNode refElementNode = (RefElementNode) node; final CommonProblemDescriptor problem = refElementNode.getProblem(); final RefEntity refSelected = refElementNode.getElement(); if (problem != null) { showInBrowser(refSelected, problem); } else { showInBrowser(refSelected); } } else if (node instanceof ProblemDescriptionNode) { final ProblemDescriptionNode problemNode = (ProblemDescriptionNode) node; showInBrowser(problemNode.getElement(), problemNode.getDescriptor()); } else if (node instanceof InspectionNode) { showInBrowser(((InspectionNode) node).getToolWrapper()); } else { myBrowser.showEmpty(); } } } }
public void invokeLocalFix(int idx) { if (myView.getTree().getSelectionCount() != 1) return; final InspectionTreeNode node = (InspectionTreeNode) myView.getTree().getSelectionPath().getLastPathComponent(); if (node instanceof ProblemDescriptionNode) { final ProblemDescriptionNode problemNode = (ProblemDescriptionNode) node; final CommonProblemDescriptor descriptor = problemNode.getDescriptor(); final RefEntity element = problemNode.getElement(); invokeFix(element, descriptor, idx); } else if (node instanceof RefElementNode) { RefElementNode elementNode = (RefElementNode) node; RefEntity element = elementNode.getElement(); CommonProblemDescriptor descriptor = elementNode.getProblem(); if (descriptor != null) { invokeFix(element, descriptor, idx); } } }