Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 392149 - Window->New Editor is not enabled sometimes
Summary: Window->New Editor is not enabled sometimes
Status: CLOSED DUPLICATE of bug 394336
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Daniel Rolka CLA
QA Contact:
URL:
Whiteboard: candidate43
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-17 06:03 EDT by Toshihiro Izumi CLA
Modified: 2013-05-23 09:34 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toshihiro Izumi CLA 2012-10-17 06:03:10 EDT
1. Window->New Editor is disabled sometimes when a text editor is opened.
 It is hard to reproduce. If you cannot see the disabled menu-item, try closing/reopening the editor again and again, or right-click->Open instead of double-click. I cannot figure out the exact steps to reproduce.

2. In this situation, Window->New Editor is enabled after open-and-close any dialog such as 'Customize Perspective' or 'Preferences' or 'Find/Replace' or such.

Eclipse Platform
Version: 4.2.1
Build id: M20120914-1800
(eclipse-platform-4.2.1-win32.zip)
Comment 1 Paul Webster CLA 2012-10-17 07:35:01 EDT
I was able to reproduce (at least one) by closing all the editors and opening the text-based properties editor.  New editor in the Window menu was disabled.

Opening "Open Resources" dialog and closing it enabled it

PW
Comment 2 Toshihiro Izumi CLA 2012-11-29 19:44:07 EST
FWIW, File->Close has same malfunction because both of them have same definition in org.eclipse.ui.

  <handler
        class="org.eclipse.ui.internal.handlers.NewEditorHandler"
        commandId="org.eclipse.ui.window.newEditor">
     <enabledWhen>
        <with
              variable="activeEditor">
           <instanceof
                 value="org.eclipse.ui.IEditorPart">
           </instanceof>
        </with>
     </enabledWhen>
  </handler>

  <handler
        class="org.eclipse.ui.internal.CloseEditorHandler"
        commandId="org.eclipse.ui.file.close">
     <enabledWhen>
        <with
              variable="activeEditor">
           <instanceof
                 value="org.eclipse.ui.IEditorPart">
           </instanceof>
        </with>
     </enabledWhen>
  </handler>

EvaluationService works fine, org.eclipse.ui.internal.handlers.HandlerProxy.getEnablementListener().new IPropertyChangeListener() {...}.propertyChange(PropertyChangeEvent) is called properly.
However, after that, following methods are called.

org.eclipse.e4.core.commands.internal.HandlerServiceImpl.canExecute(ParameterizedCommand, IEclipseContext)
->org.eclipse.ui.internal.handlers.E4HandlerProxy.canExecute(IEclipseContext, IEvaluationContext)
->org.eclipse.ui.internal.handlers.HandlerProxy.setEnabled(Object)
->org.eclipse.core.internal.expressions.WithExpression.evaluate(IEvaluationContext)
->org.eclipse.e4.ui.workbench.modeling.ExpressionContext.getVariable(String)

At ExpressionContext.getVariable()
>Object obj = eclipseContext.getActive(name);
getActive() returns null. (though get() returns correct value)
Comment 3 Daniel Rolka CLA 2013-05-23 07:09:39 EDT
Unfortunately I'm not able to recreate the issue. I was using the build I20130516-2200-win32-x86_64 during my tests. Do we still have this issue or we can close this bug?

thanks,
Daniel
Comment 4 Toshihiro Izumi CLA 2013-05-23 08:51:29 EDT
Sorry, this is duplicate of bug 394336 and 407085. I believe this was fixed with bug 407085. I cannot reproduce this issue on Kepler RC1 Build id: I20130516-2200.
Thanks.
Comment 5 Paul Webster CLA 2013-05-23 09:34:53 EDT
Yes, I think that's the same underlying cause.

PW

*** This bug has been marked as a duplicate of bug 394336 ***