This plugin was born out of the discussion about more reasonable default-selections for the various Introduce-X refactorings. For more info about the discussion, see here: http://www.intellij.net/tracker/idea/viewSCR?publicId=14308
The plugin tries to make a more reasonable selection than selecting the whole line if an Introduce-X refactoring is invoked without any selection. Currently, it intercepts the Introduce {Variable, Constant, Field} refactorings of which each one can be disabled.
The plugin traverses the expression-hierarchy up from where the editor-caret is and rates those expression by different criteria. If there is more than one possible expression, a selection dialog is shown where the user can select the one that is desired.
The ratings for each criterion are configurable for the different intercepted refactorings. The configuration can also be set to a Google-like "I'm feeling lucky" mode, in which the plugin will use the highest rated expression without user-interaction.
Just invoke the refactoring as usual. If the plugin determines that there's only one reasonable expression to be refactored, it selects this expression and shows the usual dialog. If there are several expressions, a selection dialog is shown where you can select the appropriate expression first.
The plugin's "master switch" can be found at "Options -> Smart Introduce Plugin" which completely disables the plugin. Other options, such as selectively enabling the plugin for special refactorings, the "I'm feeling lucky" switch and fine-tuning for the expression-rating can be found at "Options -> IDE Settings -> Smart Introduce"
Important Notes:
- This plugin makes heavy use of the unofficial PSI-API. For PSI usage-terms please see ProgramStructureInterface.
- The plugin intercepts core functionality of IDEA. If you experience errors/crashes while using any of the intercepted Introduce-refactorings, please check the strack trace to see whether it contains code associated with this plugin before posting SCRs in the tracker.
- The plugin was developed and tested with IDEA build #873
Please see the topic SmartIntroducePluginDev?, any feedback is welcome
- Download the binary JAR file (see below)
- Place this file in your <IDEA-HOME>/plugins directory.
- Restart IDEA
Version 0.1 (2003-07-24)
- Very first version. Only intercepts Introduce Variable, no user-selection of expressions
Version 0.9 (2003-07-26)
- Works for Introduce Variable, Constant and Field
- User-selection of possible expressions to refactor
- Configurable expression rating
Version 1.0 (2003-11-24)
- Added support for Introduce Parameter
- Small bugfixes
- Internal refactorings
Version 1.0.1 (2003-12-09)
- IDEA build #992 compatibility
- Removed all usages of Generics code
Version 1.0.2 (2003-12-23)
- IDEA build #1024 compatibility: Moved master switch to Tools menu
Version 1.0.3 (2004-01-17)
Version 1.1.0 (2004-01-28)
Version 1.1.9 (2004-01-30)
- Bugfix: Extract Method was excluding trailing semicolons, causing it to fail
- Extract Substring: Possibility to extract as 'native' type for boolean & numeric literals
Version 1.3.0 (2004-07-04)
Version 1.4.2 (2004-11-07)
- Added support for "Surround With" selection
- Support for Irida-EAP builds
- Stephen Kelvin for the original idea in his SCR
- Amnon I. Govrin for the idea about the ability to select an expression
- TimurZambalayev for his TabSwitchPlugin and CamelPlugin which I borrowed some ideas from.
- Others, in no particular order: Bas Leijdekkers, Gordon Tyler, Alain Ravet
-- SaschaWeinreuter - 13 Jul 2004
|
|