UEXAnalysisToolsUnified

Date: 3 MAR 2012 Author: Petr Somol, Jan Lahoda

Contents

Problem / Motivation

With the addition of FindBugs support to NetBeans 7.2 the IDE contains several analysis tools with similar workflow and related use-cases. The proximity of these tools allows for combining all of them in a unified UI. This document specifies the unification, which will be considered for NetBeans in near future.

For discussion of the state before NetBeans 7.2 and the state planned for 7.2 see the document UEXAnalysisTools72.

Notation: In the following passive inspection will denote an action that identifies issues but does not affect the source code in any way, active inspection will denote an action that in addition to identifying issues does provide the option to refactor (but may be used just passively).

Proposal

(to be adjusted and specified in more detail)

Ideally the unified UI would represent all three analyzers above while taking the better parts of their UI.

Remark: In the following I denote the unified action and dialog Inspect and Transform and the accompanying window Inspector in order to keep all changes as undisturbing for users as possible. However, it might be desirable to put more emphasis on promoting the new functionality by more apparent change (though limiting possible confusion of users who are used to Inspect and Transform). The alternative wording Analyze and Transform for the action and dialog and Analyzer for the dockable window can be considered, provided the action would remain accessible from the same place in menu Refactor as Inspect and Transform has been so far.

Inspect and Transform Action

All three analyzers would be joined under one action Inspect and Transform accessible by shortcut Ctrl-Shift-Y or from menu Refactor where it would remain as it is. Although logically it may belong to menu Source equally well, the placement under Refactor would be the least confusing for users who are already used to current Inspect and Transform.

Inspect and Transform Dialog

the action would open a Inspect and Transform dialog, containing all that is currently contained in Inspect and Transform dialog. The former Analyze Javadoc functionality would be included as another active inspection in JavaDoc inspection category. FindBugs functionality can be inserted under existing categories as well. However, specific categories should be predefined, see below. Also the dialog should contain the necessary additional UI elements like Install missing FindBugs support.

The proposed Inspect and Transform dialog can closely follow the current one.

Remark: to distinguish the internally and externally defined inspections use the wording "NetBeans Java Hints" and "FindBugs Static Analysis". Accordingly, Inspect and Transform should contain predefined configurations: All Inspections, NetBeans Java Hints, FindBugs Static Analysis.

Inspector Window

The button Inspect in Inspect and Transform dialog would open a dockable Inspector window almost the same as Inspect and Transform does now, however with better presentation of passive versus active results. The window would always be split to the left panel and right panel.

The left panel would show the hierarchical list of all identified issues. Issue type (bug, warning, bad practice, performance) would be marked by icons (FindBug issues would have a different icon from the rest). Active issues would additionally have a checkbox permitting their selection for the eventual Transform action (refactoring of code). Passive issues would have no checkbox. Checkboxes would be shown with all nodes whose sub-branches contain at leat one active issue. All issues should be listed by their short one-line description. (Optional: long descriptions displayed as tooltips).

The right panel contents depend on the focused issue and selected display mode: in the default mode for active issues it shows the refactoring preview (diff) as before, for passive issues it shows their full description (NB internal or FindBugs). In the passive mode the right window would display for each issue (regardless whether active or passive) the full description. The mode would be changeble by a button in left vertical toolbar. Regardless of current mode, it should be possible to switch the contents of the right panel on demand for the focused active issue; in case of active issues there would be the switching control available inside the right panel area, in case of passive issues no such control would be displayed.

The left vertial toolbar would contain new icon button. See the images for the four new icons in the bottom. The two upper ones switch the default display mode. The two bottom ones are Fix on Prev and Fix on Next and replicate the functionality that is so far available only in Javadoc analyzer.

In case at least one active issue has been identified, the left panel displays a Do Transform button, allowing the final refactoring to be invoked. After this has finished, the window closes. Remark: as long as a Analyze window is displayed with at least one active item, it does not make sense to let another instance of Analyze and Transform to start. If the user attempts to do this, then a warning is given and the existing Analyze window contents are refreshed according to the new query.

Proposed Inspector window showing a mix of issues. The focused issue is passive thus the right panel shows a description, not a Transform preview. Transform button is available as some of the found issues are active.
Proposed Inspector window showing a mix of issues. The focused issue is active thus the right panel shows by default a preview of the respective transformation.
Proposed Inspector window showing a mix of issues. All found issues are passive, therefore the Transform button is not made available. Accordingly it is not possible to make issue selections. The right panel shows a description for the focused issue.

TOTO: Re-use the Javadoc Analyzer specific functionality in other analyzers - it should be possible to "Fix on Next" etc.

TODO: Further refinements should be defined especially in descriptions of active and passive inspections across manager dialogs etc. These should be presented in a simple and unified way across the whole range of inspections including FindBugs ones.

TODO: Exact behavior of Inspector with respect to description display for active inspections is to be defined

TODO: Review all issue type icons

TODO: specify undo extent (with Refactoring undo is generally disabled)

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo