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 205179 - The new file isn't in default package.
Summary: The new file isn't in default package.
Status: CLOSED WONTFIX
Alias: None
Product: xml
Classification: Unclassified
Component: API (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-16 09:14 UTC by debuggercz
Modified: 2011-11-22 08:43 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
new XML file created in plain java project (59.62 KB, image/png)
2011-11-18 18:37 UTC, Svata Dedic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description debuggercz 2011-11-16 09:14:38 UTC
Product Version: NetBeans IDE Dev (Build 201111150600)
Java: 1.7.0_01; Java HotSpot(TM) 64-Bit Server VM 21.1-b02
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\deuggercz\.netbeans\dev
Cache directory: C:\Users\deuggercz\.netbeans\dev\var\cache

Steps:
1. Use File | New Project... to create new Web Application project.
2. Select root node of your project.
3. Invoke File | New File... from main menu.
4. Select XML category and XML Document as file type. Push Next.
5. Type diary into File Name, leave Folder field to default value and press Next.
6. Let Well-formed Document option selected and press Finish.

The new file should be in <default package> but doesn't. It seems that focus on the node determines path where the new file will be placed because when we select the Source Packages node or <default package> and after that create the new file then is everything fine.
Comment 1 Svata Dedic 2011-11-16 13:11:01 UTC
Could you please take a screenshot of how the New XML Document Step 2 screen looks like after you type in the filename ?

On my screen, the "Folder" input box is empty, indicating root of the project, that means OUTSIDE of all java packages (rooted at src/java). You may verify the full name of the file in the r/o text box below the Folder line.

The default location indeed depends on the place selected at the time File|New File action is invoked; that location will become the default folder for creation.
Comment 2 Svata Dedic 2011-11-18 07:05:14 UTC
No further input and/or confirmation, closing as incomplete until further input arrives.
Comment 3 debuggercz 2011-11-18 11:51:46 UTC
That's right. The input box I have also empty. This is all right. 

The problem is that I close the window with new created file then I lose possibility manipulate with this file in the future because it isn't under project (Web Application).

If we try these steps on the Java Application then the new file will be under <default package> not outside of all java packages.

This is very strange and confusing behaviour.
Controlling should be a uniform.
Comment 4 Marian Mirilovic 2011-11-18 18:00:23 UTC
(In reply to comment #3)
> The problem is that I close the window with new created file then I lose
> possibility manipulate with this file in the future because it isn't under
> project (Web Application).

It can be still found in Files view, right ? If so  ... I would say this is WONTFIX, we can't cover situation when user explicitly creates file out of 'structure visible in projects view'. Or did I miss anything ?
Comment 5 debuggercz 2011-11-18 18:25:28 UTC
You are right.

I just wanted to say that different behavior (wizard of Java Application vs. Web Application) may confuse users.

If someone is used to a certain behavior for example from Java Application and then will pass to Web Application then he will be presumed the same behavior of the same things (for instance - manipulation with files).

But this is probably ENHANCEMENT not DEFECT.
Comment 6 Svata Dedic 2011-11-18 18:36:36 UTC
Actually, I've just created a plain Java project - if you select the root of the project and create an XML file (or more generally non-java resource), the folder will also default to the root of the project - outside all packages. See the attached screenshot.

Only .java files or files directly related to java classes (e.g. hibernate mapping files etc) default to java package structure.
Comment 7 Svata Dedic 2011-11-18 18:37:13 UTC
Created attachment 113335 [details]
new XML file created in plain java project
Comment 8 debuggercz 2011-11-18 18:48:40 UTC
You are right that all non-java classes shouldn't be in <default package> by default (only if user wanted it).

Therefore this is the right behaviour. Sorry for reported the false bug.