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

Bug 387579

Summary: [EditorMgmt] [regression] No indication/decoration for pinned editor
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: alex.panchenko, dannyyoo, eclipse-bugs, eric.woodruff+eclipse, frederic.ebelshaeuser, igraham, Lars.Vogel, loskutov, markus.kell.r, mober.at+eclipse, nobody, rhuddusa, siegmaralber, solf.gm, tsk, walter.brunauer
Version: 4.2   
Target Milestone: 4.5 M6   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=462613
Whiteboard:
Bug Depends on: 423819, 424433    
Bug Blocks: 422676, 422680    
Attachments:
Description Flags
screenshot of "pin editor" in vs2012
none
I20140722-0800 none

Description Dani Megert CLA 2012-08-20 06:47:11 EDT
4.2.

The indication/decoration for pinned editor is gone in 4.x.
Comment 1 Dani Megert CLA 2012-08-20 06:51:04 EDT
.
Comment 2 Dani Megert CLA 2012-08-20 06:58:02 EDT
In addition, the 'Pin the current editor' toolbar button does not show the state of the active editor.
Comment 3 Dani Megert CLA 2012-08-20 06:58:20 EDT
Closed wrong bug.
Comment 4 Dani Megert CLA 2013-01-29 08:00:22 EST
*** Bug 390981 has been marked as a duplicate of this bug. ***
Comment 5 Danny Yoo CLA 2013-09-09 17:30:46 EDT
This is still a problem in 4.3: we're seeing no visual indication whether or not an editor is pinned.
Comment 6 Eric Moffatt CLA 2013-09-16 16:06:06 EDT
We can reproduce this now and there is indeed no afordance provided. Seems odd since we can handle icon changes in the view's (JUnit, Problems...), does the editor use a different mechanism ?
Comment 7 Eric Moffatt CLA 2013-11-14 15:00:56 EST
Committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=5ccbeaf04e4b48154395960c07edda5948523d41

This is a rewrite of how we handle updates to the image and tooltps through overrides. It moves the logic / responsibility for this out from under the CompatibilityParts and the Editor/View references and moves it to the StackRenderer.

This is *not* finished:

- Check for leaks
- We don't manage the overlay images correctly in that they get a white (rather then transparent) background when adorned).
- Not sure if we're handling the Tooltips correctly, need to check
Comment 8 Paul Webster CLA 2013-11-14 15:27:33 EST
It complains: 

Description	Resource	Path	Location	Type
Missing @since tag on ADORNMENT_PIN	IPresentationEngine.java	/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench	line 131	@since tag problem

PW
Comment 9 Nobody - feel free to take it CLA 2013-11-15 09:21:57 EST
(In reply to Eric Moffatt from comment #7)
> Committed:
> 
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=5ccbeaf04e4b48154395960c07edda5948523d41
> 
> This is a rewrite of how we handle updates to the image and tooltps through
> overrides. It moves the logic / responsibility for this out from under the
> CompatibilityParts and the Editor/View references and moves it to the
> StackRenderer.
> 
> This is *not* finished:
> 
> - Check for leaks
> - We don't manage the overlay images correctly in that they get a white
> (rather then transparent) background when adorned).
> - Not sure if we're handling the Tooltips correctly, need to check

All pure e4 apps now throw a warning that the pinned_ovr.gif is not found. Stack: http://pastebin.com/5h7w1JMZ

We are supposing that the org.eclipse.ui bundle is available always, which is not the case for e4 RCPs.
Comment 10 Paul Elder CLA 2013-11-15 09:29:26 EST
We are also failing two JUnits:

UIAllTests
org.eclipse.e4.ui.tests.UIAllTests
org.eclipse.e4.ui.tests.workbench.InjectionEventTest
testEventInjection(org.eclipse.e4.ui.tests.workbench.InjectionEventTest)
junit.framework.AssertionFailedError: expected:<1> but was:<0>
  ... snip JUnit assert calls ... 
	at org.eclipse.e4.ui.tests.workbench.InjectionEventTest.testEventInjection(InjectionEventTest.java:177)

testInjectWildCard(org.eclipse.e4.ui.tests.workbench.InjectionEventTest)
junit.framework.AssertionFailedError: expected:<1> but was:<0>
  ... snip JUnit assert calls ... 
	at org.eclipse.e4.ui.tests.workbench.InjectionEventTest.testInjectWildCard(InjectionEventTest.java:248)
