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 139705 - CC not work immediat. after adding fold. into global include path
Summary: CC not work immediat. after adding fold. into global include path
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 143126 144341 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-11 12:06 UTC by rmatous
Modified: 2009-03-21 08:34 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
New PHP include path dialog as of changeset a535e8acd089 (41.41 KB, image/png)
2008-10-11 22:19 UTC, Torbjorn Norbye
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rmatous 2008-07-11 12:06:17 UTC
After addding folder into global include path CC doens't work immediately. The project must be reopened, then it works.
Comment 1 Tomas Mysik 2008-07-22 13:51:07 UTC
Hi Tor and Tomasz,
I'm adding you to CC because I think that the project (classpath) side is OK. Scenario:
- be sure to have PHP project with PHP Global Include Path on its "classpath" opened (verify in project properties, 
category PHP Include Path)
- IDE Options -> PHP -> add folder to PHP Global Include Path
- all the events are processed/fired in 
org.netbeans.modules.php.project.classpath.support.ProjectClassPathImplementation, GSF asks for 
ProjectClassPathImplementation.getResources() (the new folder is there)
- but in CC I don't see functions from the new directory
- restart IDE => CC is correct

Thanks for any feedback.
Comment 2 Tomas Mysik 2008-07-23 13:58:36 UTC
Tor? Tomasz? Any ideas?
Comment 3 Tomas Mysik 2008-07-23 14:20:30 UTC
After the discussion with Tomasz, it looks like a GSF issue. Please evaluate, thanks.
Comment 4 Tomasz Slota 2008-08-11 13:50:21 UTC
*** Issue 143126 has been marked as a duplicate of this issue. ***
Comment 5 Tomasz Slota 2008-08-20 19:33:49 UTC
*** Issue 144341 has been marked as a duplicate of this issue. ***
Comment 6 Torbjorn Norbye 2008-10-11 22:15:55 UTC
I know what the problem is now. Unfortunately, I don't know a risk free way to fix it.

The problem is that each ClasspathInfo caches its set of ClassIndex instances. This is done for performance. What
happens here is that the Classpath is updated with the new library added to the global classpath, and its gets indexed,
but the -existing- classpath instances don't get updated. For new files/projects, the new classpath is seen, but for
existing open files, the cached instance is used which is why the restart is required.

I'm really afraid to touch this code, and it's not tested well by unit tests since it's all about integration of
classpath/projects/event firing/dialogs/startup scanning, etc.

There's a pretty simple workaround: Restarting the IDE. Adding a global include path probably isn't done very often, so
this shouldn't be too inconvenient.  However, it's NOT obvious that a restart is needed.  

So, a temporary "fix" of this problem is to add a warning message to the properties dialog which explains that a restart
may be needed.  I've done that - see attached screenshot. This was done in changeset a535e8acd089. This should make it
obvious that after tweaking your path, you should restart the IDE if you want to see the classpath reflected in code
completion etc.  This is not ideal, but I think it's the best choice for 6.5 given the risk of touching anything in the
classpath area.  After integrating this fix I'm downgrading this to a P3 for the remaining issue that this should be
handled automatically rather than requiring user intervention.
Comment 7 Torbjorn Norbye 2008-10-11 22:19:02 UTC
Created attachment 71617 [details]
New PHP include path dialog as of changeset a535e8acd089
Comment 8 Torbjorn Norbye 2008-10-11 22:21:04 UTC
By the way, there seems to be a bug in the PHP Include Path customizer. I had added a global include path there. After
restarting the IDE etc. everything worked.  When I expand the Libraries node in the project explorer, I see my library.
However, when I open the dialog, it's not listed in the list! (See the screenshot - it's empty, even though I have a
library).
Comment 9 Tomas Mysik 2008-10-12 18:48:33 UTC
> By the way, there seems to be a bug in the PHP Include Path customizer.

Tor, could you please file a new issue against PHP project with steps to reproduce? Thanks a lot.
Comment 10 David Strupl 2009-01-14 14:35:20 UTC
Moving from ruby/GSF to editor/CSL. Step one: assign to myself ;-)
Comment 11 David Strupl 2009-01-14 14:42:29 UTC
Step 2: trying to make the owner not myself but the owner of the subcomponent.
Comment 12 Vitezslav Stejskal 2009-02-02 14:43:41 UTC
With the use of api.java.classpath and PHP specific classpath IDs this I believe should work. Please check again and if
there is still a problem in the infrastructure reassign back. Thanks
Comment 13 Tomas Mysik 2009-03-20 15:32:51 UTC
Verified, works for me for Global Include Path as well as project's Include Path.
Warning from project customizer removed.
http://hg.netbeans.org/web-main/rev/87896977f7e8

Product Version: NetBeans IDE Dev (Build 090320)
Java: 1.5.0_16; Java HotSpot(TM) 64-Bit Server VM 1.5.0_16-b02
System: Linux version 2.6.27-11-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 14 Quality Engineering 2009-03-21 08:34:45 UTC
Integrated into 'main-golden', will be available in build *200903210201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/87896977f7e8
User: Tomas Mysik <tmysik@netbeans.org>
Log: Additional fix related to #139705: CC not work immediat. after adding fold. into global include path

Just warning removed, not needed any more.