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 216789 - Default location of a new file in ClientSide project with Site Root
Summary: Default location of a new file in ClientSide project with Site Root
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Project (show other bugs)
Version: 7.3
Hardware: All All
: P2 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-13 11:45 UTC by Vladimir Riha
Modified: 2012-09-06 23:31 UTC (History)
6 users (show)

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 Vladimir Riha 2012-08-13 11:45:19 UTC
I have Client Side project with site root set to some "folderA" directory:

[project]/[folderA]

If you invoke New File on Site Root node, then the file is placed into site root "folderA":

[project]/[folderA]/[newfile]

That's OK.

However if you invoke New File on project node in Projects window, the file is placed into project root

[project]/[newfile] 

and therefore "hidden" (speaking about Projects window) from user. I think it would make sense to set default location in 2nd case to site root as well. IMHO default location for "project way" and "site root" way should be the same


Product Version: NetBeans IDE Dev (Build EaselCSS-480-on-20120813)
Java: 1.7.0_06; Java HotSpot(TM) Client VM 23.2-b09
System: Linux version 3.0.0-23-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 David Konecny 2012-08-14 01:45:12 UTC
What needs to be done here is similar to what web.core module does. There are two different HTML file wizards - one in "Other" category and second in "Web" category. The Web category wizard has additional field called Location which lists project's source groups which user can select from. In HTML5 Project case the location will list "Site Root", "Unit Tests", "Configuration Files". That should address this problem I think, right?

Unfortunately the way this is implemented in web.core module is too EE cluster dependent and cannot be trivially refactored. I will fix this later once more serious issues are resolved.
Comment 2 David Konecny 2012-08-20 03:38:54 UTC
A note from offline discussion: Location content should be different for different types, eg. HTML should have only Site Root location, but JavaScript should be allowed in both Site Root and Tests.
Comment 3 Petr Jiricka 2012-08-27 11:07:00 UTC
I am hitting this quite often and this is a release stopper -> P2.
Comment 4 David Konecny 2012-09-04 20:05:30 UTC
If you would have time Tomas go ahead and grab this issue from me. :-)
Comment 5 Tomas Mysik 2012-09-05 07:57:19 UTC
Taking over.
Comment 6 Tomas Mysik 2012-09-05 11:56:12 UTC
Davide, any reason why CONFIG folder is registered as GENERIC source root and not HTML5-Sources source root? I guess this is a bug - I will fix it.
Comment 7 Tomas Mysik 2012-09-05 12:33:23 UTC
(In reply to comment #6)
> Davide, any reason why CONFIG folder is registered as GENERIC source root and
> not HTML5-Sources source root? I guess this is a bug - I will fix it.

http://hg.netbeans.org/web-main/rev/e0f20ad29a04
Comment 8 Tomas Mysik 2012-09-05 12:35:23 UTC
Fixed. Right now, for (X)HTML and CSS files, only Site root is available. For other file types, all the roots (Site root, Unit test, Config) are available.

Please verify, thanks.

http://hg.netbeans.org/web-main/rev/19e7ea520bae
Comment 9 Quality Engineering 2012-09-06 02:09:32 UTC
Integrated into 'main-golden', will be available in build *201209060001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/19e7ea520bae
User: Tomas Mysik <tmysik@netbeans.org>
Log: #216789 - Default location of a new file in ClientSide project with Site Root
Comment 10 Vladimir Riha 2012-09-06 08:21:37 UTC
(In reply to comment #8)
> Fixed. Right now, for (X)HTML and CSS files, only Site root is available. For
> other file types, all the roots (Site root, Unit test, Config) are available.

Thanks, if you select HTML & CSS file from HTML/JavaScript category then yes (XHTML is missing here), it works that way.

However there is also category Other with HTML, XHTML and CSS files as well and if you create these files from this category, they can be created "anywhere" and it causes some other problems, reported as issue 217930.

So I'll wait with verifying/reopening for resolution of 217930.



Product Version: NetBeans IDE Dev (Build 201209060001)
Java: 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01
System: Linux version 3.2.0-29-generic-pae running on i386; UTF-8; en_US (nb)
Comment 11 Denis Anisimov 2012-09-06 15:45:15 UTC
The provided fix is not extendable.
It just gives the Wizard Iterator to use it with templates instead of providing 
WizardDescriptor.Panel instance which could be reused in any wizard iterator.
I would suggest to do the something similar to the 
Templates.buildSimpleTargetChooser().create() pattern 
(or just one static method): it's return value should be ready to use WizardDescriptor.Panel instance implemented in the same way as 
private WizardDescriptor.Panel<WizardDescriptor>[] getPanels()
method in the provided fix:

Project project = Templates.getProject(descriptor);
SourceGroup[] groups = filterSourceGroups(project, Templates.getTemplate(descriptor), ClientSideProjectUtilities.getSourceGroups(project));
WizardDescriptor.Panel<WizardDescriptor> simpleTargetChooserPanel = Templates.buildSimpleTargetChooser(project, groups).create();

One additional thing has to be added :
setTargetFolder();
This method should be moved from initialize() method.

Such implementation allows to reuse the code in any custom wizard iterators.
The method should be available in the web.clientproject.api module instead of web.clientproject.
Comment 12 David Konecny 2012-09-06 23:31:42 UTC
(In reply to comment #10)
> However there is also category Other with HTML, XHTML and CSS files as well and
> if you create these files from this category, they can be created "anywhere"
> and it causes some other problems, reported as issue 217930.

Let's deal with that in issue 217930.

(In reply to comment #11)
> The provided fix is not extendable.

Make sense to turn this into some simple API so that Denis can used it from his wizard in REST module.