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

Bug 303001

Summary: [Markers] Marker views redirect "Preferences" command
Product: [Eclipse Project] Platform Reporter: Philipp Kursawe <phil.kursawe>
Component: UIAssignee: Prakash Rangaraj <prakash>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: bokowski, daniel_megert, deepakazad, markus.kell.r, prakash, pwebster, remy.suen, tomasz.zarna
Version: 3.6   
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 231081, 270007    
Bug Blocks:    
Attachments:
Description Flags
Mock_Up_V01 none

Description Philipp Kursawe CLA 2010-02-16 16:35:41 EST
I have a menu contribution that uses the preferences command ID to show the preferences window for my preference page. However, when the Problems View is active the command shows the Problem views preferences rather than the workbench preference dialog.
Comment 1 Paul Webster CLA 2010-02-16 18:50:27 EST
Yes, it supplies its own MarkerPreferencesDialog.  That's deliberate.

PW
Comment 2 Philipp Kursawe CLA 2010-02-17 01:15:27 EST
I understand that. But is it supposed to hook into the Preferences command?
I have a menu contribution on my toolbar button that is supposed to show *my* preference page with the preference command and preferencePageId set to my preference page. All it does, when the Problems view is active, is to show the problem views preference page. That's clearly not supposed to happen.
Comment 3 Philipp Kursawe CLA 2010-02-17 02:18:28 EST
I see that it indeed provides a handler for "org.eclipse.ui.window.preferences" which is wrong, imho. It should provide a preferences page or create its own command and handler.
Comment 4 Paul Webster CLA 2010-02-17 08:06:34 EST
(In reply to comment #3)
> I see that it indeed provides a handler for "org.eclipse.ui.window.preferences"
> which is wrong, imho. It should provide a preferences page or create its own
> command and handler.

But the Markers view wants File>Preferences to open its preferences dialog.  Providing its own handler does exactly what it wants.

PW
Comment 5 Philipp Kursawe CLA 2010-02-17 08:37:54 EST
But it overwrites not "file->preferences" (where is that anyway?). It overwrites the default handler for "window->preferences".
I have a toolbar dropdown button on the main-toolbar that uses the "window-preferences" command to display its preferences. As soon as the "Problems View" has the focus my dropdown button menu entry will display the problems view preference dialog. That is not expected. The problems view should provide its own command and leave the "window-preferences" handler alone. Or it could just provide its own preference page and hook up with the preference pages in a normal way. Bending handlers as it does now, leads to all kind of weird side effects.
Comment 6 Paul Webster CLA 2010-02-17 08:48:17 EST
(In reply to comment #5)
> But it overwrites not "file->preferences" (where is that anyway?). It
> overwrites the default handler for "window->preferences".

Sorry, that's what I mean, it provides the behaviour for Window>Preferences.

> The problems view should
> provide its own command and leave the "window-preferences" handler alone. Or it
> could just provide its own preference page and hook up with the preference
> pages in a normal way. Bending handlers as it does now, leads to all kind of
> weird side effects.

But providing one's own handler for a command is *exactly* what commands was designed for.  It's not what you expected, but it is what Problems view intented.

That being said, I don't see anything wrong with a more general enhancement request.  It might be that managing its own preference dialog was a requirement long ago but is not necessary any more.  Or it might be that it was intended to migrate to a standard preference page but that work was never scheduled.

PW
Comment 7 Philipp Kursawe CLA 2010-02-17 08:58:58 EST
I understand, that you can provide own handler for commands, and that this was indeed the intention. I still think that the way it works in this case is at least disturbing. I debugged quite a while to find out what was going on. Since I have no time to migrate the preference page of the problems view I will note this as a known issue. Managing its own preference dialog is ok, as long as it does not overwrite the default handler. I mean the workflow is that nobody expects the "window->preferences" entry to show the preferences of the currently active workbench part. Interestingly it does not do that (even when the problems view is active), it just that my toolbar button fails to bring up the default preference page (with mine selected). I do not know whats the difference of activating the main menu "windows->preferences" entry and somehwere else.
Comment 8 Markus Keller CLA 2010-10-18 06:26:39 EDT
Wow, I also just ran into this. The current behavior is clearly a bug, since I cannot access the Preferences dialog any more (in I20101012-0800).

Window > Preferences and its command are not meant to be retargeted. The marker view's "view menu > Preferences" action doesn't need a command (like the other actions in the view menu).
Comment 9 Dani Megert CLA 2010-10-18 06:41:21 EDT
(In reply to comment #8)
> Wow, I also just ran into this. The current behavior is clearly a bug, since I
> cannot access the Preferences dialog any more (in I20101012-0800).
> 
> Window > Preferences and its command are not meant to be retargeted. The marker
> view's "view menu > Preferences" action doesn't need a command (like the other
> actions in the view menu).

+1
Comment 10 Hitesh CLA 2010-10-18 08:27:52 EDT
Paul, are there other cases where such a clash or undesirable behaviour can occur ? It makes sense in using a different command I guess... Is it possible that this maybe seen as a regression ?

What do you think about this ? Thanks.
Comment 11 Paul Webster CLA 2010-10-18 08:31:24 EDT
At the time Tod and I did this deliberately.  But if it is still causing confusion we could switch it out to a markers.preferences command.

PW
Comment 12 Dani Megert CLA 2010-10-20 04:25:16 EDT
(In reply to comment #11)
> At the time Tod and I did this deliberately.  But if it is still causing
> confusion we could switch it out to a markers.preferences command.
This would be a new command right? I don't see a good reason to have a command for this. No other view has this and there's Ctrl+F10 to open the view menu. If those are really "preferences" then they should end up on a preference page like any other preference.

Actually, we should get rid of that preference dialog: we already have a "Columns..." view menu item which allows to select the order and width of the columns. That dialog should also allow to choose which columns are visible instead of putting this into a separate preference dialog. The same has already been requested by bug 231081.

This leaves us with the "limit" option which we could move to the 'Configure Contents' dialog which already has all other filtering options.
Comment 13 Paul Webster CLA 2010-10-20 07:47:34 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > At the time Tod and I did this deliberately.  But if it is still causing
> > confusion we could switch it out to a markers.preferences command.
> This would be a new command right? I don't see a good reason to have a command
> for this.

All of the Marker view menu items are commands.  But yes, I was suggesting not hijacking the main preference command and providing a new local one.

> Actually, we should get rid of that preference dialog: we already have a
> "Columns..." view menu item which allows to select the order and width of the
> columns. That dialog should also allow to choose which columns are visible
> instead of putting this into a separate preference dialog. The same has already
> been requested by bug 231081.

Right, in this case markers preferences seem to me to be more "dialog settings".  I don't see why they couldn't be combined into on markers "setting" dialog.

PW
Comment 14 Deepak Azad CLA 2010-10-26 05:42:11 EDT
This works with 3.6, 3.7M2a, but is broken again with I20101025-1800.
Comment 15 Markus Keller CLA 2010-10-26 05:52:50 EDT
I can confirm Deepak's findings. Was OK up to I20100928-1200, but is broken since I20101005-0800.
Comment 16 Dani Megert CLA 2010-10-26 05:55:51 EDT
Yep, see it here too. I'll take a look...
Comment 17 Markus Keller CLA 2010-10-26 06:03:10 EDT
Looks like the changes for bug 270007 broke this.
Comment 18 Prakash Rangaraj CLA 2010-10-26 06:05:03 EDT
(In reply to comment #17)
> Looks like the changes for bug 270007 broke this.

   Will look into this
Comment 19 Dani Megert CLA 2010-10-26 06:12:16 EDT
(In reply to comment #18)
> (In reply to comment #17)
> > Looks like the changes for bug 270007 broke this.
Indeed.

This should be fixed for M3, given this works in 3.6.x and 3.7 M2.
Comment 20 Prakash Rangaraj CLA 2010-10-26 06:15:59 EDT
In an effort to remove away from Actions (and registering the actions before using it in the command), the fix was checked in for Bug# 270007. I don't think anything wrong in that one. 

On the contrary, I don't think its correct for the Markers view to hijack the Preferences command, when it displays the local settings of the view instead of global preferences. I guess the right solution is for the markers view to use a new command or open up the Preference dialog with the a preference page for the Markers view.

As a temporary measure, I can revert the patch for 270007, but I'll leave it to Hitesh for fixing this
Comment 21 Hitesh CLA 2010-10-26 06:41:18 EDT
I like the suggestions from  Bug 231081. 

Some code duplication here, the 'Columns...' handler uses ConfigureColumns. Unfortunately, this code is not open to reuse, but does it not sounds more like a requirement for viewers in general ?
Comment 22 Prakash Rangaraj CLA 2010-10-26 07:01:34 EDT
*** Bug 328688 has been marked as a duplicate of this bug. ***
Comment 23 Prakash Rangaraj CLA 2010-10-26 07:12:16 EDT
I'm temporarily reverted the changes in Bug# 270007, but even with that, if anyone contributed the Preferences command to a menu/toolbar via commands, they will still face the same issue.

This has to be fixed from the Markers view side.
Comment 24 Dani Megert CLA 2010-10-26 07:15:41 EDT
(In reply to comment #23)
> I'm temporarily reverted the changes in Bug# 270007,
Thanks!

> This has to be fixed from the Markers view side.
I agree. It should be fixed along comment 12.
Comment 25 Hitesh CLA 2010-10-27 03:23:49 EDT
Created attachment 181802 [details]
Mock_Up_V01

(In reply to comment #21)
(In reply to comment #23)

Here is a snippet that tries to behave the way as described above - a demo of what could possibly replace the 2 dialogs. I have also tried to structure it so that one could speculate better if it makes sense to have this as a helper dialog for column-viewers in general.
Comment 26 Prakash Rangaraj CLA 2010-10-27 03:53:13 EDT
(In reply to comment #25)
> Created an attachment (id=181802) [details]
> Mock_Up_V01
> 
> (In reply to comment #21)
> (In reply to comment #23)
> 
> Here is a snippet that tries to behave the way as described above - a demo of
> what could possibly replace the 2 dialogs. I have also tried to structure it so
> that one could speculate better if it makes sense to have this as a helper
> dialog for column-viewers in general.

    Looks good. 

(*) Can the "Width of the selected column" taken out and replaced with a column in the "Show" table?
(*) Why do you need a group for the limit label & text?
Comment 27 Hitesh CLA 2010-10-27 04:11:23 EDT
(In reply to comment #26)
> 
> (*) Can the "Width of the selected column" taken out and replaced with a column
> in the "Show" table?
> (*) Why do you need a group for the limit label & text?

It makes sense since they are related :) One may even suggest including the message area as well...I did not have any particular design in mind; it was meant to be a mock-up for the suggestions discussed yesterday. But, IMHO, with some serious thought one could structure it better.
Comment 28 Dani Megert CLA 2010-10-28 02:40:31 EDT
Verified in I20101028-1800 that the original problem is fixed in M3.
Comment 29 Prakash Rangaraj CLA 2010-12-02 04:19:49 EST
Is this still targeted for M4?
Comment 30 Dani Megert CLA 2010-12-02 04:29:38 EST
(In reply to comment #29)
> Is this still targeted for M4?
Actually, it currently works, so basically we can close this bug but make sure that the fix for bug 270007 doesn't break things again.
Comment 31 Boris Bokowski CLA 2010-12-06 12:12:55 EST
(In reply to comment #30)
> (In reply to comment #29)
> > Is this still targeted for M4?
> Actually, it currently works, so basically we can close this bug but make sure
> that the fix for bug 270007 doesn't break things again.

Moving to M5 since this is not time-critical work that would have to be done for M4.
Comment 32 Paul Webster CLA 2011-01-18 08:00:21 EST
We'll make sure that the fix for bug 270007 doesn't break things again
Comment 33 Prakash Rangaraj CLA 2011-01-25 04:15:21 EST
Verified in I20110124-1800