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 133127

Summary: When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.
Product: cnd Reporter: soldatov <soldatov>
Component: Code ModelAssignee: Thomas Preisler <thp>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description soldatov 2008-04-17 16:01:06 UTC
When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

Scenario:
- Create project
- Create such C++ file:
#include <stdlib.h>

#ifdef AAA
int i;
#endif

int main() {
    return 0;
}

- Push 'Tools|Options' menu item
- Click on 'C/C++' icon
- Open 'Code Assistance' tab
- Add 'AAA=1' string into 'C++ Compiler' settings
==> I don't see any changes in editor (code is highlighted as inactive)
- Restart project
==> No changes
- Restart IDE
==> I see correct code highlighting
Comment 1 Thomas Preisler 2008-04-23 05:13:44 UTC
I checked the code and it looks like a notification is going to the codemodel: NativeProjectListenerImpl.filesPropertiesChanged() is called. It means the bug is 
most likely somewhere in the code model.
Comment 2 Vladimir Kvashin 2008-04-23 18:01:46 UTC
Yes, the notification is ok.
The issue is that macros values that are changed in options dialog, aren't used until IDE restart.
I.e. the system macros list that is returned my NativeFileItem does not contain the newly created macro.
Comment 3 Vladimir Kvashin 2008-04-23 18:20:48 UTC
For somewhat reason, there are two instances of the SunCCompiler -
one is used when storing settings from option dialog,
and another one is used in NativeFileItem.gSystemMacroDefinitions
(though I have the only SunStudio_12 compiler collection)
Comment 4 Vladimir Kvashin 2008-04-23 18:44:05 UTC
I noticed that when working with option dialog,
a new instance of SunCCompiler is created (via SunCCompiler.createCopy()).

But Items use the old one; and the from the copy (that is changed in dialog)
doesn't get into the original one
Comment 5 Thomas Preisler 2008-04-24 20:24:25 UTC
I see what is going on.

The BuildTool panel and the Code Assistance panel are owned by core and project system respectively. The The Build Tool panel creates a copy of current 
compiler set and assigns the copy to the default if something has changes. But the Build Tool panle doesn't see if something has changed in the Code 
Assistance and doesn't assign the copy to the current compiler set. If you make a change in *both* the build tool panel and  the code assistance panel it 
works as expected.

The real fix is to move the code assistance panles in under the same owner as the build tool panel so it can track changes more easily. 

For now I may be able to notify the build tool panel that something has changed and it will do the right thing.
Comment 6 Thomas Preisler 2008-04-24 21:36:16 UTC
Fixed:

changeset:   79126:323a6b531051
user:        Thomas Preisler <thp@netbeans.org>
date:        Thu Apr 24 13:35:06 2008 -0700
summary:     133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

changeset:   79127:84fc6fd46009
tag:         tip
user:        Thomas Preisler <thp@netbeans.org>
date:        Thu Apr 24 13:35:34 2008 -0700
summary:     133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

Comment 7 Thomas Preisler 2008-04-24 21:41:37 UTC
The particular problem stated in this IZ should be fixed.

But I see in the code that there are other similar problems: using the Restore button suffer from similar problem. A notofication goes out but the compiler 
sets may not be saved so the code model uses old and unchanged sets. I prefer to close this IZ as fixed (so we can get it into the patch) and file a new issue 
with the remaining problem.
Comment 8 Thomas Preisler 2008-04-24 22:07:00 UTC
changeset 84fc6fd46009 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=84fc6fd46009
description:
	133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

changeset 323a6b531051 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=323a6b531051
description:
	133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.
Comment 9 Thomas Preisler 2008-04-25 05:20:03 UTC
One more change set fixing problem with 'Restore Default':

changeset 3920e5add6bc in main
details: http://hg.netbeans.org/main?cmd=changeset;node=3920e5add6bc
description:
	133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

If you Restore Defaults and also Cancel the dialog things are still not quite right, but much better than before. Would like this to go into Patch 1. Please open 
new IZ for remaining issue.
Comment 10 soldatov 2008-04-25 15:28:36 UTC
Original problem fixed.
verified in 20080425101413 build

If I press 'Reset Settings' button in 'Code Assistance' tab, then IDE works wrongly. Tomorrow I create new bug.
Comment 11 Thomas Preisler 2008-04-25 18:23:20 UTC
It is when you press Restore Defaults and also Cancel (instead of OK) the dialog things are not correct. If you Restore Defaults and also OK things should work 
fine.
Comment 12 soldatov 2008-04-26 16:10:12 UTC
I described my problem in issue 134029
Comment 13 rbalada 2008-04-29 14:02:15 UTC
I've transplanted the changesets from main into release61_fixes repository

main           release61_fixes
------------   ---------------
84fc6fd46009   9e5e405ef537
323a6b531051   95931aa7053b
3920e5add6bc   89b56272e7ff

http://hg.netbeans.org/release61_fixes/rev/9e5e405ef537
http://hg.netbeans.org/release61_fixes/rev/95931aa7053b
http://hg.netbeans.org/release61_fixes/rev/89b56272e7ff

changeset:   77494:9e5e405ef537
user:        Thomas Preisler <thp@netbeans.org>
date:        Thu Apr 24 13:35:34 2008 -0700
summary:     133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

changeset:   77495:95931aa7053b
user:        Thomas Preisler <thp@netbeans.org>
date:        Thu Apr 24 13:35:06 2008 -0700
summary:     133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.

changeset:   77496:89b56272e7ff
tag:         tip
user:        Thomas Preisler <thp@netbeans.org>
date:        Thu Apr 24 21:13:26 2008 -0700
summary:     133127 When user changes compiler settings in 'Code Assistance' tab, then projects ignores these changes.