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 198830 - Code Templates to support to change case of parameters
Summary: Code Templates to support to change case of parameters
Status: RESOLVED DUPLICATE of bug 153756
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 6.x
Hardware: PC Other
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 17:07 UTC by Alexander Kouznetsov
Modified: 2015-03-26 22:42 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Screenshot (17.52 KB, image/png)
2012-01-23 09:33 UTC, Alexander Kouznetsov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kouznetsov 2011-05-23 17:07:00 UTC
A way to setup Code Template to change case of parameter is needed. I 
want to have something like:

String ${name};

public init${Name}() {

}


It actually would be natural if everywhere where it was distinguished 
just with the case of parameter. So if user enters "key" for the name 
parameter, it would create method initKey().

Templates are here: Tools > Options > Editor > Code Templates.

Mila:

 unfortunately we currently do not support such thing. I'm wondering whether using ${Name} is optimal since there could be similar request for e.g. lowercase (which could eventually be handled in an oposite way) but maybe other requests too. On the other hand ${Name} is an intuitive solution.
 We could also implement it by adding another hint for this e.g. ${name cap_first } (similarly to "?cap_first" for freemarker). Currently the first occurrence of a parameter is considered a master parameter (the occurrence that is physically edited and replicated automatically to slave parameters) and it's the only one where the extra hints can be used (the slaves cannot have the hints currently). It could be a problem if you would require field generation below the methods (like some coding styles suggest):

public int get${name cap_first}() {
    return ${name};
}

private int ${name};

since here the master would have to be non-first ${name} used. Anyway marking a master parameter is more an internal CTs implementation problem (e.g. we can inspect all the occurrences of the parameter for hints and merge all hints together and select the master as the one without specific hints like cap_first etc. automatically).
Comment 1 Alexander Kouznetsov 2012-01-23 09:33:35 UTC
Created attachment 115154 [details]
Screenshot

Screenshot description: 

"NetBeans IDE 7.1" taskbar button in the left. When you click it, another button appears which is in the right. Right click on it will show you this menu on top with "Close Window" item only.
Comment 2 markiewb 2015-03-26 22:42:23 UTC
Duplicate of 153756 ?

*** This bug has been marked as a duplicate of bug 153756 ***