Community
Participate
Working Groups
Fails in eclipse 3.1M6 the same code that works fine in 3.1M5a. I want to create a view (from other view) in the placeholder that is not the default placeholder. Example: I work with rcp.browser example. I create a new view that shows a text (a parameter) package org.eclipse.ui.examples.rcp.browser; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.part.ViewPart; public class BlankView extends ViewPart { Label nameLabel; Composite mainPanel; public void createPartControl(Composite parent) { mainPanel = new Composite(parent, SWT.NONE); mainPanel.setLayout(new GridLayout()); nameLabel = new Label(mainPanel, SWT.NONE); } public void setFocus() { // nothing } public void setText(String text) { nameLabel.setText(text); mainPanel.layout(true); } } I create 2 place holder: The left to HistoryView & BlankView and the rigth to browser view. I want that history view is visible always. Modify BrowserPerspectiveFactory.createInitialLayout as : public void createInitialLayout(IPageLayout layout) { layout.addView(IBrowserConstants.BROWSER_VIEW_ID, IPageLayout.RIGHT, .25f, IPageLayout.ID_EDITOR_AREA); IFolderLayout left = layout.createFolder("left", IPageLayout.TOP, 0.3f, IPageLayout.ID_EDITOR_AREA); left.addPlaceholder(IBrowserConstants.BLANK_VIEW_ID); // added constant to IBrowserConstants left.addView(IBrowserConstants.HISTORY_VIEW_ID); IViewLayout historyLayout = layout.getViewLayout(IBrowserConstants.HISTORY_VIEW_ID); historyLayout.setCloseable(true); layout.setEditorAreaVisible(false); } and when HistoryView is created, open the BlankView. This is the HistoryView.createPartControl() public void createPartControl(Composite parent) { viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); drillDownAdapter = new DrillDownAdapter(viewer); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setInput(getViewSite()); makeActions(); hookContextMenu(); hookDoubleClickAction(); // new code added try { BlankView view = (BlankView) getSite().getWorkbenchWindow().getActivePage().showView (IBrowserConstants.BLANK_VIEW_ID); view.setText("Hello world"); } catch (PartInitException exception) { exception.printStackTrace(); } } When HistoryView is created, open the blankView on the left place holder. When i use eclipse 3.1M5a, works fine, but this same code, when use 3.1M6 BlankView & HistoryView are gray views. When click more times on this views, show fine. More: if comment this line left.addPlaceholder(IBrowserConstants.BLANK_VIEW_ID); in BrowserPerspectiveFactory.createInitialLayout the views works fine on the rigth place holder.
Stefan, this is hitting the re-entrant view creation case you mentioned recently: HistoryView's createPartControl method is calling showView to show the BlankView. Getting grey views does not seem like the expected behaviour though (whether in the same stack or not). Either it should fail, or allow the re-entrant creation. Any suggestions?
Should investigate whether there's a real problem here for RC3.
Re-entrant creation is permitted. The only re-entrant creation that is forbidden is when a part attempts to recursively create itself (which - obviously - can't work). I believe the problem here is due to reentrant activation, which is currently not permitted. The expected behavior is that both parts are created properly, but the history view remains active and the workbench logs an exception indicating that an attempt was made to activate blankview while still in the process of activating historyview.
need to investigate why this part is gray for RC3 before requesting approval to fix
Moving to 3.1 RC4 for investigation.
This works for me in Version: 3.1.0 Build id: N20050621-0010. I open the browser example and see both views with the contents correctly. Closing this bug, please re-test and reopen if you disagree.