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 210919 - Right-clicked on folder, New > [some file type] fails to predefine Folder field
Summary: Right-clicked on folder, New > [some file type] fails to predefine Folder field
Status: RESOLVED WORKSFORME
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 7.1.1
Hardware: All All
: P4 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: RANDOM
: 211343 (view as bug list)
Depends on:
Blocks: 211343
  Show dependency tree
 
Reported: 2012-04-10 08:11 UTC by NNOVAA
Modified: 2012-04-21 10:00 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of New File window (86.45 KB, image/jpeg)
2012-04-10 10:51 UTC, NNOVAA
Details
Screencast of bugreproduction (519.08 KB, video/mp4)
2012-04-11 07:09 UTC, NNOVAA
Details
Recreated with nightly build (563.02 KB, video/mp4)
2012-04-17 14:56 UTC, NNOVAA
Details
Log file from nightly build (40.23 KB, application/octet-stream)
2012-04-18 07:34 UTC, NNOVAA
Details
Correct logfile (35.81 KB, application/octet-stream)
2012-04-20 09:14 UTC, NNOVAA
Details
Added -J-Dorg.netbeans.modules.project.ui.actions.NewFile.level=0 (31.60 KB, application/octet-stream)
2012-04-20 09:20 UTC, NNOVAA
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NNOVAA 2012-04-10 08:11:40 UTC
When right-clicking on a folder and select new smartye template, it creates the file in the root instead of the selected directory.

Product Version = NetBeans IDE 7.1.1 (Build 201203012225)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_24
Runtime = Java HotSpot(TM) Client VM 19.1-b02
Comment 1 NNOVAA 2012-04-10 08:12:17 UTC
typo
Comment 2 Petr Somol 2012-04-10 10:39:34 UTC
Could not reproduce in daily build. Can you provide the exact sequence that leads to the faulty behavior (directory names, smart template type, etc.) ? Can you provide the project in which this is happening ?

