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 80323 - *Code Model* Auto include necessary headers
Summary: *Code Model* Auto include necessary headers
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: nnnnnk
URL:
Keywords:
: 125053 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-14 16:14 UTC by Vladimir Voskresensky
Modified: 2008-02-07 13:45 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2006-07-14 16:14:57 UTC
If project has class Test in file.h

and user choose Test class from code completion list while change code in file
welcome.cc => CND should check wether Test is available from current #include
directives of welcome.cc and if Test is not accesible =>
#include "file.h" should be added

It should be orthogonal with Java editor and auto adding "import" statements.
Comment 1 Vladimir Voskresensky 2008-01-18 09:21:57 UTC
*** Issue 125053 has been marked as a duplicate of this issue. ***
Comment 2 nnnnnk 2008-02-01 14:34:49 UTC
Plan:

1. Create 2 services:
1.1 First one will check visibility of CSM item that we want to add in current position.
1.2 Second one will find header file that makes CSM item visible.

2. Then I will implement some algorithm of #inlude insertion to document.

3. At last this code will be integrated with NetBeans code completion module (in defaultAction of CsmResultItem).
Comment 3 Alexander Simon 2008-02-06 20:25:31 UTC
Keep in mind "Fix includes action". See:
http://www.netbeans.org/issues/show_bug.cgi?id=89298
1.3 Privide service that visits all unresolved references and finds headers that can resolve references.
Comment 4 nnnnnk 2008-02-07 13:45:56 UTC
I've implemented one service (CsmIncludeResolver, IncludeResolverImpl) that checks visibility of CSM object
(isObjectVisible) and finds include string (#inlude <f.h> or #inlude "f.h") that makes CSM object visible
(findIncludeString).

Also this functionality was integrated with code completion module.

http://hg.netbeans.org/main?cmd=changeset;node=5251efd7bb2a