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 188190 - Code templates sometimes not working.
Summary: Code templates sometimes not working.
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-29 11:08 UTC by luke
Modified: 2016-08-12 07:34 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description luke 2010-06-29 11:08:01 UTC
Product Version = NetBeans IDE 6.9 (Build 201006101454)
Operating System = Windows Vista version 6.0 running on x86
Java; VM; Vendor = 1.6.0_20
Runtime = Java HotSpot(TM) Client VM 16.3-b01

Hi, I wrote about it here (problem 1):
http://forums.netbeans.org/viewtopic.php?t=28989

I hope this link is enough. If not, please write to me and I will place text here.

Another not functional template:
-----
/**
 * ${comment}
 *
 * @param array $$filter
 * @param int $$limit
 * @param int $$offset
 * @param bool $$count
 * @param bool $$useCache
 * @param int $$returnType
 * @return array
 */
public function get${objectName}s(array $$filter = array(), $$limit = null, $$offset = null, $$count = false, $$useCache = true, $$returnType = \Marwel\System\DBO\RootHandler::RETURN_TYPE_ARRAY) {
	if ($$this->isNew()) {
	  return $$count ? 0 : array();
	} else {
	  $$filter[$$this->idKey()] = $$this->id();
	  $$${handlerName}Handler = \Marwel\System\System::getDBOHandler('${moduleName}', '${handlerName}'); /* @var $$${handlerName}Handler \Marwel\${ModuleName}\DBO\${HandlerName}Handler */
	  return $$${handlerName}Handler->getObjectsByFilter($$filter, $$limit, $$offset, $$count, $$useCache, $$returnType);
	} // else
} // get${objectName}s${cursor}
-----

Thank you,
Lukas Starecek
Comment 1 Petr Pisl 2011-09-27 09:19:10 UTC
The formatting is still wrong. Valid bug
Comment 2 Ondrej Brejla 2012-05-02 09:47:41 UTC
Still valid.

Product Version: NetBeans IDE Dev (Build 20120502-3fa1de339d64)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; cs_CZ (nb)
User directory: /home/warden/userdir
Cache directory: /home/warden/userdir/var/cache
Comment 3 Ondrej Brejla 2013-06-04 13:31:07 UTC
Still valid.

Product Version: NetBeans IDE Dev (Build 20130604-31cd1883d6b1)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Linux version 3.8.0-22-generic running on i386; UTF-8; cs_CZ (nb)
Comment 4 Tomas Mysik 2016-08-12 07:34:06 UTC
(In reply to luke from comment #0)
> Hi, I wrote about it here (problem 1):
> http://forums.netbeans.org/viewtopic.php?t=28989

Copying the text here, just for the record:
-------------------------------------------

The first main problem is, that when I use this template, the result is as you see, I have cursor at the end of the last line and I can write just text (just edit as usual). I'm not able to change any template variable (${Handler}, ${key} ... ). In Netbeans 6.8 everything works well and some other templates in version 6.9 works too. In my collegue netbeans 6.9 this template just freeze netbeans for cca 30 seconds and then nothing happends. I have Windows Vista, collegue have Ubuntu 9.10 . 

Second main problem are new lines and indentation. I suppose, that this problem is same as here http://forums.netbeans.org/topic28951.html but I don't know, how to set proper "Blank Lines" in formating settings and I'm affraid, it's not possible to set it as I need in all cases. 
First problem is missing new lines before "?" and ":" in ternal condition operator ($something ? $then : $else). Sometimes I want to have this in one line, sometime in several lines (depends on complexity of code). 
Second problem is new lines before comment "// getHandler". I need to have this type of comments (comments showing end of some block) just after method/function/class closing bracer. 

And at last I think If I format template in some way, I want to use it as is and I feel furious when any "act of god" reformate it in any way  . So is it possible to add to future versions some kind of "checkbox" that I do not want to reformat template in any way in template insertion (except indentation of whole template content to right horizontal position)? I know it's maybee against "global formating of files", but we do not use it because we use a little different formating rules.

I found, that first problem is in the JavaDoc in @return. If I remove variables from @return \Marwel\${Module}\DBO\${Handler} tag (for example If I change this line to @return \Marwel\AAA\DBO\BBB), everything is working well...