Reassigning to Project UI.
Comment 3 NNOVAA 2012-04-10 10:51:32 UTC
Created attachment 118043 [details]
Screenshot of New File window
Comment 4 NNOVAA 2012-04-10 10:51:43 UTC
How to recreate:
- select a file in the root inside the projectswindow
- rightclick on a folder
- select new -> smarty/php (doesn't matter which)
- Now you see the the window with blank inputs
- When creating, it places the file in the rootfolder

It doens't happen every single time but I have this with all my projects. I've enclosed a screenshot.
Comment 5 Jesse Glick 2012-04-10 14:29:57 UTC
Was able to reproduce this just the first time I tried it (with New > Empty File in a j2seproject, selecting src/ in Files), but not thereafter. Might be some kind of race condition. No guesses as to what might cause it.

Workaround is simply to use the Browse button to select the desired folder before finishing the wizard.
Comment 6 NNOVAA 2012-04-10 14:50:29 UTC
Easier workaround (less clicks):
- create file without folder
- drag the file to the appropriate directory
Comment 7 Jesse Glick 2012-04-10 18:21:47 UTC
If you know how to consistently (or usually) reproduce this _from scratch_ please comment here, since I probably cannot fix anything unless I can reproduce.
Comment 8 NNOVAA 2012-04-11 07:09:58 UTC
Created attachment 118104 [details]
Screencast of bugreproduction

Screencast of bugreproduction added
Comment 9 Jesse Glick 2012-04-11 14:53:45 UTC
Following what I think are the exact steps in the video, I cannot reproduce. Each time, whether or not I have previously canceled the New File wizard, it offers to create the new file as ".../projname/bugtest/newSmartyTemplate.tpl" as expected. Checked in a dev build on Ubuntu; same in 7.1.1 on XP.
Comment 10 NNOVAA 2012-04-11 15:00:33 UTC
Sorry but I forgot to mention I only use right mousebutton when clicking on a folder.

I'm using windows 7 (32bit)
Comment 11 Jesse Glick 2012-04-11 15:23:38 UTC
Yes, I used the right mouse button too; that was my only guess as to the cause.
Comment 12 NNOVAA 2012-04-13 07:30:43 UTC
Is there anything else I can do to help find/resolve this bug?
Comment 13 Jesse Glick 2012-04-13 17:24:06 UTC
1. Code-level debugging could turn up the problem, only of course if you are familiar with the code or can get familiar with it.

2. If there is a known way to reproduce this from scratch on an arbitrary machine, using a fresh NetBeans installation and user directory, that would certainly help. It could be that the bug only appears on your current computer (for some unknown reason).

3. I added some diagnostic code which should at least narrow down the possible problems. -J-Dorg.netbeans.modules.project.ui.actions.NewFile.level=0 (added to e.g. netbeans.conf) would enable the diagnostics, which would be printed to your log file. These will be available in a nightly development build; an automated note will be attached to this page when that happens.
Comment 14 Quality Engineering 2012-04-14 09:46:07 UTC
Integrated into 'main-golden', will be available in build *201204140400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1caa40380203
User: Jesse Glick <jglick@netbeans.org>
Log: Diagnostics for #210919.
Comment 15 Tomas Mysik 2012-04-16 07:28:57 UTC
I can confirm that it has happned to me several times as well (and I am not the only one). But unfortunately no reliable steps to reproduce.
Comment 16 NNOVAA 2012-04-17 14:56:33 UTC
Created attachment 118416 [details]
Recreated with nightly build

Recreated with nightly build
Comment 17 Jesse Glick 2012-04-17 15:05:51 UTC
*** Bug 211343 has been marked as a duplicate of this bug. ***
Comment 18 NNOVAA 2012-04-17 15:08:37 UTC
How do I add the logfile to the bugreport?
Apparently I made a new issue (http://netbeans.org/bugzilla/show_bug.cgi?id=211343)
Comment 19 Jesse Glick 2012-04-17 15:11:02 UTC
Click on "Add an attachment" and select your .../var/log/messages.log file.
Comment 20 Jesse Glick 2012-04-17 15:33:56 UTC
Still working for me in a dev build on Ubuntu using a PHP-only build.
Comment 21 NNOVAA 2012-04-18 07:34:31 UTC
Created attachment 118431 [details]
Log file from nightly build

As found in C:\Users\Name\AppData\Roaming\NetBeans\dev\var\log
Comment 22 Jesse Glick 2012-04-18 12:23:48 UTC
This log file is not particularly helpful since -J-Dorg.netbeans.modules.project.ui.actions.NewFile.level=0 was not used to enable diagnostics.

Can you reproduce using a fresh user directory? If not, you should be able to use bisection to determine what part of your existing user directory is triggering the problem, which could lead to steps to reproduce.
Comment 23 NNOVAA 2012-04-18 12:27:58 UTC
I'll do a reinstall with a new user next monday.
Comment 24 Jesse Glick 2012-04-18 12:38:26 UTC
Not necessary to reinstall anything, just run with a different user directory: --userdir ... on the command line, or edit the location given in etc/netbeans.conf.
Comment 25 NNOVAA 2012-04-20 09:14:20 UTC
Created attachment 118554 [details]
Correct logfile
Comment 26 NNOVAA 2012-04-20 09:20:26 UTC
Created attachment 118558 [details]
Added  -J-Dorg.netbeans.modules.project.ui.actions.NewFile.level=0

I've added  -J-Dorg.netbeans.modules.project.ui.actions.NewFile.level=0 to the .conf file
Comment 27 Jesse Glick 2012-04-20 14:26:29 UTC
OK, log shows NewFile correctly getting the "folder" subfolder of the project and calling TemplateWizard.setTargetFolder. Sometime later, SimpleTargetChooserPanel calls Templates.getTargetFolder, which delegates to TemplateWizard.getTargetFolder, and gets the wrong result: the project root dir. Why? I do not know, though the fix for (ancient) bug #29661 at the top of NewTemplateAction looks suspicious.

I have added further diagnostics in core-main #8528a0e65d66. When these appear in a dev build, please run with -J-Dorg.openide.loaders.TemplateWizard.level=FINE and again attach your log file produced while reproducing the problem.
Comment 28 Quality Engineering 2012-04-21 10:00:20 UTC
Integrated into 'main-golden', will be available in build *201204210400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8528a0e65d66
User: Jesse Glick <jglick@netbeans.org>
Log: More #210919 diagnostics.