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

Bug 178914

Summary: [Trim] Maximize/restore on new presentation makes part lose focus
Product: [Eclipse Project] Platform Reporter: Willian Mitsuda <wmitsuda>
Component: UIAssignee: Eric Moffatt <emoffatt>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: andrej, eclipse, irbull, js102, prashant.deva
Version: 3.3   
Target Milestone: 3.3 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Willian Mitsuda CLA 2007-03-22 18:25:03 EDT
Eclipse 3.3 I20070322-0950 - new presentation:

If you maximize/restore some workbench part, lets say, the current editor for example, it loses the focus on restore, transferring it to another view stack.

This leads to a funny behavior, where a sequence of Ctrl+M's makes the focus cycle through all part stacks of perpective.
Comment 1 Eric Moffatt CLA 2007-03-24 23:41:37 EDT
Good one...
Comment 2 James Shaw CLA 2007-03-26 05:04:26 EDT
Occurs on linux/gtk2 also, with eclipse 3.3M6.
Comment 3 Eric Moffatt CLA 2007-03-26 09:39:41 EDT
Committed in >20070326.

Now only activates the view if the stack itself is restored (i.e. doesn't activate on 'unzoom').
Comment 4 Eric Moffatt CLA 2007-03-27 09:59:28 EDT
*** Bug 179341 has been marked as a duplicate of this bug. ***
Comment 5 Willian Mitsuda CLA 2007-03-27 14:15:01 EDT
Eric, there is more issue that I'm not sure if is related to this bug, when you type Ctrl+M 3 times, with focus on editor, so the focus will stay on some random view maximized.

On this state, type F12 to move the focus back to editor. The focus will go back, but the view won't be restored.

Also, sometimes when trying this, I got the following exception:

eclipse.buildId=I20070321-0010
java.version=1.6.0
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=pt_BR
Framework arguments:  -startup C:\eclipse-3.3-I20070321-0010\plugins\org.eclipse.equinox.launcher_1.0.0.v20070318.jar
Command-line arguments:  -os win32 -ws win32 -arch x86 -startup C:\eclipse-3.3-I20070321-0010\plugins\org.eclipse.equinox.launcher_1.0.0.v20070318.jar
This is a continuation of log file C:\eclipse\workspace-dsv-manut\.metadata\.bak_0.log
Created Time: 2007-03-22 11:30:17.193

Error
Tue Mar 27 15:07:11 GMT-03:00 2007
java.lang.NullPointerException

java.lang.NullPointerException
	at org.eclipse.ui.internal.PartStack.smartZoom(PartStack.java:1313)
	at org.eclipse.ui.internal.PartStack.access$4(PartStack.java:1290)
	at org.eclipse.ui.internal.PartStack$3.runWithException(PartStack.java:1425)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:152)
	at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:117)
	at org.eclipse.swt.widgets.Display.syncExec(Display.java:4088)
	at org.eclipse.ui.internal.StartupThreading.runWithoutExceptions(StartupThreading.java:94)
	at org.eclipse.ui.internal.PartStack.setState(PartStack.java:1420)
	at org.eclipse.ui.internal.WorkbenchPage.setState(WorkbenchPage.java:3650)
	at org.eclipse.ui.internal.WorkbenchPage.toggleZoom(WorkbenchPage.java:3722)
	at org.eclipse.ui.internal.MaximizePartAction.run(MaximizePartAction.java:68)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:471)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:424)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:164)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:467)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:791)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:838)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:565)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:507)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:124)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1139)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:937)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:975)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:971)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1285)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3770)
	at org.eclipse.swt.widgets.Tree.WM_CHAR(Tree.java:5194)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3670)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5190)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4342)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2226)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3282)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2337)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2301)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2176)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:463)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:458)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:101)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:146)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:356)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:171)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1141)

Comment 6 Eric Moffatt CLA 2007-03-28 09:58:21 EDT
I'll reopen to investigate...
Comment 7 Eric Moffatt CLA 2007-03-28 10:05:26 EDT
William, can you provide steps leading to the NPE? I've been beating on it (ctrl-M'ing, min/max'ing various stacks and arbitrarily hitting F12 at random times with and without open editors) and can't repro the NPE...
Comment 8 Willian Mitsuda CLA 2007-03-28 17:38:20 EDT
(In reply to comment #7)
> William, can you provide steps leading to the NPE? I've been beating on it
> (ctrl-M'ing, min/max'ing various stacks and arbitrarily hitting F12 at random
> times with and without open editors) and can't repro the NPE...
> 

I'll try to get the steps, the problem is that I don't remember what was the circunstances I got it to happen ;)

Regarding the Ctrl+M 3 times + F12, I presume you had no problems to reproduce, right?
Comment 9 Willian Mitsuda CLA 2007-03-28 17:45:55 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > William, can you provide steps leading to the NPE? I've been beating on it
> > (ctrl-M'ing, min/max'ing various stacks and arbitrarily hitting F12 at random
> > times with and without open editors) and can't repro the NPE...
> > 

Got it; it was quick ;)

- Click on the Package Explorer to make it get the focus.
- Hit Ctrl+M, F12, Ctrl+M.
Comment 10 Eric Moffatt CLA 2007-03-29 08:56:17 EDT
Got it, thanks...on to the fix...
Comment 11 Eric Moffatt CLA 2007-04-05 16:18:04 EDT
*** Bug 180880 has been marked as a duplicate of this bug. ***
Comment 12 Eric Moffatt CLA 2007-04-09 11:02:44 EDT
*** Bug 181229 has been marked as a duplicate of this bug. ***
Comment 13 Eric Moffatt CLA 2007-04-09 15:06:12 EDT
William, I've jsut tried this in preparation for tomorrow's I-build and it now behaves as expected...

first Ctrl-M maximizes the Package Explorer

F12 restores the editor area (actually, it 'restores' the maximized PE) and sets focus to it.

Second Ctrl-M maximized the editor area (since it now has focus).
Comment 14 Willian Mitsuda CLA 2007-04-09 16:34:47 EDT
OK, thanks. I'll try tomorrow I-build.
Comment 15 Andrej Kvasnica CLA 2007-04-09 17:25:10 EDT
I hope it solves also CTRM+M CTRM+M issue reported in bug 180880
Comment 16 Andrej Kvasnica CLA 2007-04-11 10:17:53 EDT
I20070410-1043
0. new java project Test, new java file Test.java, open java file Test.java
1. set focus to file
2. ctrl+m
3. maximized, but focus lost (and should remain in file) - same as in bug 180880
4. set focus to file
5. ctrl+m
6. restored
7. focus remains ok

please reopen this bug, step 3 is buggy
Comment 17 Eric Moffatt CLA 2007-05-01 14:47:46 EDT
Verified in I20070501-0010.