Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331979

Summary: No symbol sync between external settings cache and project properties
Product: [Tools] CDT Reporter: Marko Tomljenovic <marko.tomljenovic>
Component: cdt-coreAssignee: Project Inbox <cdt-core-inbox>
Status: ASSIGNED --- QA Contact: Jonah Graham <jonah>
Severity: normal    
Priority: P3 CC: jamesblackburn+eclipse, zulliger
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Example plugin with dummy setting provider none

Description Marko Tomljenovic CLA 2010-12-07 02:10:09 EST
Build Identifier: 7.0.1

I am using the external settings provider extension point to provide symbols for a project.
If a user manually removes the symbols from the project properties and recalls the external settings provider but there is no change the project properties will remain empty since there was no change in the externally provided settings. The process of applying the changed settings does not care about the current content of the project properties.

The process of setting the external settings changes should be like that:
1. Calculate common settings (regarding the last provision of settings).
2. Check for each setting if it is still existing in project properties. If not existing or has a different value then add this setting to the delta list of settings
3. Apply the delta on the project (as it is right now)

Reproducible: Always

Steps to Reproduce:
1. Implement an external settings provider that returns e.g. one symbol "example"
2. Execute the provider
3. Go into project properties of project and remove the externally provided symbol
4. Execute the provider again
5. Go into project properties ==> the symbol has not been added
Comment 1 Andrew Gvozdev CLA 2010-12-07 16:59:04 EST
Can you attach a sample plugin which would allow to demonstrate the issue?
Comment 2 James Blackburn CLA 2010-12-07 17:19:13 EST
${workspace_loc} should have a severe health warning.  It's not possible to safely share a project that uses this as an include path. The workspace_loc bears no relation to the location of projects in the workspace, so isn't safe for shared projects (unlike other workspace_loc relative paths). 

This either needs a warning annotation or should be displayed in some other way which distinguishes it from other workspace relative paths.
Comment 3 Marko Tomljenovic CLA 2010-12-08 01:18:31 EST
(In reply to comment #2)
> ${workspace_loc} should have a severe health warning.  It's not possible to
> safely share a project that uses this as an include path. The workspace_loc
> bears no relation to the location of projects in the workspace, so isn't safe
> for shared projects (unlike other workspace_loc relative paths). 
> 
> This either needs a warning annotation or should be displayed in some other way
> which distinguishes it from other workspace relative paths.

Does this comment relate to this issue?
If so then I don't understand it
Comment 4 Marko Tomljenovic CLA 2010-12-08 01:52:59 EST
Created attachment 184771 [details]
Example plugin with dummy setting provider

The attachment contains a plugin that implements a dummy setting provider (always returning one macro "name" - "value") and adds a project context menu: project -> Index -> Call Setting Provider.

The bug can be reproduced like this:

1. Create a dummy C project that has no symbols
2. Execute the context menu
3. Now a symbol name -> value is available in the project properties
4. Remove the symbol manually from the project properties and from all languages
5. Call the context menu
6. Open the project properties
7. The symbol has not been added since the setting provider cache has not detected any change.
Comment 5 James Blackburn CLA 2010-12-08 03:14:13 EST
Sorry, wrong bug -- will teach me to comment from my phone.
Comment 6 Andrew Gvozdev CLA 2010-12-08 09:43:19 EST
(In reply to comment #4)
> Created an attachment (id=184771)
Thanks, I can reproduce that with this description.
Comment 7 Raphael Zulliger CLA 2012-01-18 02:41:03 EST
I suspect the following problem is related to this issue:
 - Assume you have an external settings provider that provides a macro
 - Open Properties -> C/C++ Build -> Settings
 - Press "Restore Defaults"

=> The macro provided by the external settings provider disappears.

For me, this seems to be a quite high-priority issue, because a "normal user" may easily trap into this problem and may not be able to recover from the situation.

Therefore, may I ask whether there is some progress being done on that issue or will someone try to have a look at it soon? 
If not, I could have a look - but it would be great to get some assistance from the community (such as some tips where to start). Ideally, it'd great to have a fix within the next 1 or 2 weeks...
Comment 8 Raphael Zulliger CLA 2012-01-20 03:18:55 EST
I started getting familiar with the mechanism/code related to "external settings provider" vs CLanguageSetting, etc.

According to my current understanding, we lack a clear definition of how entries (i.e. macros, inc-path, lib-path) provided "external settings provider" are treated when a user attempts to change or remove them. Assuming that this statement is correct, I think we must now create such a definition in order to fix this issue.

Currently, I can think of the following possible definitions:

a) entries (i.e. macros, inc-paths, lib-paths) added to the configuration by an "external settings provider" cannot be changed or removed by the user.
	1) They can only be changed and removed by the "external settings provider" that provided them
	1) They can only be changed and removed by a "external settings provider"

b) entries added to the configuration by an "external settings provider" can be changed and removed by the user. Therefore, the user can "override" the entries provided by the "external settings provider"
	1) The entries from the "external settings providers" can only be restored by pressing the "Restore Defaults" button or by removing/reading the "external settings provider"
	2) The entries from the "external settings providers" can be restored by an explicit "Restore external settings" button or by removing/reading the "external settings provider"
	3) There's no default way of how to restore these settings. An "external settings provider" may provide a custom "mechanism" (such as a button, context menu, etc.) that cause restoration of the settings. Moreover, they may be restored by removing/reading the "external settings provider"
		y) The framework could provide helper functions to simplify such a restoration for the "external settings provider"-implementer
		z) No additional framework support

Other?

As far as I understand, the current implementation is "b 3 z". Unfortunately, in "b 3" it's not obvious to the user how his "user changes" to entries provided by "external settings providers" can be undone. The user doesn't even get visual feedback to distinguish an "external setting"-entry from a "normal" one. In short: Depending on the implementation of the external settings provider, there may be no way to restore the settings (for a normal CDT user - you guys could of course :-)).

I surely don't know all use cases of these "external settings provider", therefore I can just judge the above definitions from my limited point of view: For our use case, a) would be sufficient. Moreover, I think that a) would cause least implementation/design effort and is easy understandable even for "normal" human beings. Of course, a) is also the most limiting definition, as there's no standard way of how to change or remove those settings. Only the "external settings provider" may decide to provide a mechanism to change the entries.

Please let me know about your opinion. Do you agree that such a definition is currently missing and that we need one? Or am I misunderstand things?

As I should end up with a solution quite soon, it'd be great to get feedback on that topic as soon as possible.
Comment 9 Raphael Zulliger CLA 2012-01-26 11:57:42 EST
I just created a separate bug entry for the "Restore Defaults" issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=369836