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

Bug 336564

Summary: [Presentations] Helios: ViewPart ToolBar appears Duplicated on RCP View
Product: [Eclipse Project] Platform Reporter: Marco Lopes <marcolopespt>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED FIXED QA Contact: Eric Moffatt <emoffatt>
Severity: normal    
Priority: P3 CC: pwebster, remy.suen
Version: 3.6.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
After Workbench restore none

Description Marco Lopes CLA 2011-02-07 15:46:03 EST
Created attachment 188474 [details]
After Workbench restore

In the view class (extends ViewPart), the toolbar is created as follows:

IToolBarManager toolbarManager = getViewSite().getActionBars().getToolBarManager();
toolbarManager.add(action1);
toolbarManager.add(action2);
toolbarManager.add(...);

What happens?

When the view is opening, the Toolbar is created on the left side (on the title place) and then on the correct side.
[url=http://dl.dropbox.com/u/126065/Imagens/Screens/Colibri_toolbar_bug.jpg]   http://dl.dropbox.com/u/126065/Imagens/Screens/Colibri_toolbar_bug.jpg[/url]

When the view is opened, the "duplicated" left toolbar disappears!
[url=http://dl.dropbox.com/u/126065/Imagens/Screens/Colibri_toolbar_ok.jpg]   http://dl.dropbox.com/u/126065/Imagens/Screens/Colibri_toolbar_ok.jpg[/url]

The worst problem is on the Workbench restore side (and i believe it's related with this behavior): when there is more than one view to restore, a "duplicated" version of the Toolbar of the first view opened is created on the left side of the Workbench itself!!! And it does not go away until i swap to the view under it.

NOTE: This never happened with previous versions of Eclipse.
Comment 1 Remy Suen CLA 2011-02-07 15:54:30 EST
Might be related to bug 329754.
Comment 2 Marco Lopes CLA 2011-02-07 20:48:45 EST
This is the "generic" code i use to open views:

		try{
			IWorkbenchPage activePage=...getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
			
			IViewReference viewreference=activePage.findViewReference(id, secondaryId);
			
			IViewPart view=activePage.showView(id, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
			
			if(viewreference==null){
				/*
				 * initialize
				 * set icon
				 * set title
				 * set focus
				 * etc
				 */
			}

		}catch(PartInitException e){
		}
Comment 3 Eric Moffatt CLA 2011-02-10 13:22:05 EST
Marco, it may well be worth trying this once M6 comes out. While I cannot guarantee that this is a dup of 329754 the scenarios seem similar enough to warrant a try.
Comment 4 Marco Lopes CLA 2011-03-28 06:07:00 EDT
Tested with Indigo Release Build id: 20110319-2305. FIXED.