This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 155043 - Add hint "join declaration and assignment"
Summary: Add hint "join declaration and assignment"
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-09 15:53 UTC by voidmain
Modified: 2014-05-14 12:49 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description voidmain 2008-12-09 15:53:08 UTC
The editor should be capable of joining lines easily and having this action bound to a key stroke such as ctrl-j. In
addition, it should be intelligent about white-space and programming language constructs. Taking from IntelliJ IDEA, if
you have a piece of code like this:

  Foo foo;
  foo = bar.getSomeFoo();

Joining these lines should produce this result:

  Foo foo = bar.getSomeFoo();
Comment 1 markiewb 2012-11-18 15:08:09 UTC
FYI: This request is the opposite hint of the currently existing hint "split declaration and assignment".
Comment 2 Jiri Prox 2012-11-19 07:02:41 UTC
Custom hint may help in this case.

How to setup custom hint:
1) open Refactor -> Insect&Transform dialog
2) click on Browse
3) click on New
4) click on Edit script
5) click on Open In editor
6) copy this code into the editor:

$1 $2;
$2 = $3;
=>
$1 $2 = $3;
;;

7) save file

-> now this hint can be run at several sources by Inspect&Transform
or
   the hint is now provided in editor for each occurrences of give pattern
Comment 3 markiewb 2014-05-14 12:49:35 UTC
(In reply to Jiri Prox from comment #2)
> Custom hint may help in this case.
> 
> How to setup custom hint:
> 1) open Refactor -> Insect&Transform dialog
> 2) click on Browse
> 3) click on New
> 4) click on Edit script
> 5) click on Open In editor
> 6) copy this code into the editor:
> 
> $1 $2;
> $2 = $3;
> =>
> $1 $2 = $3;
> ;;
> 
> 7) save file
> 
> -> now this hint can be run at several sources by Inspect&Transform
> or
>    the hint is now provided in editor for each occurrences of give pattern

I like to create a Java Hint for that, but unfortunately there is an issue in JavaFixUtilities.rewriteFix - see https://netbeans.org/bugzilla/show_bug.cgi?id=244487