Bug 77710 - [ViewMgmt] Show View Dialog should indicate/filter Visible Views
Summary: [ViewMgmt] Show View Dialog should indicate/filter Visible Views
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3 M2   Edit
Assignee: Benjamin Muskalla CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2004-11-03 13:06 EST by Randy Hudson CLA
Modified: 2007-06-05 15:00 EDT (History)
3 users (show)

See Also:


Attachments
gray_out_open_views.diff (3.64 KB, patch)
2006-08-27 19:21 EDT, Benjamin Muskalla CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2004-11-03 13:06:07 EST
I was in the debug perspective and had most of the debug views open, but I was 
wondering what else was available.  It would be nice if the entries under the 
Debug category were hidden or displayed in gray text if they were already 
visible.
Comment 1 Kim Horne CLA 2004-11-03 14:22:57 EST
I assume you mean any view that's open, not just debug views...
Comment 2 Nick Edgar CLA 2004-11-04 11:12:18 EST
We don't want to hide or remove the open views from the view menu.
People, particularly people who cannot use the mouse, need to be able to use
this to show existing views as well.

It might be useful to indicate which ones are already shown, e.g. bold the ones
not shown, as is done for editor and view management.
MenuItem doesn't currently support this, but this could be done in the Other...
dialog currently.

Care to supply a patch?
Comment 3 Randy Hudson CLA 2004-11-04 11:35:42 EST
<B>PLEASE! NOT MORE BOLD!</B>

Menuitem supports Checkbox style, but then you'd have to allow the menuitem to 
close the view, which is not a bad idea.
Comment 4 Nick Edgar CLA 2004-11-04 12:17:07 EST
That's not the desired behaviour.  If an existing view is selected, it should be
shown, not closed.
Comment 5 Nick Edgar CLA 2006-03-15 13:28:02 EST
Reassigning bugs in component areas that are changing ownership.
Comment 6 Benjamin Muskalla CLA 2006-08-27 19:21:46 EDT
Created attachment 48856 [details]
gray_out_open_views.diff

Here is a little patch to improve the Show View Dialog. It adds an IColorProvider to the current LabelProvider to gray out all open views of the workbench.

Hope this makes some people happy :)
Comment 7 Philippe Ombredanne CLA 2006-08-27 20:37:46 EDT
Ben:
I wonder if there is a potential leak as you are not disposing the color.
Acquiring a system color might be better approach like in:
Display.getCurrent().getSystemColor(SWT.COLOR_GREY) .SWT.COLOR_TITLE_INACTIVE_FOREGROUND may be even better as it would be a system color.
And it could be called directly in the in setforeground...and would not need to be cached.
Those colors would not (rather should not) have to be disposed, AFAIK.
This would give something like:
+	public Color getForeground(Object element) {
+		if(element instanceof IViewDescriptor) {
+			IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().
+				getActivePage().findView(((IViewDescriptor) element).getId());
+			if(part != null) {
+                               Color color = Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
+				return color;
+			}
+		}
+		return null;
+	}

Just some thoughts.
I did not make any tests, just looked at you patch.
Comment 8 Philippe Ombredanne CLA 2006-08-27 21:05:31 EDT
Caching would not be abig deal anyway, and may be desirable... 
but using a system color, and delaying acquiring it as late as possible might be better
Comment 9 Benjamin Muskalla CLA 2006-08-28 02:09:36 EDT
Sure, you're right. I forgot to use the system colors because I was so happy that i found out how to set the foreground of non-TreeItems ;)

An update of the patch has to wait, because I'm now at work. Maybe this evening I can provide a new one which uses the system color.
Comment 10 Philippe Ombredanne CLA 2006-08-28 02:52:00 EDT
(In reply to comment #9)
> Sure, you're right. I forgot to use the system colors because I was so happy
> that i found out how to set the foreground of non-TreeItems ;)
> An update of the patch has to wait, because I'm now at work. Maybe this evening
> I can provide a new one which uses the system color.
You may want to wait for Boris's input and not take my word for it anyway :-)

Comment 11 Boris Bokowski CLA 2006-08-28 15:04:30 EDT
I'm afraid this will have to be a color that can be changed in the preferences (for accessibility).  SWT.COLOR_TITLE_INACTIVE_FOREGROUND cannot be used because it is for titles, not items in a tree or table.

For an example how to do this, see SearchLabelProvider.fPotentialMatchFgColor in JDT/UI.  It is lazily created, properly disposed of, and appears in the preferences.

I would also prefer that the workbench window is passed from ShowViewHandler through ShowViewDialog to ViewLabelProvider so that you don't have to use PlatformUI.getWorkbench() in ViewLabelProvider.getForeground().
Comment 12 Kim Horne CLA 2006-08-28 16:53:44 EDT
Making this customizable for this alone seems overkill.  Can we generalize the problem such that we're defining a systemwide "lo-light" color that can be used by any view/control/monkey to de-emphasize content?
Comment 13 Boris Bokowski CLA 2006-08-28 17:06:30 EDT
(In reply to comment #12)

Yes.
Comment 14 Randy Hudson CLA 2006-08-29 10:46:14 EDT
What a confusing bug report. Nick and I start talking about what the menus are supposed to do when I originally was discussing a dialog, not the Show View submenu.

As far as accessibility, CTRL+F7 provides a way to get to already open views. As do assigning keybindings. I doubt anyone (intentionall) invokes Other... to activate an already open view.

So anyway, can the Window -> Show View -> ... submenu be improved in some way too? Maybe a preference that disables already opened menuitems. There is no SWT support for colors or fonts on menus :-(.
Comment 15 Randy Hudson CLA 2006-08-29 10:49:23 EDT
(In reply to comment #12)
> Making this customizable for this alone seems overkill.  Can we generalize the
> problem such that we're defining a systemwide "lo-light" color that can be used
> by any view/control/monkey to de-emphasize content?

Can you just take the control's FG color, and blend it 25% with the background color? That should work regardless of system colors.
Comment 16 Boris Bokowski CLA 2006-08-29 11:33:14 EDT
> Can you just take the control's FG color, and blend it 25% with the background
> color? That should work regardless of system colors.

Good idea.  60% foreground and 40% background worked best for me.  Fix released to HEAD >20060829.
Comment 17 Boris Bokowski CLA 2006-08-29 13:55:41 EDT
reopening so that I can re-assign
Comment 18 Boris Bokowski CLA 2006-08-29 13:57:35 EDT
Benjamin, please verify this bug during our 3.3 M2 test pass. Thanks!
Comment 19 Benjamin Muskalla CLA 2006-09-20 13:04:12 EDT
[I20060920-0010] Verified on Gentoo Linux / GTK