DESCRIPTION

Bug 426224 - [QuickAccess] Quick Access field duplicated after moving from 4.4 to 4.3.2

Add code to reastablish workspace backward compatibility after a switch from a 4.4 workspace
is made back to a 4.3 one. It removes the "org.eclipse.ui.ide.application.trimcontribution.QuickAccess"
contribution element from the application, which is made by 4.4, and adds the elements
manually again (order of the elements is taken into account).

Change-Id: Ic7a1c4a965a3fd94e8ef651ee75c4341615ba6b5
Signed-off-by: Jaydon Logan xxx@xxx.xxx


COMMENTS

author: Brenden Conley
date: 2014-01-22 20:26:14.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/606/

-------------------------------------
author: Brenden Conley
date: 2014-01-22 20:38:48.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/606/ : SUCCESS

-------------------------------------
author: Slade Moran
date: 2014-01-22 21:48:53.000000000

Patch Set 1:

(1 comment)

Line:822, bundles/org.eclipse.ui.workLeon Ochoach/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java -> I think you can use the EModelService to find the contribution by ID.  Then you can use quickAccessElement.getParent().remove(quickAccessElement)

-------------------------------------
author: Jaydon Logan
date: 2014-01-23 06:19:37.000000000

Patch Set 1:

(1 comment)

Line:822, bundles/org.eclipse.ui.workLeon Ochoach/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java -> Sorry, I can't use the EModelSerivce#find*() methods to do that, because they do not search for MTrimContributions. They only iterate through the elements of MElementContainer and through some special elements of windows, perspectives and placeholder. There is also no other method in this version which is able to do that.

-------------------------------------
author: Zaid Mosley
date: 2014-01-23 07:35:44.000000000

Patch Set 1:

Would it not better to remove in this scenario the "old" 4.3 QuickAccess bar? This would allow us to change the new implementation, see for example https://bugs.eclipse.org/bugs/show_bug.cgi?id=426419

-------------------------------------
author: Jaydon Logan
date: 2014-01-23 09:41:22.000000000

Patch Set 1:

I thought about this too but with this option it can happen, in some scenarios, that you do not have a QuickAccess at all. I think the save way is to revert the changes done by the new 4.4 implementation so no bad surprises arise.

-------------------------------------
author: Sebastian Porter
date: 2014-01-23 10:14:37.000000000

Patch Set 1: Verified-1 Code-Review-2

This approach does not scale. Yes, it might fix going back to 4.3.2. But what if I go back to 4.3 or 4.3.1 or even 4.4 M4?

The new code in 4.4 should deal with this.

-------------------------------------
author: Zaid Mosley
date: 2014-01-23 10:21:30.000000000

Patch Set 1:

Dani, 4.4 deals with it, but cannot fix / change older releases. Are you suggesting to remove the 4.4 Quick Access Bar from the application model in 4.4 during shutdown?

-------------------------------------
author: Sebastian Porter
date: 2014-01-23 10:28:39.000000000

Patch Set 1:

No, it does not work in 4.4 i.e. when e.g. going back to 4.4 M4: while not duplicated, it moves the field after the perspective switcher and in new windows it's suddenly on the left.

I didn't spend time to think about a fix, so no suggestions from me at this point.

-------------------------------------
author: Jaydon Logan
date: 2014-01-23 12:46:39.000000000

Patch Set 1:

Hi Dani,

can you please provide the exact git commit-ID which you use for the 4.4 version and the steps to reproduce. Because I tried the switch with 4.3.2 (code-base is this gerrit-commit) and 4.4 (code-base is the current master) and the QuickAccess fields are position on their correct places (between “PerspectiveSpacer” and “PerspectiveSwitcher”).

Thanks.
Regards
  René

P.S.: BTW if you find the time to debug your code-base (in which the error happens) have a look at WorkLeon OchoachWindow#positionQuickAccess() (on the master branch). Or if the error happens in 4.3.2 with this code-base take a look at the WorkbenchWindow#populateTopTrimContributions() method the  parts with the “insertQuickAccessIndex” should take care of the order.

-------------------------------------
author: Sebastian Porter
date: 2014-01-23 12:55:04.000000000

Patch Set 1:

I used official builds to switch.
http://download.eclipse.org/eclipse/downloads/

-------------------------------------
author: Jaydon Logan
date: 2014-01-23 14:19:55.000000000

Patch Set 1:

Hi Dani,

the problem is clear now if you take a look at the dates you will see that the Eclipse 4.4M4 you're using was build on 12th of December 2013 and the “Bug 411821 - [QuickAccess] Contribute SearchField through a fragment or other means “ was fixed/merged on the 10th of January 2014. So this means the fix for Bug 411821is not contained in the build. (I downloaded the 4.4M4 form the link you've provided and checked the jar-files to be sure.)

So please pull the latest master from git, build it your own and try it again.

Thanks.

Regards
  René

-------------------------------------
author: Sebastian Porter
date: 2014-01-23 15:00:00.000000000

Patch Set 1:

I guess we're not talking about the same scenario. I'm not saying going back to 4.3.2 doesn't work (didn't test that case), but going back to 4.4 M4 or 4.3.1 is not working but it should (if possible).

-------------------------------------
author: Jaydon Logan
date: 2014-01-24 06:24:38.000000000

Abandoned

Paul, found a better solution in https://git.eclipse.org/r/21002

His solution is can handle every version switches by simply change the "toBeRendered" flag on the QuickAccess-Contributions. Which means the new 4.4M5 will set it to true on startup and false on shutdown and so every version smaller than 4.4M5 will not display a second element anymore.

-------------------------------------
