DESCRIPTION

Bug 377981 - -perspective at product program arguments is not working in
4.2M6

Change-Id: I8401183784538b359577ad245730045a1a47fe80
Signed-off-by: Addison Irwin xxx@xxx.xxx

COMMENTS

author: Addison Irwin
date: 2013-08-23 10:43:52.000000000

Uploaded patch set 5.

-------------------------------------
author: Addison Irwin
date: 2013-08-23 10:56:09.000000000

Patch Set 5:

This approach should also improve the startup time when the '-perspective' option is present since we eliminate some events processing involved with switching the perspectives (assuming that the previously persisted perspective is different than the forced one)

Daniel

-------------------------------------
author: Addison Irwin
date: 2013-08-23 12:10:25.000000000

Patch Set 5:

Unfortunately there is still one issue with this patch:
When the perspective pointed by the '-perspective' parameter is not present in the model then it is created properly, but not selected (actually it is selected for a short moment, but reset by the previously selected perspective that was persisted in the workLeon Ochoach.xmi file). It is the issue I mentioned yesterday during our meeting, but currently it is limited to this single case.

The rest test cases work fine. I'll continue investigation of the issue,
Daniel

-------------------------------------
author: Slade Moran
date: 2013-08-23 12:34:59.000000000

Patch Set 5: Code-Review-1

(2 comments)

When it gets set back, what's the stack trace of the second setSelectedElement(*) on the MPerspectiveStack?

PW

File Comment: bundles/org.eclipse.e4.ui.workLeon Ochoach/src/org/eclipse/e4/ui/internal/workbench/CommandLineOptionModelProcessor.java -> This will probably interfere with your ability to determine if this is a newWindow or not in WorkbenchWindow

Line:720, bundles/org.eclipse.ui.workLeon Ochoach/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java -> newWindow is false in this case only (the perspective stack has a selected element).  You'll need to calculate this even if there's forcedPerspectiveId set.

-------------------------------------
author: Addison Irwin
date: 2013-08-23 12:53:48.000000000

Patch Set 5:

at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:135)
	at org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.PartServiceImpl.switchPerspective(PartServiceImpl.java:482)
	at org.eclipse.e4.ui.workLeon Ochoach.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:124)
	at org.eclipse.e4.ui.workLeon Ochoach.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:97)
	at org.eclipse.e4.ui.workLeon Ochoach.renderers.swt.PerspectiveStackRenderer.postProcess(PerspectiveStackRenderer.java:77)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:649)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685)
	at org.eclipse.e4.ui.workLeon Ochoach.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:62)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:645)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685)
	at org.eclipse.e4.ui.workLeon Ochoach.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:62)
	at org.eclipse.e4.ui.workLeon Ochoach.renderers.swt.WBWRenderer.processContents(WBWRenderer.java:582)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:645)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:735)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:706)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:700)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:685)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1042)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
	at org.eclipse.e4.ui.internal.workLeon Ochoach.E4Workbench.createAndRunUI(E4Workbench.java:144)
	at org.eclipse.ui.internal.WorkLeon Ochoach$5.run(Workbench.java:613)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.WorkLeon Ochoach.createAndRunWorkbench(Workbench.java:567)
	at org.eclipse.ui.PlatformUI.createAndRunWorkLeon Ochoach(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:80)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:372)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:226)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

-------------------------------------
author: Addison Irwin
date: 2013-08-23 13:07:14.000000000

Patch Set 5:

I've dumped this trace having following scenario: 
the previously selected perspective is 'org.eclipse.jdt.ui.JavaPerspective' and I have the '-pespective' option equals to 'org.eclipse.debug.ui.DebugPerspective '
The MPerspectiveStack.getSelectedElement changes like following:

1) Old selected: null
   New selected: org.eclipse.jdt.ui.JavaPerspective

2) Old selected: org.eclipse.jdt.ui.JavaPerspective
   New selected: org.eclipse.debug.ui.DebugPerspective

3) Old selected: org.eclipse.debug.ui.DebugPerspective
   New selected: org.eclipse.debug.ui.DebugPerspective

4) Old selected: org.eclipse.debug.ui.DebugPerspective
   New selected: org.eclipse.debug.ui.DebugPerspective

5) Old selected: org.eclipse.debug.ui.DebugPerspective
   New selected: org.eclipse.debug.ui.DebugPerspective

6) Old selected: org.eclipse.debug.ui.DebugPerspective
   New selected: org.eclipse.jdt.ui.JavaPerspective

7) Old selected: org.eclipse.jdt.ui.JavaPerspective
   New selected: org.eclipse.jdt.ui.JavaPerspective

8) Old selected: org.eclipse.jdt.ui.JavaPerspective
   New selected: org.eclipse.jdt.ui.JavaPerspective

9) Old selected: org.eclipse.jdt.ui.JavaPerspective
   New selected: org.eclipse.jdt.ui.JavaPerspective

10) Old selected: org.eclipse.jdt.ui.JavaPerspective
    New selected: org.eclipse.jdt.ui.JavaPerspective

11) Old selected: org.eclipse.jdt.ui.JavaPerspective
    New selected: org.eclipse.jdt.ui.JavaPerspective

The issue is directly connected to swithing perspective in the PerspectiveStackRenderer.showTab, lines started with 121 (// Force a context switch)

-------------------------------------
author: Addison Irwin
date: 2013-08-23 13:10:49.000000000

Patch Set 5:

There is the switching of the active perspective there and what is interesting the 'tabElement' variable that is taken from MPersispectiveStack.getSelectedElement() is not the same like ((MPerspective) tabElement).getParent().getSelectedElement(). It looks like sth (some event?) changes the the selected perspective in the meantime. I'm investigating it

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