aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Suen2011-07-27 14:06:18 (EDT)
committerPaul Webster2011-08-25 10:21:57 (EDT)
commitf5194d51f6d2f6a2a4740c2365591c3edb38f54c (patch)
tree3e65c4eaef50d44792c203edd0318683f3943e34
parent9414773932aabebdf5e4baef82235174d5cd0186 (diff)
downloadeclipse.platform.ui-f5194d51f6d2f6a2a4740c2365591c3edb38f54c.zip
eclipse.platform.ui-f5194d51f6d2f6a2a4740c2365591c3edb38f54c.tar.gz
eclipse.platform.ui-f5194d51f6d2f6a2a4740c2365591c3edb38f54c.tar.bz2
Bug 353240 [Compatibility] IWorkbenchWindow's openPage(String,
IAdaptable) is not implemented correctly The openPage(String, IAdaptable) method needs to open a new workbench window if the current window already has a page open. The current implementation does not do this and instead just changes the perspective of the currently active page. This is causing IWorkbenchPageTest's testClose to fail.
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index a563480..4168245 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -1472,7 +1472,29 @@ public class WorkbenchWindow implements IWorkbenchWindow {
* @see org.eclipse.ui.IWorkbenchWindow#openPage(java.lang.String,
* org.eclipse.core.runtime.IAdaptable)
*/
- public IWorkbenchPage openPage(String perspectiveId, IAdaptable input)
+ public IWorkbenchPage openPage(final String perspectiveId, final IAdaptable input)
+ throws WorkbenchException {
+ final Object[] result = new Object[1];
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ try {
+ result[0] = busyOpenPage(perspectiveId, input);
+ } catch (WorkbenchException e) {
+ result[0] = e;
+ }
+ }
+ });
+
+ if (result[0] instanceof IWorkbenchPage) {
+ return (IWorkbenchPage) result[0];
+ } else if (result[0] instanceof WorkbenchException) {
+ throw (WorkbenchException) result[0];
+ } else {
+ throw new WorkbenchException(WorkbenchMessages.WorkbenchWindow_exceptionMessage);
+ }
+ }
+
+ private IWorkbenchPage busyOpenPage(String perspectiveId, IAdaptable input)
throws WorkbenchException {
IPerspectiveDescriptor descriptor = workbench.getPerspectiveRegistry()
.findPerspectiveWithId(perspectiveId);
@@ -1494,6 +1516,9 @@ public class WorkbenchWindow implements IWorkbenchWindow {
firePageOpened();
partService.setPage(page);
+ } else {
+ IWorkbenchWindow window = getWorkbench().openWorkbenchWindow(perspectiveId, input);
+ return window.getActivePage();
}
perspective = descriptor;