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

Bug 57712

Summary: [Markers] (regression) Task and Problems view should have selection provider
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: IDEAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: VERIFIED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3 CC: markus.kell.r, remy.suen, Tod_Creasey
Version: 3.0Keywords: api, helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dani Megert CLA 2004-04-07 05:49:41 EDT
3.0 M8

Task and Problems view don't have a selection provider (i.e. it is null).
Therefore we need to set the selection using internal API.

Use Case:
When the user clicks on a task or problem in the editor's vertical ruler we want
to reveal the marker in the Tasko or Problem view (if it is already visible).
Comment 1 Nick Edgar CLA 2004-05-07 15:51:04 EDT
This used to work in 2.1 and should be addressed for M9.

The old TaskList had the following public API:

	/**
	 * API method which sets the current selection of this viewer.
	 *
	 * @param selection a structured selection of <code>IMarker</code> 
objects
	 * @param reveal <code>true</code> to reveal the selection, <false> 
otherwise
	 */
	public void setSelection(ISelection selection, boolean reveal)

This apparently is still there on the new TaskView.
ProblemView does not have such a method.
However, both these classes are internal.

In 2.1, TaskList set its viewer as the selection provider on its site.
The new views should do this as well.
However ISelectionProvider.setSelection does not have a reveal flag, and the 
default implementation in ContentViewer is to -not- reveal.

I propose:
- Change the marker views to set their viewer as the selection provider on the 
site.
- Add a new, public MarkerUtil class with a method to show and reveal a 
marker.  It will pick the best view, show it, and tell it to show the marker.
This way, clients are not bound to the particular view id for showing a 
particular kind of marker.


Comment 2 Nick Edgar CLA 2004-05-07 15:53:15 EDT
Actually, the original comment indicated that they didn't want to open the 
view, so this should be optional.
Comment 3 Nick Edgar CLA 2004-05-07 16:07:48 EDT
The suggested utility class already exists: MarkerViewUtil.
Comment 4 Nick Edgar CLA 2004-05-07 16:19:41 EDT
Should still hook up the selection providers.
Comment 5 Markus Keller CLA 2005-12-05 11:00:42 EST
Dani: using  MarkerViewUtil.showMarker(page, marker, false);
in AbstractDecoratedTextEditor#updateMarkerViews(..) works for me.

Nevertheless, the SelectionProvider would still make sense.
Comment 6 Dani Megert CLA 2005-12-05 12:37:22 EST
Update code in AbstractDecoratedTextEditor#updateMarkerViews(..)
Comment 7 Remy Suen CLA 2007-09-23 09:56:12 EDT
Is this still a problem? Both the TaskList and the TableView (which is a superclass of the ProblemView) seems to be calling getSite().setSelectionProvider(ISelectionProvider).
Comment 8 Tod Creasey CLA 2007-09-24 08:17:01 EDT
This how we do it now yes.
Comment 9 Dani Megert CLA 2007-09-24 08:28:08 EDT
Verified in 3.4 M2.