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 254985 - FOQ returns ProjectConvertor instead of correct project for external source roots
Summary: FOQ returns ProjectConvertor instead of correct project for external source r...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 8.1
Hardware: All All
: P2 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-03 19:56 UTC by gena01
Modified: 2015-09-17 01:27 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
sample project (1.02 KB, application/gzip)
2015-09-11 06:05 UTC, Tomas Mysik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gena01 2015-09-03 19:56:53 UTC
This is a continuation of https://netbeans.org/bugzilla/show_bug.cgi?id=254208 This might be related because the setup is very similar.

In Netbeans 8.0.1 setup a new project:
Steps to reproduce (I have Git for Windows installed):
1. cd c:\Users\gfeldman\Documents\NetBeansProjects
2. Open NetBeans 8.0.1 and open "New Project" wizard.
3. Select type "PHP" and Projects "PHP Application with Remote Server".
4. Give it a name "php-sql-parse" Sources Folder: "C:\Users\gfeldman\Documents\NetBeansProjects\php-sql-parser" and tick "Put NetBeans metadata into a separate directory". Type in the path "C:\Users\gfeldman\Documents\NetBeansProjects\php-sql-parser-nb" and Press Next. 
5. In Project URL enter: "http://localhost" (doesn't actually matter for me since I only use it to sync files between my desktop and remote server). Select remote connection and upload directory.
6. Let it download all the files.
7. Close NetBeans 8.0.1

Open NetBeans 8.1 and try to open the same project.

Expected:
- Download/Upload/Synchronize is enabled and working correctly.

Actual:
- Download/Upload/Synchronize menu items are disabled.

I tried changing project settings to local and back to remote. Seems to make no difference.
Comment 1 Tomas Mysik 2015-09-04 06:23:22 UTC
I followed your steps (with my own remote project, of course) and it works without any problem.

The possible "problem" here could be that in NB 8.1 you are opening your Source Files folder (php-sql-parser, this one does not contain nbproject folder), not project folder (php-sql-parser-nb, this one contains nbproject folder). You can easily verify it using these steps:

- create project in NB 8.0.x as you described
- rename composer.json to tmp.json
- close NB 8.0.x
- open this project in NB 8.1

-> now, NB recognizes as its project only your project folder (php-sql-parser-nb) and not your Source Files folder (php-sql-parser).

If it still does not work for you, please reopen this issue but attach your complete project created in NB 8.0.x (php-sql-parser and php-sql-parser-nb folders).

Thanks.

Product Version: NetBeans IDE Dev (Build 20150904-e2feafa1bb8a)
Java: 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11
Runtime: Java(TM) SE Runtime Environment 1.7.0_80-b15
System: Linux version 3.19.0-26-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 2 gena01 2015-09-08 20:49:19 UTC
Renaming composer.json seems to "fix" the problem for me, however this seems like a step backward and I don't feel like I should be renaming that file to get remote syncing working :(

P.S. This sounds like a bug to me, since I have a project already open (pointing to project-nb and it disables remote syncing based on the files in the source folder?)
Comment 3 Tomas Mysik 2015-09-09 05:25:55 UTC
(In reply to gena01 from comment #2)
> Renaming composer.json seems to "fix" the problem for me, however this seems
> like a step backward and I don't feel like I should be renaming that file to
> get remote syncing working :(
> 
> P.S. This sounds like a bug to me, since I have a project already open
> (pointing to project-nb and it disables remote syncing based on the files in
> the source folder?)

Sorry, I still not get it. What are your _exact_ steps to reproduce? IMHO you must be opening not your NetBeans project but folder with composer.json, right? And that is incorrect because a new NB project is generated for you (because you have NB project metadata somewhere else on your hard drive so NetBeans cannot easily find it; this is not the case if one has nbproject folder directly in project directory [folder with composer.json in your case]).

So, I still do not see any issue here, sorry. I tried your scenario and it works for me without any problem (including remote operations), see comment #1.

Thanks.
Comment 4 gena01 2015-09-09 15:37:28 UTC
Sorry, let me be more specific.

We have a project created at the very top/beginning of the bug report. (from 8.0.1) 

1. Rename composer.json to tmp.json inside sources folder: "C:\Users\gfeldman\Documents\NetBeansProjects\php-sql-parser".
2. Open Netbeans 8.1 Nightly (I don't have any projects open) and open project php-sql-parser-nb.
3. Verify that the project is set as "remote" and that download/upload/sync menu items are enabled and working.
4. Exit Netbeans, but don't close the project (leave it open, this is critical).
5. Rename the tmp.json file back to composer.json inside the sources folder: "C:\Users\gfeldman\Documents\NetBeansProjects\php-sql-parser".
6. Start Netbeans 8.1 nightly and check that the menu items are now disabled? 

P.S. I am leaving the project open in Netbeans between restarts. This behavior is consistent for me. Sounds like some sort of an side-effect of the new "composer.json" is a project feature in 8.1 (which I can't turn off?)
Comment 5 Tomas Mysik 2015-09-11 06:04:30 UTC
So, the problem seems to be in SimpleFOQ which returns ConvertorProject instead of correct project.

Will attach a sample project right after this comment.

Tome, exact steps:
- start NB with a clean userdir and PHP support enabled
- open phpproj-nb directory (NOT phpproj-src!)
- open its Project Properties and:
   - verify directories in the Sources category (phpproj-nb and phpproj-src)
   - in Run Configuration, define a new (S)FTP connection (some dummy connection is fine) and select it (this ensures that project has no errors and all actions should be enabled)
- right click index.php - actions Upload/Download/etc. are disabled but should not be

The cause:
- these actions are created via FileSensitiveActions which creates FileAction which calls ActionsUtil#getProjectsFromLookup(Lookup, String). This method uses FOQ which incorrectly returns ProjectConvertor instead of the opened PHP project (under debugger, I was able to see that external owners are properly set).

Note: if one renames composer.json to e.g. tmp.json, restarts the IDE, it works without any problem.

Thanks!
Comment 6 Tomas Mysik 2015-09-11 06:05:13 UTC
Created attachment 156079 [details]
sample project

Open phpproj-nb, NOT phpproj-src.
Comment 7 Tomas Zezula 2015-09-15 17:41:21 UTC
Fixed jet-main 930e4fb41e3f

Tome, please retest the PHP or JS Project Convertor features as the change is quite big.
Comment 8 Tomas Mysik 2015-09-16 08:52:29 UTC
(In reply to Tomas Zezula from comment #7)
> Fixed jet-main 930e4fb41e3f

Thanks a lot, Tome!

> Tome, please retest the PHP or JS Project Convertor features as the change
> is quite big.

In such case, adding also Láďa to CC. I will test it once the fix is available in web-main repo.

Thanks.
Comment 9 Quality Engineering 2015-09-17 01:27:19 UTC
Integrated into 'main-silver', will be available in build *201509170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/930e4fb41e3f
User: Tomas Zezula <tzezula@netbeans.org>
Log: #254985:FOQ returns ProjectConvertor instead of correct project for external source roots