Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339687 - [Compatibility] Checkboxes in nested view menu of 'Variables' view don't seem to persist
Summary: [Compatibility] Checkboxes in nested view menu of 'Variables' view don't seem...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.2 M5   Edit
Assignee: Remy Suen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-11 08:28 EST by Remy Suen CLA
Modified: 2012-01-24 12:37 EST (History)
2 users (show)

See Also:


Attachments
Patch that enables functionality of the view action (1.04 KB, patch)
2011-06-06 09:42 EDT, Praveen CLA
no flags Details | Diff
Final Patch v01 (2.61 KB, patch)
2011-06-10 02:07 EDT, Praveen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-03-11 08:28:53 EST
1. Open the 'Variables' view.
2. Open the view menu > Java > Show References
3. Redo step 2, it is still unselected. In 3.x they are checked menu items.
Comment 1 Remy Suen CLA 2011-03-11 09:45:34 EST
The 'Java' submenu in the 'Debug' view's view menu also has the same problem.
Comment 2 Praveen CLA 2011-06-06 09:42:24 EDT
Created attachment 197394 [details]
Patch that enables functionality of the view action

I have verified that the view action is not functioning as expected (for ex., ShowQualifiedNames in Debug view does not show qualified names in the stack trace) along with the visual representation does not appear checked/selected though they are clicked.

The attached patch addresses the 1st issue - actions are functional now as they respond to user actions. However, they do not render selected. The reason being - when we are about to render the view actions, we are creating a copy of model and all the corresponding operations are based on the 'copied' model (like, if the action is selected, model is also set to selected etc). Since these are View Actions, they are recreated every time when the user open the View actions menu. So is the model being copied every time and thus, the previous state of (copied) model is lost. Due to this the MenuItem always appears unselected though the preference/action is actually selected. I will try to investigate further on this.

I am not sure why do we need to Copy the model every time (at ContributionRecord.mergeIntoModel() line: 113). Meanwhile, can anyone please review this patch and post their comments ?
Comment 3 Praveen CLA 2011-06-10 02:07:08 EDT
Created attachment 197753 [details]
Final Patch v01

Further to my investigation earlier, I have fixed persisting the ViewMenuAction's state. The attached patch should cover all the issues mentioned in my previous comment.
Please review the patch and put up your comments. Thanks.
Comment 4 Praveen CLA 2011-08-05 05:48:44 EDT
*** Bug 351350 has been marked as a duplicate of this bug. ***
Comment 5 Paul Webster CLA 2011-08-08 10:48:07 EDT
(In reply to comment #3)
> Created attachment 197753 [details]
> Final Patch v01
> 

Just a quick comment.  An MMenuContribution can be placed in 2 or more locations.  Each location must have its own copy of an MMenuItem, for example, as each MMenuItem can have only one parent.

Won't stashing the copy in the MMenuContribution/MMenuItem invalidate that constraint?

PW
Comment 6 Remy Suen CLA 2011-09-07 16:22:07 EDT
This causes stuff like 'Show Monitors' to not do anything because the action is always unchecked.

Thread [main] (Suspended (breakpoint at line 803 in ScopedPreferenceStore))	
	ScopedPreferenceStore.setValue(String, boolean) line: 803	
	ToggleBooleanPreferenceAction$1.run() line: 43	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	ShowMonitorThreadInformation(ToggleBooleanPreferenceAction).run(IAction) line: 39	
	ShowMonitorThreadInformation(ViewFilterAction).runWithEvent(IAction, Event) line: 85	
	ActionDelegateHandlerProxy.execute(ExecutionEvent) line: 281	
	E4HandlerProxy.execute(IEclipseContext, Map, Event, IEvaluationContext) line: 68	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 48	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 37	
	Method.invoke(Object, Object...) line: 600	
	MethodRequestor.execute() line: 56	
	InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean) line: 228	
	InjectorImpl.invoke(Object, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 209	
	ContextInjectionFactory.invoke(Object, Class<Annotation>, IEclipseContext, IEclipseContext, Object) line: 123	
	HandlerServiceImpl.executeHandler(ParameterizedCommand, IEclipseContext) line: 161	
	HandledContributionItem.executeItem(Event) line: 717	
	HandledContributionItem.handleWidgetSelection(Event) line: 622	
	HandledContributionItem.access$6(HandledContributionItem, Event) line: 606	
	HandledContributionItem$3.handleEvent(Event) line: 565
Comment 7 Remy Suen CLA 2011-09-29 14:27:03 EDT
Having only one copy in the transient data certainly seems problematic. I was going to say we could store the boolean value of whether it's selected or unselected in the transient data somehow but not quite sure how that would be implemented off-hand.
Comment 8 Remy Suen CLA 2011-09-29 14:37:12 EDT
Comment on attachment 197753 [details]
Final Patch v01

I get a lot of exceptions the moment I open a second workbench window.
Comment 9 Remy Suen CLA 2011-10-05 14:24:11 EDT
(In reply to comment #8)
> Comment on attachment 197753 [details]
> Final Patch v01

Praveen's change to ActionDelegateHandlerProxy is still worthwhile though as it allows actions like the one described by comment 6 to work. So I'm going to release that diff.
Comment 10 Remy Suen CLA 2011-10-05 16:13:01 EDT
(In reply to comment #9)
> (In reply to comment #8)
> > Comment on attachment 197753 [details] [details]
> > Final Patch v01
> 
> Praveen's change to ActionDelegateHandlerProxy is still worthwhile though as it
> allows actions like the one described by comment 6 to work. So I'm going to
> release that diff.

Pushed to R4_development. Thanks, Praveen!
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R4_development&id=3d21705d5007efb9915b8c2f01a650c8e3eda618
Comment 11 Remy Suen CLA 2011-10-12 14:48:01 EDT
Was wondering how the 'Build Automatically menu item works but it seems it's because of our menu bar processing.

Thread [main] (Suspended)	
	MenuHelper.createItem(MApplication, ActionContributionItem) line: 949	
	WorkbenchWindow.fill(MenuManagerRenderer, MMenu, IMenuManager) line: 846	
	WorkbenchWindow.fill(MenuManagerRenderer, MMenu, IMenuManager) line: 835	
	WorkbenchWindow.setup() line: 539	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 601	
	MethodRequestor.execute() line: 56	
	InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 838	
	InjectorImpl.inject(Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 110	
	InjectorImpl.inject(Object, PrimaryObjectSupplier) line: 80	
	ContextInjectionFactory.inject(Object, IEclipseContext) line: 72	
	Workbench.createWorkbenchWindow(IAdaptable, IPerspectiveDescriptor, MWindow, boolean) line: 1213	
	Workbench.openWorkbenchWindow(IAdaptable, IPerspectiveDescriptor, MWindow, boolean) line: 2242	
	Workbench.openWorkbenchWindow(String, IAdaptable) line: 2234	
	OpenInNewWindowHandler.execute(ExecutionEvent) line: 58	
	HandlerProxy.execute(ExecutionEvent) line: 293	
	E4HandlerProxy.execute(IEclipseContext, Map, Event, IEvaluationContext) line: 68
Comment 12 Paul Webster CLA 2011-10-25 16:22:22 EDT
Does this need to be retargetted for M4?
PW
Comment 13 Remy Suen CLA 2011-11-29 10:55:31 EST
(In reply to comment #11)
> Was wondering how the 'Build Automatically menu item works but it seems it's
> because of our menu bar processing.

Note that the 'Build Automatically' menu item is not completely problem-free. See bug 365081.
Comment 15 Remy Suen CLA 2012-01-24 12:37:14 EST
Verified with I20120123-2200 on Windows 7.