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 218752

Summary: Select in projects not working for PHP files
Product: platform Reporter: padraigdoran
Component: ExplorerAssignee: Jan Peska <JPESKA>
Status: REOPENED ---    
Severity: normal CC: bronius, kanakmar, miszmaniac, norbi771, padraigdoran, stopsopa, T30, tmysik, vicricker, vriha
Priority: P3 Keywords: RANDOM
Version: 8.0.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description padraigdoran 2012-09-21 10:35:53 UTC
When you right-click a PHP file/tab that is open and select 'Select in projects' it doesn't select the file in the Projects window. It does work for js, txt, .htaccess, etc.

##########

Product Version = NetBeans IDE Dev (Build 201209210001)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0_07
Runtime = Java HotSpot(TM) Client VM 23.3-b01
Comment 1 Ondrej Brejla 2012-09-21 13:24:04 UTC
For me it works properly on Mac.

Product Version: NetBeans IDE Dev (Build 20120921-d3b6065dfa33)
Java: 1.6.0_35; Java HotSpot(TM) 64-Bit Server VM 20.10-b01-428
System: Mac OS X version 10.8.2 running on x86_64; UTF-8; cs_CZ (nb)
Comment 2 padraigdoran 2012-09-21 13:55:21 UTC
(In reply to comment #1)
> For me it works properly on Mac.
> 
> Product Version: NetBeans IDE Dev (Build 20120921-d3b6065dfa33)
> Java: 1.6.0_35; Java HotSpot(TM) 64-Bit Server VM 20.10-b01-428
> System: Mac OS X version 10.8.2 running on x86_64; UTF-8; cs_CZ (nb)

I'm using the PHP zip build:
NetBeans Build 201209210001 PHP OS Independent Zip/English (en)

What are you using?
Comment 3 Ondrej Brejla 2012-09-21 13:57:51 UTC
Custom build from todays sources.
Comment 4 Tomas Mysik 2012-09-21 15:10:23 UTC
Not the first report, unfortunately it is random. I guess it is a problem in the general projects support but I need to reproduce it first.

Thanks for reporting.
Comment 5 phpwebber 2012-10-10 13:19:30 UTC
I have this problem as well. The Navigator updates but the Projects window does not. I have this problem regardless of using the hot key or when depending on Synchronize Editor with Views.

The problem is intermittent and can be solved with a restart. If I can figure out what process causes it to stop working, I'll return.

Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.6.0_24; OpenJDK 64-Bit Server VM 20.0-b12
System: Linux version 3.4.9-2.fc16.x86_64 running on amd64; UTF-8; en_US (nb)
Comment 6 Tomas Mysik 2012-10-10 13:26:59 UTC
That would be great since unfortunately, we cannot reliably reproduce it.

Thanks.
Comment 7 Tomas Mysik 2012-11-30 07:54:23 UTC
Since we cannot reliably reproduce, closing as WORKSFORME. Please reopen if the problem still exists.

Thanks.

Product Version: NetBeans IDE Dev (Build 20121129-e683c348b155)
Java: 1.6.0_37; Java HotSpot(TM) 64-Bit Server VM 20.12-b01
Runtime: Java(TM) SE Runtime Environment 1.6.0_37-b06
System: Linux version 3.5.0-18-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 8 padraigdoran 2012-11-30 17:30:09 UTC
I've just noticed something with this. The problem occurs for me if I cancel the "background scanning" of a project. I had to cancel this scanning because of an issue there is with background scanning of large projects (which is being worked on here: http://netbeans.org/bugzilla/show_bug.cgi?id=221885 )

Anyway, when the background scanning finished correctly, I was able to use the right-click -> Select in Projects button with no problems.
Comment 9 Tomas Mysik 2012-12-03 05:25:55 UTC
(In reply to comment #8)
> Anyway, when the background scanning finished correctly, I was able to use the
> right-click -> Select in Projects button with no problems.

Martine/Láďo, could we try to reproduce it, please? However, it should not be related to any scanning...

Thanks.
Comment 10 Vladimir Riha 2012-12-03 09:23:00 UTC
Sorry, I can't reproduce it. I'm not sure how cancelling scanning works as the progress bar it still there but I tried Select in Projects after this cancelling and also during background scanning and the file was selected in Projects window.


Product Version: NetBeans IDE Dev (Build web-main-9408-on-20121202)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 11 Vladimir Riha 2012-12-03 09:29:00 UTC
to be thorough: The PHP project contained sample project TodoList, Dokuwiki and ExtJS. When memory usage was approx < 750 MB, it worked. Then IDE became slow and partially not responsive and ended up with OutOfMemory exception so I can't try it in this state. But I'd say it is related to the issue #221885. After scanning finished, it worked fine
Comment 12 stopsopa 2013-03-11 11:20:21 UTC
For me Shift+Ctrl+1 doesn't work for yml files. In first moment i thought that's happen because of errors in this file but, when i fixed all errors it stil doesn't work :/
Comment 13 Tomas Mysik 2013-03-11 11:27:39 UTC
@stopsopa: Can you reliably reproduce this issue? If yes, provide exact steps or attach a sample project.

Thanks.
Comment 14 j.mos 2013-11-13 20:34:06 UTC
I still have the same problem with Netbeans 7.4. It happens on .php, .js, .tpl and other file types. I therefore don't think it is related to a specific file type.

And as others already said, it is random. Sometimes it works, sometimes it doesn't.

Interestingly, the problem never occurs with the similar function "Select in Files".

Thanks.
Comment 15 Tomas Mysik 2013-11-14 06:26:40 UTC
*** Bug 225286 has been marked as a duplicate of this bug. ***
Comment 16 Tomas Mysik 2013-11-14 06:27:17 UTC
Without exact steps to reproduce, we cannot do anything, sorry :/

Thanks.
Comment 17 j.mos 2013-11-18 21:18:48 UTC
The problem is not really reproducible, but it often happens if you open a .js file in a PHP project, then close and restart the IDE. Under these circumstances the problem happens really often.

But even if no .js files are involved at all, the problem sometimes arises.

Thanks,

Jens
Comment 18 Tomas Mysik 2013-11-19 07:51:23 UTC
Thanks a lot for the hint, I will look at it.

Thanks.
Comment 19 mmolda 2013-11-19 17:23:14 UTC
I tried it few times, with bigger projects and no luck :/

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Comment 20 norbi771 2013-11-19 21:21:09 UTC
The problem occurs very frequently in my case with Netbeans 7.4 (and all up to 7.4 I tried). It shows up after I use IDE for some time.
I observed this with PHP only. I never experienced this behavior in JAVA projects.

Just for test case I opened pretty big PHP project*. Everything worked fine. Then I switched project group and with that group I opened another pretty big PHP project. I have 3 files opened in IDE with that new project group. One of them was HTML file. I entered that file and corresponding entry in projects was not selected. Another file - the same. After IDE was restarted selection in projects for the same files in the same group again is working fine.

*"Pretty big" is relative term. In this case it is project of ~2000 (PHP+HTML+JS) files + some graphics (~1000 files).


Brgs
Norbert
Comment 21 bronius 2014-04-22 21:22:06 UTC
Hi - I found this thread because I see the issue happening in Netbeans 8.0.

Working with multiple Drupal projects (read: lots of files in project) open, each having a few open within various document tabsets, I found that the bound keyboard short cut (cmd-shift-1) no longer consistently works like it did in early Netbeans builds, but right-click Select in Projects seems to.  Kb shortcut merely opens the sidebar to wherever it was when it was last hidden.

Hope this helps (and is relevant)
-Bronius
Comment 22 bronius 2014-04-30 16:41:03 UTC
Per my Comment 21 that bound keys did nothing more than open the panel but did not locate the current working file but that context-menu > Find in Projects did, that seems to no longer be the case for me-- both work equally well as intended.

Note that since that comment, I have over the course of time restarted NetBeans several times (and reloaded/rescanned projects), have changed my Ignored Files/Folders settings on various projects, and have restarted my mac at least once.

I hope this helps.
Comment 23 djdevin 2014-09-10 15:55:29 UTC
I still see this randomly, it does not select the file in the projects window.

For me, closing and reopening the project restores the functionality.

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 2
Java: 1.7.0_60; Java HotSpot(TM) 64-Bit Server VM 24.60-b09
Runtime: Java(TM) SE Runtime Environment 1.7.0_60-b19
System: Linux version 3.15.10-201.fc20.x86_64 running on amd64; UTF-8; en_US (nb)
Comment 24 luislobo 2014-12-07 22:28:00 UTC
It does not work at all for JS projects (Node) In PHP it just works perfect. Netbeans 8 here.
With PHP files, it works great, Ctrl Shift 1 goes to the file. For JS files, it just focuses the Project View.
Comment 25 Vladimir Riha 2014-12-08 06:20:36 UTC
(In reply to luislobo from comment #24)
> It does not work at all for JS projects (Node) In PHP it just works perfect.
> Netbeans 8 here.
> With PHP files, it works great, Ctrl Shift 1 goes to the file. For JS files,
> it just focuses the Project View.

I guess you are using some plugin for NodeJS in NetBeans 8? If that's the case it is likely issue of such plugin. In nightly NetBeans builds, there is a new support for NodeJS projects and it works OK here. You can give it a try from http://bits.netbeans.org/download/trunk/nightly/latest/
Comment 26 bronius 2015-03-17 19:23:35 UTC
My observations are still current in 8.0.2:
* Right-click Select in Project works 100%
* Default, bound keyboard shortcut cmd-shift-1 works when IDE first launches but over time seems to stop.

I tend to keep my IDE open for days and weeks on end with the same two projects open in two tab sets.  Hmm.. Maybe it has to do with switching branches in Git?  Still whatever the cause, it doesn't make sense that Select in Project mouse click ALWAYS works even when keyboard shortcut for the same ceases after a while to do anything more than open the project window (but not select the current file).
Comment 27 Tomas Mysik 2015-03-18 06:51:58 UTC
Unfortunately, without exact steps to reproduce it is hard to fix it (has never happend to me).
Comment 28 vicricker 2015-03-18 13:54:43 UTC
It also does not work for .less files.  Neither SHIFT-CTRL-1, nor Navigate->Select in Projects, nor right-clicking the editor tab works. It does focus the Projects window, but doesn't select the file.  Restarting the IDE has no effect.

(Netbeans 8.0.2, Linux, HTML 5 project)
Comment 29 Vladimir Riha 2015-03-18 14:02:04 UTC
@vicricker: Could you please report a new issue against HTML project with reproducible steps? It works for me. Thank you


Product Version: NetBeans IDE Dev (Build 201503160001)
Java: 1.8.0_40; Java HotSpot(TM) Client VM 25.40-b25
Runtime: Java(TM) SE Runtime Environment 1.8.0_40-b25
System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
Comment 30 bronius 2015-04-16 20:59:31 UTC
(In reply to bronius from comment #26)
> My observations are still current in 8.0.2:
> * Right-click Select in Project works 100%
> * Default, bound keyboard shortcut cmd-shift-1 works when IDE first launches
> but over time seems to stop.
> 
> I tend to keep my IDE open for days and weeks on end with the same two
> projects open in two tab sets.  Hmm.. Maybe it has to do with switching
> branches in Git?  Still whatever the cause, it doesn't make sense that
> Select in Project mouse click ALWAYS works even when keyboard shortcut for
> the same ceases after a while to do anything more than open the project
> window (but not select the current file).

Ooh!  I may be able to reliably reproduce it on my end:
1. (Re)Start Netbeans with some project and tabs already open
2. In the active document tab, press cmd-shift-1 (kb bound shortcut) to Select in Projects.  Observe that current doc's file is open in the Projects pane.
3. Click back into another tab.
4. Use the *menu* item Navigation > Select in Projects. Observe that the active file is selected.
5. Now, click another tab, and try the keyboard shortcut again: The earlier selected file is still selected.
6. Note that using the menu Select in Projects always works, and keyboard shortcut no longer works.
7. Close Netbeans to try again from step 1: See that it repeats.

(At least that's what happened for me just now)

The key observation (reliably reproduceable or not) seems to be in what is it that differs between a keyboard shortcut bound operation and calling the function from the click of either context menu (right click tab > Select in Projects) or main menu Navigation > Select in Projects

I really hope this helps :)  Thanks for the super powerful IDE.
Comment 31 bronius 2015-04-16 21:13:59 UTC
(In reply to bronius from comment #30)
> (In reply to bronius from comment #26)
> > My observations are still current in 8.0.2:
> > * Default, bound keyboard shortcut cmd-shift-1 works when IDE first launches
> > but over time seems to stop.

Update: It may not time based after all. "Over time" is wrong. It appears to be caused by the click of *some* (but not all) main menu actions.  See update HTR below.


> 4. Use the *menu* item Navigation > Select in Projects. Observe that the
> active file is selected.

Choosing "Select in Projects" seems to reliably cause the issue.  "Refactor > Rename" on a variable did once but maybe not reliably.  I *think* Open > Recent File and selecting a file did once, but I can't reproduce that ...
Comment 32 bronius 2015-04-16 21:19:01 UTC
(In reply to bronius from comment #31)
> (In reply to bronius from comment #30)
> > (In reply to bronius from comment #26)
> > > My observations are still current in 8.0.2:
> > > * Default, bound keyboard shortcut cmd-shift-1 works when IDE first launches
> > > but over time seems to stop.
> 
> Update: It may not time based after all. "Over time" is wrong. It appears to
> be caused by the click of *some* (but not all) main menu actions.  See
> update HTR below.

Update: It appears to be directly correlated to *clicking* the main menu item "Navigation".  I click, and the bound keyboard shortcut doesn't Select in Projects-- it does show the Projects window, but whatever earlier-selected file remains selected, not the one I am actively on.

Last update for now, lest I get banned here :)
Comment 33 Tomas Mysik 2015-04-17 05:27:23 UTC
@bronius: Thanks for the steps, we will try them and hopefully we will be able to fix this annoying issue.

Thanks.
Comment 34 Tomas Mysik 2015-04-17 06:19:37 UTC
Unfortunately, it works for me in every possible case :/

Anyone on CC: could you please try the steps and see if it works for you or not? I would really like to fix this issue but it works for me really always :/

Thanks a lot!
Comment 35 T30 2015-07-29 10:24:32 UTC
Hi, I was able to reproduce the issue on my NetBeans 8.0.2 on Windows7Pro (i've made tests on a java web project):

1-Right-click on a project and select "Find"
2-Search a word that actually exists in some file.
3-Open that file clicking the search result.
4-On this file, the "Select in projects" command doesn't work.

(optional)
5-Open the same file from the Projects panel (on the left)
6-Note that two instances of the same file are opened in the editor (weird!)
7-On this new opened file, the command works.

It seems to fail also with files opened by the links in the "Output" panel if there's an error reporting the link on a file.
So in a nutshell, this command seems to work only if the files are opened from the Projects panel, and not from the other panels on the bottom.

Thanks
Comment 36 Tomas Mysik 2015-07-29 11:32:27 UTC
(In reply to T30 from comment #35)
> Hi, I was able to reproduce the issue on my NetBeans 8.0.2 on Windows7Pro
> (i've made tests on a java web project):
> 
> 1-Right-click on a project and select "Find"
> 2-Search a word that actually exists in some file.
> 3-Open that file clicking the search result.
> 4-On this file, the "Select in projects" command doesn't work.

Unfortunately, this use case works for me without any problem :/ I tried it with a PHP project in the current dev version of NetBeans.

Thanks.

Product Version: NetBeans IDE Dev (Build 20150729-b59a0c1d909d)
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-25-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 37 bronius 2015-08-04 21:05:23 UTC
(In reply to T30 from comment #35)
@T30's experience may be related, but for purposes of isolating the specific issue as I've been able to reproduce things, mine is specifically with the Select in Projects keyboard shortcut:
1. Both right-click > Select in Projects and keyboard combo work to open the file pane and highlight the active document initially.
2. Activate another document tab (to differentiate for the next step)
3. Literally just click on the Navigate main menu item
4. Keyboard shortcut for Find in Projects no longer selects the file (it will still open the Projects file browser pane, and if you've not changed tabs, you will happen to have the same document selected)
5. Right click > Select in Projects (as does main menu Navigate > Select in Projects) still works
Comment 38 Tomas Mysik 2015-08-21 12:49:10 UTC
(In reply to bronius from comment #37)
> (In reply to T30 from comment #35)
> @T30's experience may be related, but for purposes of isolating the specific
> issue as I've been able to reproduce things, mine is specifically with the
> Select in Projects keyboard shortcut:
> 1. Both right-click > Select in Projects and keyboard combo work to open the
> file pane and highlight the active document initially.
> 2. Activate another document tab (to differentiate for the next step)
> 3. Literally just click on the Navigate main menu item
> 4. Keyboard shortcut for Find in Projects no longer selects the file (it
> will still open the Projects file browser pane, and if you've not changed
> tabs, you will happen to have the same document selected)
> 5. Right click > Select in Projects (as does main menu Navigate > Select in
> Projects) still works

Still works for me without any problem (not sure about step 4., what to do exactly - I just invoke CTRL + SHIFT + 1 to select file in the Projects view).

Thanks.
Comment 39 Tomas Mysik 2015-08-27 08:32:15 UTC
Today, I was able to reproduce this issue - sorry, no idea why or what I did exactly. Node for the file was correctly found in PhpLogicalViewProvider so I tried to debug it but ended in Explorer and then I was lost, sorry :)

What exactly happened:
- open some file in IDE (perhaps project type is not important)
- select some *other* file in the Projects view
- put cursor/focus to the editor and invoke Select in Projects (CTRL + SHIFT + 1)
- under debugger, I can see that:
   - proper node is delivered to the Explorer module
   - proper (previously) selected file is set
   - so vetoable change event is fired
   - ProjectTab.createSelecctionTask() is called with correct (new) node to be selected

-> but the node is not selected (highlighted) in the Projects view, no other feedback visible, anywhere

Thanks.

Product Version: NetBeans IDE Dev (Build 20150827-c757928c05c4)
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 40 Tomas Mysik 2015-08-27 08:34:41 UTC
(In reply to Tomas Mysik from comment #39)
>    - proper node is delivered to the Explorer module

To TreeView class.
Comment 41 Tomas Mysik 2015-08-27 08:45:54 UTC
(In reply to Tomas Mysik from comment #39)
> - under debugger, I can see that:
>    - proper node is delivered to the Explorer module
>    - proper (previously) selected file is set
>    - so vetoable change event is fired
>    - ProjectTab.createSelecctionTask() is called with correct (new) node to
> be selected

Sorry, proper order seems to be:

- ProjectTab.createSelectionTask() is called with correct (new) node to be selected
- proper node is delivered to the Explorer module
- proper (previously) selected file is set
- so vetoable change event is fired (ExplorerManager:274)
- this event is then processed in TreeView? or BeanTreeView? sorry, not sure now...

I hope I am not wrong.
Comment 42 bronius 2017-06-05 14:35:01 UTC
Just checking in to report that in 8.2, the issue still occurs.  I have put some how-to-reproduce from a user's perspective in my particular environment before, so no need to restate that.  But I will reiterate that restarting the IDE does bring back the functionality.
Cheers
-Bronius
Comment 43 Remdul 2017-06-16 11:58:57 UTC
I now also have this problem in C++ projects for Netbeans 8.2, where it previously worked in 7.4, in the same (upgraded) project. So there has been a regression.

When right clicking on the file tab > Select in Project, no node is selected in the treeview, and the IDE title bar text changes to "Netbeans 8.2", and the "Run" toolbar buttons are grayed. This indicates that the project no longer set active/selected. If that helps...

For other files, the feature works as expected (and as it did in 7.4) for me.
Comment 44 zandersmith 2018-09-21 21:09:37 UTC
Changing the key binding seems to fix this problem.
Comment 45 Remdul 2018-10-25 20:45:19 UTC
I'm pretty sure I have found the source of this bug!

I've had this issue in a fresh & new C++ project. When I looked at the /nbeans/configurations.xml file, I noticed multiple "Logical Folder" nodes with duplicate names ("f1, "f2" etc). These names should probably be unique. When I manually changed these names to be unique (using text editor), and re-opened the project, the problem now no longer occurs.

So it appears the internal (xml?) node search function fails to fully iterate the node tree because of duplicate names.

I guess the fix would be to make sure all the nodes in the project tree have unique names; fix the way node names are generated.

Example of bad names in configurations.xml, notice duplicate "f1" and "f4":
--------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="100">
  <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
    <logicalFolder name="SourceFiles"
                   displayName="Source Files"
                   projectFiles="true">
      <logicalFolder name="f1" displayName="Common" projectFiles="true">
        <itemPath>common.cpp</itemPath>
        <itemPath>common.h</itemPath>
      </logicalFolder>
      <logicalFolder name="f2" displayName="Main" projectFiles="true">
        <itemPath>main.cpp</itemPath>
        <itemPath>main.h</itemPath>
        <itemPath>mainwindow.cpp</itemPath>
        <itemPath>mainwindow.h</itemPath>
        <itemPath>mainwindow_tree.cpp</itemPath>
        <itemPath>viewport.cpp</itemPath>
        <itemPath>viewport.h</itemPath>
      </logicalFolder>
      <logicalFolder name="f3" displayName="Misc" projectFiles="true">
        <logicalFolder name="f1" displayName="File" projectFiles="true">
          <itemPath>file.cpp</itemPath>
          <itemPath>file.h</itemPath>
        </logicalFolder>
        <logicalFolder name="f4" displayName="Math" projectFiles="true">
          <logicalFolder name="f4" displayName="mat3" projectFiles="true">
            <itemPath>mat3.cpp</itemPath>
            <itemPath>mat3.h</itemPath>
          </logicalFolder>
[...]
Comment 46 Remdul 2018-10-29 20:50:38 UTC
By the way, do these comments still reach NetBeans devs?

I find the JIRA thing unusable, its interface is utterly innavigable and extremely disorganised and confusing. Is that an UI intended for humans from Earth? I have no idea where even to begin looking for the search function (assuming it exists) so I can search for tickets/issues...
Comment 47 Remdul 2018-10-30 21:59:18 UTC
@Bronius Motekaitis: I never noticed a difference in functionality between right-click on the file tab > Select in Projects, and the keyboard shortcut. Both failed then, and both work now (with my workaround).

To be honest I'm not sure there really is a difference in behaviour (menu vs shortcut) of this bug as some people reported. If the file/tab does not have focus (and the user didn't notice), the shortcut also does nothing, maybe that threw some people off. Or it could be a another unrelated bug where the shortcut stops working.

---- >% ----

I posted this comment from the old bugtracker, because I absolutely cannot find this issue in the new JIRA son-of-a-thing. Can someone post the URL of this issue? Somehow I'm still getting mail forwarded so I'm lucky to actually read your replies. :P
Comment 48 Jiri Kovalsky 2018-10-31 06:59:29 UTC
If you cannot find the corresponding bug report in the new Apache NetBeans JIRA system, it is because nobody filed it there. If you can reproduce the issue in Apache NetBeans 9.0 or 10.0 VC1, feel free to report it there [1] and select "php - Project" component.

https://issues.apache.org/jira/secure/CreateIssue!default.jspa