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

Bug 279132

Summary: [Design] Design disregards main menu items' disability and visibility
Product: [RT] RAP Reporter: Hasan Ceylan <hceylan>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 1.2   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch for menu items disability and visibility
none
Cleaner solution
none
coolbar solution none

Description Hasan Ceylan CLA 2009-06-04 12:27:09 EDT
Build ID: Head

Steps To Reproduce:
1. Start a workbench application
2. Make some menu items change their disability and visibility state with plugin.xml expressions and Handler's isEnabled implementation 
3. observe that menu item is shown and is enable all the times


More information:
Workbench uses various instruments to control menu items disability and visibility.
AFAIK those are:
1) Expressions framework in the plugin.xml  (ie: visiblewhen etc.) 
2) With VisibleWhen, checkEnabled settings on plugin.xml menu declarations
3) Returning true and false from the Handlers

Design should respect those implementations

Note: For popup menus we do not use disability but visiblity only based on context of the selection. I cannot comment on disability but at least for the visibility, pop up menus works fine...

Regards,
Hasan Ceylan
Comment 1 Holger Staudacher CLA 2009-06-08 15:35:16 EDT
Created attachment 138602 [details]
Patch for menu items disability and visibility

Hi Hasan,
thanks for reporting this bug. I verified it. If I see this correct, the visibility will only be disregarded in the main menu's popup. So can you please try out the attached patch and report if the bug is fixed with this patch? Thank you.

Regards Holger
Comment 2 Holger Staudacher CLA 2009-06-09 14:50:52 EDT
Created attachment 138705 [details]
Cleaner solution

Hi,
I attached a cleaner solution.
Comment 3 Rüdiger Herrmann CLA 2009-06-12 06:18:40 EDT
+1 for the second patch
Comment 4 Holger Staudacher CLA 2009-06-13 03:44:02 EDT
committed
Comment 5 Hasan Ceylan CLA 2009-06-15 12:15:35 EDT
Hello,

Thanks for the update. The menu item visibility problem has been resolved.

But I hate to say that the same problem applies to the coolbar...

Hasan
Comment 6 Holger Staudacher CLA 2009-06-15 12:40:06 EDT
Created attachment 139187 [details]
coolbar solution

The attached solution should fix the visibility for coolbar items. Can you verify this Hasan?
Comment 7 Holger Staudacher CLA 2009-06-15 12:49:25 EDT
I have reopened the bug until the coolbar item visibility was verified.
Comment 8 Rüdiger Herrmann CLA 2009-06-15 12:53:52 EDT
+1 for the "coolbar solution" patch
Comment 9 Holger Staudacher CLA 2009-06-15 13:01:20 EDT
committed.
Comment 10 Hasan Ceylan CLA 2009-06-16 02:31:22 EDT
for some reason handler is null for the action.

Here's the stack trace. Action is declared using the plugin.xml and made available based on "selection" and "instance of" expressions...

Hasan 

java.lang.NullPointerException
	at org.eclipse.rap.internal.design.example.business.managers.BusinessCoolBarManager$6.widgetSelected(BusinessCoolBarManager.java:691)
	at org.eclipse.swt.events.SelectionEvent.dispatchToObserver(SelectionEvent.java:176)
	at org.eclipse.rwt.internal.events.Event.processEvent(Event.java:44)
	at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.java:125)
	at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.java:165)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.readAndDispatch(RWTLifeCycle.java:244)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:764)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2485)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2444)
	at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2295)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:514)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:497)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
	at com.turquality.server.rap.Application.createUI(Application.java:58)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:231)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:119)
	at java.lang.Thread.run(Thread.java:636)
Comment 11 Rüdiger Herrmann CLA 2009-06-16 03:21:42 EDT
(In reply to comment #10)
> for some reason handler is null for the action.
> Here's the stack trace. Action is declared using the plugin.xml and made
> available based on "selection" and "instance of" expressions...
> Hasan
> 
> java.lang.NullPointerException
> [ ... ]
Hasan,
please file a separate bug and provide some information or code to reproduce the problem.
Rüdiger