Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 61089 Details for
Bug 174213
[ViewMgmt] add attribute to close a sticky view in all open perspectives
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
New refactored patch, simplifies WorkbenchPage.java
174213_patch4a.txt (text/plain), 24.16 KB, created by
Matthew Hatem
on 2007-03-16 09:35:44 EDT
(
hide
)
Description:
New refactored patch, simplifies WorkbenchPage.java
Filename:
MIME Type:
Creator:
Matthew Hatem
Created:
2007-03-16 09:35:44 EDT
Size:
24.16 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java,v >retrieving revision 1.50 >diff -u -r1.50 IWorkbenchPreferenceConstants.java >--- Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java 5 Feb 2007 04:33:22 -0000 1.50 >+++ Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java 16 Mar 2007 13:34:28 -0000 >@@ -451,4 +451,16 @@ > * @since 3.3 > */ > public static final String DISABLE_NEW_FAST_VIEW = "disableNewFastView"; //$NON-NLS-1$ >+ >+ /** >+ * A named preference for enabling the 3.2 behavior for closing sticky views. >+ * When not enabled a sticky view is closed in all perspectives when the view is closed. >+ * <p> >+ * The default value for this preference is: <code>false</code>; use the 3.2 >+ * behaviour. >+ * </p> >+ * >+ * @since 3.3 >+ */ >+ public static final String ENABLE_32_STICKY_CLOSE_BEHAVIOR = "ENABLE_32_STICKY_CLOSE_BEHAVIOR"; //$NON-NLS-1$ > } >Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java,v >retrieving revision 1.283 >diff -u -r1.283 WorkbenchPage.java >--- Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 14 Mar 2007 17:08:27 -0000 1.283 >+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java 16 Mar 2007 13:34:31 -0000 >@@ -17,11 +17,9 @@ > import java.util.Collection; > import java.util.Collections; > import java.util.Comparator; >-import java.util.HashMap; > import java.util.HashSet; > import java.util.Iterator; > import java.util.List; >-import java.util.Map; > import java.util.Set; > import java.util.StringTokenizer; > >@@ -109,8 +107,6 @@ > import org.eclipse.ui.model.IWorkbenchAdapter; > import org.eclipse.ui.part.MultiEditor; > import org.eclipse.ui.presentations.IStackPresentationSite; >-import org.eclipse.ui.views.IStickyViewDescriptor; >-import org.eclipse.ui.views.IViewRegistry; > > /** > * A collection of views and editors in a workbench. >@@ -155,6 +151,8 @@ > private PerspectiveDescriptor deferredActivePersp; > > private NavigationHistory navigationHistory = new NavigationHistory(this); >+ >+ private IStickyViewManager stickyViewMan = StickyViewManager.getInstance(this); > > /** > * If we're in the process of activating a part, this points to the new part. >@@ -189,10 +187,6 @@ > } > }; > >- // a mapping of perspectives to a set of stickyviews that have been activated in that perspective. >- // this map is persisted across sessions >- private Map stickyPerspectives = new HashMap(7); >- > private ActionSwitcher actionSwitcher = new ActionSwitcher(); > > private IExtensionTracker tracker; >@@ -1657,7 +1651,7 @@ > > navigationHistory.dispose(); > >- stickyPerspectives.clear(); >+ stickyViewMan.clear(); > > if (tracker != null) { > tracker.close(); >@@ -1686,7 +1680,7 @@ > } > persp.dispose(); > >- stickyPerspectives.remove(persp.getDesc().getId()); >+ stickyViewMan.remove(persp.getDesc().getId()); > } > > /** >@@ -3027,25 +3021,9 @@ > navigationHistory.markEditor(getActiveEditor()); > } > >- IMemento stickyState = memento >- .getChild(IWorkbenchConstants.TAG_STICKY_STATE); >- // restore the sticky activation state >- >- if (stickyState != null) { >- IMemento[] stickyPerspMems = stickyState >- .getChildren(IWorkbenchConstants.TAG_PERSPECTIVE); >- for (int i = 0; i < stickyPerspMems.length; i++) { >- String perspectiveId = stickyPerspMems[i].getID(); >- Set viewState = new HashSet(7); >- stickyPerspectives.put(perspectiveId, viewState); >- IMemento[] viewStateMementos = stickyPerspMems[i] >- .getChildren(IWorkbenchConstants.TAG_VIEW); >- for (int j = 0; j < viewStateMementos.length; j++) { >- viewState.add(viewStateMementos[j].getID()); >- } >- } >- >- } >+ // restore sticky view state >+ stickyViewMan.restore(memento); >+ > return result; > } finally { > String blame = activeDescriptor == null ? pageName : activeDescriptor.getId(); >@@ -3207,22 +3185,10 @@ > navigationHistory.saveState(memento > .createChild(IWorkbenchConstants.TAG_NAVIGATION_HISTORY)); > >- IMemento stickyState = memento >- .createChild(IWorkbenchConstants.TAG_STICKY_STATE); >- // save the sticky activation state >- itr = stickyPerspectives.entrySet().iterator(); >- while (itr.hasNext()) { >- Map.Entry entry = (Map.Entry) itr.next(); >- String perspectiveId = (String) entry.getKey(); >- Set activatedViewIds = (Set) entry.getValue(); >- IMemento perspectiveState = stickyState.createChild( >- IWorkbenchConstants.TAG_PERSPECTIVE, perspectiveId); >- for (Iterator i = activatedViewIds.iterator(); i.hasNext();) { >- String viewId = (String) i.next(); >- perspectiveState.createChild(IWorkbenchConstants.TAG_VIEW, >- viewId); >- } >- } >+ >+ // save the sticky activation state >+ stickyViewMan.save(memento); >+ > return result; > } > >@@ -3385,34 +3351,9 @@ > // Update the window > window.updateActionSets(); > >- if (newPersp != null && oldPersp != null) { >- Set activatedStickyViewsInThisPerspective = (Set) stickyPerspectives.get(newPersp.getDesc().getId()); >- if (activatedStickyViewsInThisPerspective == null) { >- activatedStickyViewsInThisPerspective = new HashSet(7); >- stickyPerspectives.put(newPersp.getDesc().getId(), activatedStickyViewsInThisPerspective); >- } >- >- IViewRegistry viewReg = WorkbenchPlugin.getDefault() >- .getViewRegistry(); >- IStickyViewDescriptor[] stickyDescs = viewReg.getStickyViews(); >- for (int i = 0; i < stickyDescs.length; i++) { >- final String viewId = stickyDescs[i].getId(); >- try { >- // show a sticky view if it was in the last perspective and hasn't already been activated in this one >- if (oldPersp.findView(viewId) != null >- && !activatedStickyViewsInThisPerspective >- .contains(viewId)) { >- showView(viewId, null, >- IWorkbenchPage.VIEW_CREATE); >- activatedStickyViewsInThisPerspective.add(viewId); >- } >- } catch (PartInitException e) { >- WorkbenchPlugin >- .log( >- "Could not open view :" + viewId, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "Could not open view :" + viewId, e)); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- } >- } >+ // Update sticky views >+ stickyViewMan.update(oldPersp, newPersp); >+ > } finally { > window.largeUpdateEnd(); > if (newPersp == null) { >Index: Eclipse UI/org/eclipse/ui/internal/StickyViewManager.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/StickyViewManager.java >diff -N Eclipse UI/org/eclipse/ui/internal/StickyViewManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/StickyViewManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,130 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal; >+ >+import java.util.Set; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchPreferenceConstants; >+import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.internal.util.PrefUtil; >+import org.eclipse.ui.views.IStickyViewDescriptor; >+import org.eclipse.ui.views.IViewRegistry; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class StickyViewManager implements IStickyViewManager { >+ >+ private IWorkbenchPage page; >+ >+ public StickyViewManager(IWorkbenchPage page) { >+ this.page = page; >+ } >+ >+ >+ public static IStickyViewManager getInstance(IWorkbenchPage page) { >+ IStickyViewManager stickyViewMan; >+ IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore(); >+ boolean enable32Behavior = preferenceStore >+ .getBoolean(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR); >+ if (enable32Behavior) >+ stickyViewMan = new StickyViewManager32(page); >+ else >+ stickyViewMan = new StickyViewManager(page); >+ >+ return stickyViewMan; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.internal.IStickyViewManager#add(java.lang.String, >+ * java.util.Set) >+ */ >+ public void add(String perspectiveId, Set stickyViewSet) { >+ // do nothing >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.internal.IStickyViewManager#clear() >+ */ >+ public void clear() { >+ // do nothing >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.internal.IStickyViewManager#remove(java.lang.String) >+ */ >+ public void remove(String perspectiveId) { >+ // do nothing >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.internal.IStickyViewManager#restore(org.eclipse.ui.IMemento) >+ */ >+ public void restore(IMemento memento) { >+ // do nothing >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.internal.IStickyViewManager#save(org.eclipse.ui.IMemento) >+ */ >+ public void save(IMemento memento) { >+ // do nothing >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.ui.internal.IStickyViewManager#update(org.eclipse.ui.internal.Perspective, >+ * org.eclipse.ui.internal.Perspective) >+ */ >+ public void update(Perspective oldPersp, Perspective newPersp) { >+ IViewRegistry viewReg = WorkbenchPlugin.getDefault().getViewRegistry(); >+ IStickyViewDescriptor[] stickyDescs = viewReg.getStickyViews(); >+ for (int i = 0; i < stickyDescs.length; i++) { >+ final String viewId = stickyDescs[i].getId(); >+ try { >+ // show a sticky view if it was in the last perspective and >+ // hasn't already been activated in this one >+ if (oldPersp.findView(viewId) != null) { >+ page.showView(viewId, null, IWorkbenchPage.VIEW_CREATE); >+ } >+ // remove a view if it's sticky and its not visible in the old >+ // perspective >+ else if (newPersp.findView(viewId) != null >+ && oldPersp.findView(viewId) == null) { >+ page.hideView(newPersp.findView(viewId)); >+ } >+ } catch (PartInitException e) { >+ WorkbenchPlugin >+ .log( >+ "Could not open view :" + viewId, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "Could not open view :" + viewId, e)); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ } >+ } >+ >+} >Index: Eclipse UI/org/eclipse/ui/internal/IStickyViewManager.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/IStickyViewManager.java >diff -N Eclipse UI/org/eclipse/ui/internal/IStickyViewManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/IStickyViewManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal; >+ >+import java.util.Set; >+ >+import org.eclipse.ui.IMemento; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+interface IStickyViewManager { >+ >+ void remove(String perspectiveId); >+ >+ void add(String perspectiveId, Set stickyViewSet); >+ >+ void clear(); >+ >+ void update(Perspective oldPersp, Perspective newPersp); >+ >+ void save(IMemento memento); >+ >+ void restore(IMemento memento); >+ >+} >Index: Eclipse UI/org/eclipse/ui/internal/StickyViewManager32.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/StickyViewManager32.java >diff -N Eclipse UI/org/eclipse/ui/internal/StickyViewManager32.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/StickyViewManager32.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,142 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal; >+ >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.Map; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.views.IStickyViewDescriptor; >+import org.eclipse.ui.views.IViewRegistry; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+class StickyViewManager32 implements IStickyViewManager { >+ >+ // a mapping of perspectives to a set of stickyviews that have been activated in that perspective. >+ // this map is persisted across sessions >+ private Map stickyPerspectives = new HashMap(7); >+ >+ private IWorkbenchPage page; >+ >+ public StickyViewManager32(IWorkbenchPage page) { >+ this.page = page; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IStickyViewManager#remove(java.lang.String) >+ */ >+ public void remove(String pespectiveId) { >+ stickyPerspectives.remove(pespectiveId); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IStickyViewManager#add(java.lang.String, java.util.Set) >+ */ >+ public void add(String pespectiveId, Set stickyViewList) { >+ stickyPerspectives.put(pespectiveId, stickyViewList); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IStickyViewManager#clear() >+ */ >+ public void clear() { >+ stickyPerspectives.clear(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IStickyViewManager#update(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.internal.Perspective, org.eclipse.ui.internal.Perspective) >+ */ >+ public void update(Perspective oldPersp, Perspective newPersp) { >+ if (newPersp != null && oldPersp != null) { >+ Set activatedStickyViewsInThisPerspective = (Set) stickyPerspectives >+ .get(newPersp.getDesc().getId()); >+ if (activatedStickyViewsInThisPerspective == null) { >+ activatedStickyViewsInThisPerspective = new HashSet(7); >+ stickyPerspectives.put(newPersp.getDesc().getId(), >+ activatedStickyViewsInThisPerspective); >+ } >+ IViewRegistry viewReg = WorkbenchPlugin.getDefault() >+ .getViewRegistry(); >+ IStickyViewDescriptor[] stickyDescs = viewReg.getStickyViews(); >+ for (int i = 0; i < stickyDescs.length; i++) { >+ final String viewId = stickyDescs[i].getId(); >+ try { >+ // show a sticky view if it was in the last perspective and hasn't already been activated in this one >+ if (oldPersp.findView(viewId) != null >+ && !activatedStickyViewsInThisPerspective >+ .contains(viewId)) { >+ page.showView(viewId, null, IWorkbenchPage.VIEW_CREATE); >+ activatedStickyViewsInThisPerspective.add(viewId); >+ } >+ } catch (PartInitException e) { >+ WorkbenchPlugin >+ .log( >+ "Could not open view :" + viewId, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "Could not open view :" + viewId, e)); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IStickyViewManager#save(org.eclipse.ui.IMemento) >+ */ >+ public void save(IMemento memento) { >+ IMemento stickyState = memento.createChild(IWorkbenchConstants.TAG_STICKY_STATE); >+ Iterator itr = stickyPerspectives.entrySet().iterator(); >+ while (itr.hasNext()) { >+ Map.Entry entry = (Map.Entry) itr.next(); >+ String perspectiveId = (String) entry.getKey(); >+ Set activatedViewIds = (Set) entry.getValue(); >+ IMemento perspectiveState = stickyState.createChild( >+ IWorkbenchConstants.TAG_PERSPECTIVE, perspectiveId); >+ for (Iterator i = activatedViewIds.iterator(); i.hasNext();) { >+ String viewId = (String) i.next(); >+ perspectiveState.createChild(IWorkbenchConstants.TAG_VIEW, >+ viewId); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.internal.IStickyViewManager#restore(org.eclipse.ui.IMemento) >+ */ >+ public void restore(IMemento memento) { >+ // restore the sticky activation state >+ IMemento stickyState = memento >+ .getChild(IWorkbenchConstants.TAG_STICKY_STATE); >+ >+ if (stickyState != null) { >+ IMemento[] stickyPerspMems = stickyState >+ .getChildren(IWorkbenchConstants.TAG_PERSPECTIVE); >+ for (int i = 0; i < stickyPerspMems.length; i++) { >+ String perspectiveId = stickyPerspMems[i].getID(); >+ Set viewState = new HashSet(7); >+ stickyPerspectives.put(perspectiveId, viewState); >+ IMemento[] viewStateMementos = stickyPerspMems[i] >+ .getChildren(IWorkbenchConstants.TAG_VIEW); >+ for (int j = 0; j < viewStateMementos.length; j++) { >+ viewState.add(viewStateMementos[j].getID()); >+ } >+ } >+ } >+ } >+} >#P org.eclipse.ui >Index: src/org/eclipse/ui/internal/UIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui/src/org/eclipse/ui/internal/UIPreferenceInitializer.java,v >retrieving revision 1.39 >diff -u -r1.39 UIPreferenceInitializer.java >--- src/org/eclipse/ui/internal/UIPreferenceInitializer.java 15 Mar 2007 18:29:53 -0000 1.39 >+++ src/org/eclipse/ui/internal/UIPreferenceInitializer.java 16 Mar 2007 13:34:32 -0000 >@@ -150,6 +150,9 @@ > > // By default the Fast View Bar allows to select a new fast view from the view list > node.putBoolean(IWorkbenchPreferenceConstants.DISABLE_NEW_FAST_VIEW, false); >+ >+ // Default the sticky view close behaviour to the new style >+ node.putBoolean(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, false); > > IEclipsePreferences rootNode = (IEclipsePreferences) Platform > .getPreferencesService().getRootNode() >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/intro/IntroTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/intro/IntroTest.java,v >retrieving revision 1.12 >diff -u -r1.12 IntroTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/intro/IntroTest.java 8 May 2006 20:51:32 -0000 1.12 >+++ Eclipse UI Tests/org/eclipse/ui/tests/intro/IntroTest.java 16 Mar 2007 13:34:33 -0000 >@@ -10,16 +10,19 @@ > *******************************************************************************/ > package org.eclipse.ui.tests.intro; > >+import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.ui.IPerspectiveDescriptor; > import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchPreferenceConstants; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.internal.Workbench; > import org.eclipse.ui.internal.WorkbenchPlugin; > import org.eclipse.ui.internal.WorkbenchWindow; > import org.eclipse.ui.internal.intro.IIntroConstants; > import org.eclipse.ui.internal.intro.IntroDescriptor; >+import org.eclipse.ui.internal.util.PrefUtil; > import org.eclipse.ui.intro.IIntroManager; > import org.eclipse.ui.intro.IIntroPart; > import org.eclipse.ui.tests.api.PerspectiveWithFastView; >@@ -115,6 +118,74 @@ > assertTrue(workbench.getIntroManager().closeIntro(part)); > assertNull(workbench.getIntroManager().getIntro()); > } >+ >+ /** >+ * Open the intro, change perspective, close the intro >+ * and ensure that the intro has not been closed in the >+ * other perspective. >+ * See bug 174213 >+ */ >+ public void testPerspectiveChangeWithCloseAllPrefFalse() { >+ IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore(); >+ preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, "true"); >+ >+ IWorkbench workbench = window.getWorkbench(); >+ IIntroPart part = workbench.getIntroManager().showIntro(window, false); >+ assertNotNull(part); >+ IWorkbenchPage activePage = window.getActivePage(); >+ IPerspectiveDescriptor oldDesc = activePage.getPerspective(); >+ activePage.setPerspective(WorkbenchPlugin.getDefault() >+ .getPerspectiveRegistry().findPerspectiveWithId( >+ "org.eclipse.ui.tests.api.SessionPerspective")); >+ >+ IViewPart viewPart = window.getActivePage().findView( >+ IIntroConstants.INTRO_VIEW_ID); >+ assertNotNull(viewPart); >+ >+ window.getActivePage().hideView(viewPart); >+ viewPart = window.getActivePage().findView( >+ IIntroConstants.INTRO_VIEW_ID); >+ assertNull(viewPart); >+ >+ activePage.setPerspective(oldDesc); >+ viewPart = window.getActivePage().findView( >+ IIntroConstants.INTRO_VIEW_ID); >+ assertNotNull(viewPart); >+ >+ preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, "false"); >+ } >+ >+ /** >+ * Open the intro, change perspective, close the intro >+ * and ensure that the intro has been closed in the >+ * other perspective. >+ * See bug 174213 >+ */ >+ public void testPerspectiveChangeWithCloseAllPrefTrue() { >+ IWorkbench workbench = window.getWorkbench(); >+ IIntroPart part = workbench.getIntroManager().showIntro(window, false); >+ assertNotNull(part); >+ IWorkbenchPage activePage = window.getActivePage(); >+ IPerspectiveDescriptor oldDesc = activePage.getPerspective(); >+ activePage.setPerspective(WorkbenchPlugin.getDefault() >+ .getPerspectiveRegistry().findPerspectiveWithId( >+ "org.eclipse.ui.tests.api.SessionPerspective")); >+ >+ IViewPart viewPart = window.getActivePage().findView( >+ IIntroConstants.INTRO_VIEW_ID); >+ assertNotNull(viewPart); >+ >+ window.getActivePage().hideView(viewPart); >+ viewPart = window.getActivePage().findView( >+ IIntroConstants.INTRO_VIEW_ID); >+ assertNull(viewPart); >+ >+ activePage.setPerspective(oldDesc); >+ viewPart = window.getActivePage().findView( >+ IIntroConstants.INTRO_VIEW_ID); >+ assertNull(viewPart); >+ >+ } > > public void testPerspectiveReset() { > IWorkbench workbench = window.getWorkbench();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 174213
:
60756
|
60944
|
61000
|
61085
|
61089
|
61168