Bug 277836 [Compatibility] Setup Compatibility so you can run tests Create a toolbar so the ConsoleView can come up
diff --git a/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/e4/extensions/LegacyViewFactory.java b/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/e4/extensions/LegacyViewFactory.java index 669561c..a0a693a 100644 --- a/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/e4/extensions/LegacyViewFactory.java +++ b/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/e4/extensions/LegacyViewFactory.java
@@ -14,6 +14,7 @@ import org.eclipse.e4.ui.services.IServiceConstants; import org.eclipse.e4.workbench.ui.internal.UISchedulerStrategy; import org.eclipse.e4.workbench.ui.renderers.swt.SWTPartFactory; +import org.eclipse.jface.action.ToolBarManager; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; @@ -187,6 +188,9 @@ ViewSite site = new ViewSite(ref, impl, page); site.setConfigurationElement(viewContribution); impl.init(site, null); + final ToolBarManager tbm = (ToolBarManager) site.getActionBars() + .getToolBarManager(); + /* final ToolBar tb = */tbm.createControl(parent); impl.createPartControl(parent);
diff --git a/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/ui/internal/WorkbenchPage.java index bbe9e10..10642bb 100644 --- a/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/ui/internal/WorkbenchPage.java +++ b/bundles/org.eclipse.e4.ui.workbench.fragment/src/org/eclipse/ui/internal/WorkbenchPage.java
@@ -960,7 +960,7 @@ } public IEditorPart[] getDirtyEditors() { - return null; + return new IEditorPart[0]; } public ISaveablePart[] getDirtyParts() { @@ -1551,16 +1551,41 @@ MPerspective<?> curPersp = (MPerspective<?>) e4Window.getActiveChild(); MPart ea = ModeledPageLayout.findPart(curPersp, ModeledPageLayout .internalGetEditorArea()); - MContributedPart<MPart<?>> editorPart = ApplicationFactory.eINSTANCE - .createMContributedPart(); - editorPart.setId(editorID); - editorPart.setName(input.getName()); - ea.getChildren().add(editorPart); - editorPart.getContext().set(IEditorInput.class.getName(), input); + MContributedPart<MPart<?>> editorPart = findEditor(ea, editorID, input); + if (editorPart == null) { + editorPart = ApplicationFactory.eINSTANCE.createMContributedPart(); + editorPart.setId(editorID); + editorPart.setName(input.getName()); + ea.getChildren().add(editorPart); + editorPart.getContext().set(IEditorInput.class.getName(), input); + } ea.setActiveChild(editorPart); return (IEditorPart) editorPart.getObject(); } + /** + * @param ea + * @param editorID + * @param input2 + * @return + */ + private MContributedPart<MPart<?>> findEditor(MPart ea, String editorID, + IEditorInput input) { + final Iterator i = ea.getChildren().iterator(); + while (i.hasNext()) { + MContributedPart<MPart<?>> part = (MContributedPart<MPart<?>>) i + .next(); + if (editorID.equals(part.getId())) { + IEditorInput e = (IEditorInput) part.getContext().get( + IEditorInput.class.getName()); + if (input.equals(e)) { + return part; + } + } + } + return null; + } + /* * Added to fix Bug 178235 [EditorMgmt] DBCS 3.3 - Cannot open file with * external program. Opens a new editor using the given input and
diff --git a/examples/org.eclipse.e4.ui.examples.legacy.workbench/src/org/eclipse/e4/ui/examples/legacy/workbench/TestPerspectiveFactory.java b/examples/org.eclipse.e4.ui.examples.legacy.workbench/src/org/eclipse/e4/ui/examples/legacy/workbench/TestPerspectiveFactory.java index bb570b0..633c335 100755 --- a/examples/org.eclipse.e4.ui.examples.legacy.workbench/src/org/eclipse/e4/ui/examples/legacy/workbench/TestPerspectiveFactory.java +++ b/examples/org.eclipse.e4.ui.examples.legacy.workbench/src/org/eclipse/e4/ui/examples/legacy/workbench/TestPerspectiveFactory.java
@@ -17,14 +17,14 @@ folder.addPlaceholder("org.eclipse.ui.navigator.ProjectExplorer"); //$NON-NLS-1$ IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$ -// outputfolder.addView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW); outputfolder.addView("org.eclipse.jdt.ui.JavadocView"); //$NON-NLS-1$ outputfolder.addView("org.eclipse.team.ccvs.ui.RepositoriesView"); //$NON-NLS-1$ outputfolder.addView("org.eclipse.debug.ui.DebugView"); //$NON-NLS-1$ // outputfolder.addView("org.eclipse.jdt.ui.SourceView"); //$NON-NLS-1$ // outputfolder.addPlaceholder("org.eclipse.search.ui.views.SearchView"); //$NON-NLS-1$ -// outputfolder.addPlaceholder("org.eclipse.ui.console.ConsoleView"); //$NON-NLS-1$ + outputfolder.addPlaceholder("org.eclipse.ui.console.ConsoleView"); //$NON-NLS-1$ + outputfolder.addView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ // outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS); outputfolder.addPlaceholder("org.eclipse.ui.views.ProgressView"); //$NON-NLS-1$ //