Comment 11 Paul Webster CLA 2013-11-15 14:23:32 EST
(In reply to Paul Webster from comment #8)
> It complains: 
> 
> Description	Resource	Path	Location	Type
> Missing @since tag on ADORNMENT_PIN	IPresentationEngine.java
> /org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench	line 131	@since
> tag problem

Fixed this.

(In reply to Sopot Cela from comment #9)
> All pure e4 apps now throw a warning that the pinned_ovr.gif is not found.
> Stack: http://pastebin.com/5h7w1JMZ
> 
> We are supposing that the org.eclipse.ui bundle is available always, which
> is not the case for e4 RCPs.

Yes, this is a problem:

Unable to resolve plug-in "platform:/plugin/org.eclipse.ui/icons/full/ovr16/pinned_ovr.gif".
java.io.IOException: Unable to resolve plug-in "platform:/plugin/org.eclipse.ui/icons/full/ovr16/pinned_ovr.gif".
Comment 12 Lars Vogel CLA 2013-11-18 06:28:25 EST
Proposed fix for the icon reference, I copied the icon to org.eclipse.e4.ui.workbench.renderers.swt and adjusted the icon reference 

https://git.eclipse.org/r/#/c/18489/
Comment 13 Lars Vogel CLA 2013-11-18 07:02:40 EST
(In reply to Lars Vogel from comment #12)
> Proposed fix for the icon reference, I copied the icon to
> org.eclipse.e4.ui.workbench.renderers.swt and adjusted the icon reference 
> 
> https://git.eclipse.org/r/#/c/18489/

Sopot testet my fix and it worked OK for him (see Gerrit review). I applied it, as otherwise we are breaking all Eclipse 4 RCP clients. If there is a better way of doing this, please feel free to revert my fix and apply the better solution.
Comment 14 Paul Webster CLA 2013-11-18 10:21:22 EST
(In reply to Lars Vogel from comment #12)
> Proposed fix for the icon reference, I copied the icon to
> org.eclipse.e4.ui.workbench.renderers.swt and adjusted the icon reference 
> 
> https://git.eclipse.org/r/#/c/18489/

Once Bug 421344 is fixed we should remove this one and consume from org.eclipse.ui.images.

PW
Comment 15 Dani Megert CLA 2013-11-18 11:09:51 EST
(In reply to Paul Elder from comment #10)
> We are also failing two JUnits:

Still failing in N20131117-2000.
Comment 16 Eric Moffatt CLA 2013-11-19 12:53:15 EST
This has also broken the I-build. When a part is disposed and has had an overlay image it's not cleared from the persistent data cache, leading to SWT errors when you re-open the view.

To Repro:

Close the package explorer then re-open it...(assuming it's only in one perspective.

fix coming...
Comment 17 Eric Moffatt CLA 2013-11-19 13:04:48 EST
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=6640e68957c1e5a8d211bf595d575c7ed2bbb3a8

Safes up the Image handling and adds some j'doc to note the requirement to check for disposed.
Comment 18 Eric Moffatt CLA 2013-11-26 14:43:15 EST
This still needs some work; the mechanism we currently use to copy the image doesn't preserve the tranparency bits. The original image provided by the part is smaller than 16x16 but in order to adorn the image with a pin we need a 16x16 image. Currently pinning an editor leads to cheese around the original image's background...
Comment 19 Dani Megert CLA 2013-11-27 11:50:17 EST
I suspect the changes from this bug are also responsible for the .log entries (see bug 422680).
Comment 20 Dani Megert CLA 2013-11-28 03:25:17 EST
> This still needs some work;

Some more issues I found while testing it:
- The icon should only be visible if pinning is possible, which is only the
  case when 'Close editors automatically' is enabled.
- When an editor is pinned and a file is created, its editor will be unpinned
  (correct), but the icon in the toolbar is in enabled state (looks pressed).
  NOTE: Works when just opening the editor instead of creating a new file.
Comment 21 Eric Moffatt CLA 2013-12-10 15:38:05 EST
M4 is done...
Comment 22 Dani Megert CLA 2014-01-13 08:53:12 EST
(In reply to Eric Moffatt from comment #7)
> Committed:
> 
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=5ccbeaf04e4b48154395960c07edda5948523d41
> 
> This is a rewrite of how we handle updates to the image and tooltps through
> overrides. It moves the logic / responsibility for this out from under the
> CompatibilityParts and the Editor/View references and moves it to the
> StackRenderer.
> 
> This is *not* finished:

This breaks tool tips, see bug 424433 comment 2.
Comment 23 Martin Oberhuber CLA 2014-02-03 08:13:31 EST
CQ:WIND00-WB4-2600
Comment 24 Dani Megert CLA 2014-07-08 08:27:51 EDT
Major remaining issues as of 4.4:

- Pin Editor icon does not appear in toolbar
  ==> pinning not possible via UI, one has to define a key binding and use
      that shortcut
- 'Pin Editor' is not in the tab's context menu

NOTE: When pinning via shortcut, the editor tab *is* decorated, so that part works.
Comment 25 Martin Oberhuber CLA 2014-07-08 12:23:39 EDT
(In reply to Dani Megert from comment #24)
> - Pin Editor icon does not appear in toolbar

I'm actually glad it's no longer in the toolbar. I think that the action of pinning an editor is not common / frequent enough to justify a toolbar button. Also, contextmenu on the editor's tab is more intuitive IMHO than toolbar button.

>   ==> pinning not possible via UI, one has to define a key binding and use

I would expect a global menu in "Window > Editor > Pin Active Editor" in order
to make the action (and possible keyboard shortcut) discoverable.

> - 'Pin Editor' is not in the tab's context menu

Now that's a big loss IMO, and should be the preferred UI gesture for pinning an editor. But, please, don't re-introduce the toolbar button.
Comment 26 Sergey Olefir CLA 2014-07-08 12:42:53 EDT
I believe it is entirely possible to remove unwanted buttons from the toolbar.

So in my opinion -- by all means put it back on the toolbar so if someone (like me) needs it -- they can have it.
Comment 27 Walter Brunauer CLA 2014-07-08 12:46:49 EDT
(In reply to Sergey Olefir from comment #26)
> I believe it is entirely possible to remove unwanted buttons from the
> toolbar.
> 
> So in my opinion -- by all means put it back on the toolbar so if someone
> (like me) needs it -- they can have it.

+1 from me.

I use it all the time, and there are much less useful buttons around to remove first. If somebody wants to remove it from the toolbar, he can do so anytime anyway.
Comment 28 Eric Rizzo CLA 2014-07-08 12:58:14 EDT
Sorry to pile on, but I'm also +1 for restoring it to the toolbar. I use that button quite frequently.
Comment 29 Martin Oberhuber CLA 2014-07-08 13:32:34 EDT
Created attachment 244895 [details]
screenshot of "pin editor" in vs2012

How hard would it be to get a little "pin" control in the editor tab ?
See attached.
Comment 30 Dani Megert CLA 2014-07-28 03:44:22 EDT
(In reply to Martin Oberhuber from comment #29)
> Created attachment 244895 [details]
> screenshot of "pin editor" in vs2012
> 
> How hard would it be to get a little "pin" control in the editor tab ?
> See attached.

This would have to be combined with the current "pin" decoration that we already have. In the end this would probably use more screen real estate than the single toolbar button.
Comment 31 Markus Keller CLA 2014-07-28 13:17:44 EDT
Created attachment 245451 [details]
I20140722-0800

(In reply to Eric Moffatt from comment #7)
> - We don't manage the overlay images correctly in that they get a white
> (rather then transparent) background when adorned).

Still broken, see screenshot. ResourceUtility#adornImage(..) is too simple. Better use org.eclipse.ui.internal.OverlayIcon or another class using org.eclipse.jface.resource.CompositeImageDescriptor#drawImage(ImageData, int, int).

(In reply to Dani Megert from comment #24)
> - Pin Editor icon does not appear in toolbar
>   ==> pinning not possible via UI, one has to define a key binding and use
>       that shortcut

The "Pin Editor" toolbar button actually appears after a restart and then works fine. It just doesn't show/hide when the preference is toggled.
Comment 32 Markus Keller CLA 2014-07-28 13:19:27 EDT
*** Bug 436009 has been marked as a duplicate of this bug. ***
Comment 33 Dani Megert CLA 2014-09-05 09:54:31 EDT
*** Bug 418231 has been marked as a duplicate of this bug. ***
Comment 34 Andrey Loskutov CLA 2015-03-19 17:52:37 EDT
(In reply to Dani Megert from comment #0)
> 4.2.
> 
> The indication/decoration for pinned editor is gone in 4.x.

4.5 M6 I20150318-2000: after the fix for bug 445538 the decoration/button appear properly, so we can close this issue...

... BUT as soon as few editors are hidden and the editor list is shown by clicking on the tab chevron, the *entire* icons (not just decorations) of visible *pinned* editors are disposed. I've opened bug 462613 for it.
Comment 35 Martin Oberhuber CLA 2016-04-22 05:11:57 EDT
Setting target milestone (In reply to Andrey Loskutov from comment #34)
> 4.5 M6 I20150318-2000: after the fix for bug 445538 the decoration/button
> appear properly, so we can close this issue...

Setting target milestone accordingly to 4.5M6. Remaining issue is tracked in https://bugs.eclipse.org/bugs/show_bug.cgi?id=462613 separately.