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 197864 - Physical view should not expect that project directory should necessarily be in source groups
Summary: Physical view should not expect that project directory should necessarily be ...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 197766 197768
  Show dependency tree
 
Reported: 2011-04-19 13:32 UTC by Vladimir Kvashin
Modified: 2011-05-12 04:37 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Running patch (4.58 KB, patch)
2011-04-19 23:01 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2011-04-19 13:32:49 UTC
Now it is expected that project directory should necessarily be in source groups.
It would be fine if NetBeans had no such expectation.
The motivation is that project metadata should be hidden from user for certain project types. The mentioned expectation disallow doing that: if I don't add project directory to source groups, "Files" view becomes just empty.
Comment 1 Vladimir Kvashin 2011-04-19 13:34:38 UTC
I tries to change this and succeeded, here is a patch (I initially attached it to one of the issues that are blocked by this one):
http://bugzilla-attachments-197768.netbeans.org/bugzilla/attachment.cgi?id=107836
Comment 2 Jesse Glick 2011-04-19 22:58:32 UTC
I do not think I understand the use case - a remote project should have a remote URL for its project directory, and that is what should be shown in Files. Nonetheless, the change seems reasonable; the main reasons for the former logic were

1. Ensure that something is shown even if the project does not have a Sources impl. But ProjectUtils.getSources already has a fallback impl.

2. Produce a warning if there are multiple groups with the project dir in them, or none. But this would seem to conflict with the intent of this issue.

3. Sort the project dir group first. That should be up to the project anyway.

The patch can be simplified; I will attach that. But it breaks ProjectsRootNodeNotRecognizedTest - something to do with lazy projects I do not exactly understand. Perhaps Yarda can explain.
Comment 3 Jesse Glick 2011-04-19 23:01:00 UTC
Created attachment 107845 [details]
Running patch

ProjectsRootNode part of the patch causes a test failure.
Comment 4 Vladimir Voskresensky 2011-04-20 10:21:29 UTC
(In reply to comment #2)
> I do not think I understand the use case
I can formulate another use cases for project from existing sources (where metadata folder and existing sources do not intersect)

1. project have Add New->Source File => it's strange for user to see that metadata folder is proposed as folder where sources can be inserted
2. We'd like Files View for such project to have only one entry - src folder itself. We don't want to show metadata folder (all can be done through project properties UI and no need to give access to project.xml file directly)
Comment 5 Jesse Glick 2011-05-05 17:20:32 UTC
Reassigning to evaluate test failure; see comment #2.
Comment 6 Jaroslav Tulach 2011-05-09 15:45:39 UTC
The test checks the behavior of the system when a folder is deleted while OpenProjectHook is running. Obviously you are changing the behavior. You can mimic the old behavior, but if you believe behavior should change, you probably have to modify the test to:

        Node child = logicalView.getChildren().getNodeAt(0);
        assertNull("No child at 0", child);
Comment 7 Jesse Glick 2011-05-10 22:23:33 UTC
Well I have looked at it again but I do not see any purpose for the ProjectsRootNode part of the patch. Vladimir can this just be omitted, leaving the obvious patch to PhysicalView?
Comment 8 Vladimir Kvashin 2011-05-11 09:16:38 UTC
(In reply to comment #7)
> ...I do not see any purpose for the ProjectsRootNode part of the patch
> Vladimir can this just be omitted... 
As I understand, without this change original node will be replaced by Node.EMPTY in the case there is only one node returned by PhysicalView.createNodesForProject and this node is not a project dir node.
Comment 9 Jaroslav Tulach 2011-05-11 12:51:03 UTC
Guys, a sarcastic comment follows: Should you write a unit test to show what is wrong and what the correct outcome should be, we would not have to speculate about the implementation and whether it works or not.
Comment 10 Jesse Glick 2011-05-11 16:35:05 UTC
(In reply to comment #8)
> without this change original node will be replaced by
> Node.EMPTY in the case there is only one node returned by
> PhysicalView.createNodesForProject and this node is not a project dir node.

Confirmed. I will write a test covering this and try to figure out how to resolve the conflict with lazy projects in ProjectsRootNodeNotRecognizedTest.
Comment 11 Jesse Glick 2011-05-11 17:30:33 UTC
core-main #47b6a1a5210d
Comment 12 Quality Engineering 2011-05-12 04:37:42 UTC
Integrated into 'main-golden', will be available in build *201105120000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/47b6a1a5210d
User: Jesse Glick <jglick@netbeans.org>
Log: #197864: do not force a project to include its project directory in a generic source group.