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

Bug 332626

Summary: [Markers] MarkerFieldFilterGroup are not honoring the Window Working sets
Product: [Eclipse Project] Platform Reporter: Johan Compagner <jcompagner>
Component: IDEAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Johan Compagner CLA 2010-12-15 08:41:37 EST
If we look at the code:

public MarkerFieldFilterGroup(IConfigurationElement configurationElement,
			MarkerContentGenerator markerBuilder) {
		element = configurationElement;
		generator = markerBuilder;
		initializeWorkingSet();
		scope = processScope();

we see that we get initalizeWorkingSet()
which tells us:

/**
	 * Initialise the working set for the receiver. Use the window working set
	 * for the working set and set the scope to ON_WORKING_SET if they are to be
	 * used by default.
	 */
	private void initializeWorkingSet() {

		IWorkbenchWindow window = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow();
		if (window != null) {
			IWorkbenchPage page = window.getActivePage();
			if (page != null) {
				setWorkingSet(page.getAggregateWorkingSet());
				if ((PlatformUI.getPreferenceStore()
						.getBoolean(IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)))
					setScope(ON_WORKING_SET);

			}
		}
	}

So when the boolean is true it will set the scope to ON_WORKING_SET
what i find strange on this code is that i would expect one other check:

if ( windowWorkingSetIsSet && (PlatformUI.getPreferenceStore()
						.getBoolean(IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)))
					setScope(ON_WORKING_SET);

But thats another issue that i notice. But that private method just tests and sets the workingset and sets the scope.
But that setting of the scope is completely void because the next line in the constructor:

		initializeWorkingSet();
		scope = processScope();

is resetting the scope to what is configured or ANY if nothing can be found:

private int processScope() {

		if (element == null)
			return ON_ANY;

		String scopeValue = element.getAttribute(ATTRIBUTE_SCOPE);

		if (ATTRIBUTE_ON_SELECTED_ONLY.equals(scopeValue))
			return ON_SELECTED_ONLY;

		if (ATTRIBUTE_ON_SELECTED_AND_CHILDREN.equals(scopeValue))
			return ON_SELECTED_AND_CHILDREN;

		if (ATTRIBUTE_ON_ANY_IN_SAME_CONTAINER.equals(scopeValue))
			return ON_ANY_IN_SAME_CONTAINER;

		return ON_ANY;
	}

now the question is if the element is set and it as a scope configured should or should that not override the working set scope?
If we do want to always follow the configured one then i guess we could at least do:

private int processScope() {

		if (element == null)
			return scope;

		String scopeValue = element.getAttribute(ATTRIBUTE_SCOPE);

		if (ATTRIBUTE_ON_SELECTED_ONLY.equals(scopeValue))
			return ON_SELECTED_ONLY;

		if (ATTRIBUTE_ON_SELECTED_AND_CHILDREN.equals(scopeValue))
			return ON_SELECTED_AND_CHILDREN;

		if (ATTRIBUTE_ON_ANY_IN_SAME_CONTAINER.equals(scopeValue))
			return ON_ANY_IN_SAME_CONTAINER;

		return scope;
	}

so return the  scope which is already set.
Comment 1 Eclipse Webmaster CLA 2019-09-06 16:03:57 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 2 Eclipse Genie CLA 2021-11-04 14:04:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.