コード例 #1
0
 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();
       }
     }
   }
 }
コード例 #2
0
 @Override
 public void dispose() {
   mySplitter.dispose();
   myBrowser.dispose();
   myInspectionProfile = null;
   myDisposed = true;
 }
コード例 #3
0
 private void showInBrowser(final RefEntity refEntity, CommonProblemDescriptor descriptor) {
   Cursor currentCursor = getCursor();
   setCursor(new Cursor(Cursor.WAIT_CURSOR));
   myBrowser.showPageFor(refEntity, descriptor);
   setCursor(currentCursor);
 }
コード例 #4
0
 private void showInBrowser(@NotNull InspectionToolWrapper toolWrapper) {
   Cursor currentCursor = getCursor();
   setCursor(new Cursor(Cursor.WAIT_CURSOR));
   myBrowser.showDescription(toolWrapper);
   setCursor(currentCursor);
 }
コード例 #5
0
 private void showInBrowser(final RefEntity refEntity) {
   Cursor currentCursor = getCursor();
   setCursor(new Cursor(Cursor.WAIT_CURSOR));
   myBrowser.showPageFor(refEntity);
   setCursor(currentCursor);
 }
コード例 #6
0
  public InspectionResultsView(
      @NotNull final Project project,
      final InspectionProfile inspectionProfile,
      @NotNull AnalysisScope scope,
      @NotNull GlobalInspectionContextImpl globalInspectionContext,
      @NotNull InspectionRVContentProvider provider) {
    setLayout(new BorderLayout());

    myProject = project;
    myInspectionProfile = inspectionProfile;
    myScope = scope;
    myGlobalInspectionContext = globalInspectionContext;
    myProvider = provider;

    myTree = new InspectionTree(project, globalInspectionContext);
    initTreeListeners();

    myOccurenceNavigator = initOccurenceNavigator();

    myBrowser = new Browser(this);

    mySplitter =
        new OnePixelSplitter(false, AnalysisUIOptions.getInstance(myProject).SPLITTER_PROPORTION);

    mySplitter.setFirstComponent(
        ScrollPaneFactory.createScrollPane(myTree, SideBorder.LEFT | SideBorder.RIGHT));
    mySplitter.setSecondComponent(myBrowser);

    mySplitter.addPropertyChangeListener(
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (Splitter.PROP_PROPORTION.equals(evt.getPropertyName())) {
              myGlobalInspectionContext.setSplitterProportion(
                  ((Float) evt.getNewValue()).floatValue());
            }
          }
        });
    add(mySplitter, BorderLayout.CENTER);

    myBrowser.addClickListener(
        new Browser.ClickListener() {
          @Override
          public void referenceClicked(final Browser.ClickEvent e) {
            if (e.getEventType() == Browser.ClickEvent.REF_ELEMENT) {
              final RefElement refElement = e.getClickedElement();
              final OpenFileDescriptor descriptor = getOpenFileDescriptor(refElement);
              if (descriptor != null) {
                FileEditorManager.getInstance(project).openTextEditor(descriptor, false);
              }
            } else if (e.getEventType() == Browser.ClickEvent.FILE_OFFSET) {
              final VirtualFile file = e.getFile();
              final OpenFileDescriptor descriptor =
                  new OpenFileDescriptor(project, file, e.getStartOffset());
              final Editor editor =
                  FileEditorManager.getInstance(project).openTextEditor(descriptor, true);
              if (editor != null) {
                final TextAttributes selectionAttributes =
                    EditorColorsManager.getInstance()
                        .getGlobalScheme()
                        .getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES);
                HighlightManager.getInstance(project)
                    .addRangeHighlight(
                        editor,
                        e.getStartOffset(),
                        e.getEndOffset(),
                        selectionAttributes,
                        true,
                        null);
              }
            }
          }
        });

    createActionsToolbar();
    TreeUtil.selectFirstNode(myTree);
  }