|
Lines 10-25
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.ui.tests.intro; |
11 |
package org.eclipse.ui.tests.intro; |
| 12 |
|
12 |
|
|
|
13 |
import org.eclipse.jface.preference.IPreferenceStore; |
| 13 |
import org.eclipse.ui.IPerspectiveDescriptor; |
14 |
import org.eclipse.ui.IPerspectiveDescriptor; |
| 14 |
import org.eclipse.ui.IViewPart; |
15 |
import org.eclipse.ui.IViewPart; |
| 15 |
import org.eclipse.ui.IWorkbench; |
16 |
import org.eclipse.ui.IWorkbench; |
| 16 |
import org.eclipse.ui.IWorkbenchPage; |
17 |
import org.eclipse.ui.IWorkbenchPage; |
|
|
18 |
import org.eclipse.ui.IWorkbenchPreferenceConstants; |
| 17 |
import org.eclipse.ui.IWorkbenchWindow; |
19 |
import org.eclipse.ui.IWorkbenchWindow; |
| 18 |
import org.eclipse.ui.internal.Workbench; |
20 |
import org.eclipse.ui.internal.Workbench; |
| 19 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
21 |
import org.eclipse.ui.internal.WorkbenchPlugin; |
| 20 |
import org.eclipse.ui.internal.WorkbenchWindow; |
22 |
import org.eclipse.ui.internal.WorkbenchWindow; |
| 21 |
import org.eclipse.ui.internal.intro.IIntroConstants; |
23 |
import org.eclipse.ui.internal.intro.IIntroConstants; |
| 22 |
import org.eclipse.ui.internal.intro.IntroDescriptor; |
24 |
import org.eclipse.ui.internal.intro.IntroDescriptor; |
|
|
25 |
import org.eclipse.ui.internal.util.PrefUtil; |
| 23 |
import org.eclipse.ui.intro.IIntroManager; |
26 |
import org.eclipse.ui.intro.IIntroManager; |
| 24 |
import org.eclipse.ui.intro.IIntroPart; |
27 |
import org.eclipse.ui.intro.IIntroPart; |
| 25 |
import org.eclipse.ui.tests.api.PerspectiveWithFastView; |
28 |
import org.eclipse.ui.tests.api.PerspectiveWithFastView; |
|
Lines 115-120
Link Here
|
| 115 |
assertTrue(workbench.getIntroManager().closeIntro(part)); |
118 |
assertTrue(workbench.getIntroManager().closeIntro(part)); |
| 116 |
assertNull(workbench.getIntroManager().getIntro()); |
119 |
assertNull(workbench.getIntroManager().getIntro()); |
| 117 |
} |
120 |
} |
|
|
121 |
|
| 122 |
/** |
| 123 |
* Open the intro, change perspective, close the intro |
| 124 |
* and ensure that the intro has not been closed in the |
| 125 |
* other perspective. |
| 126 |
* See bug 174213 |
| 127 |
*/ |
| 128 |
public void testPerspectiveChangeWithCloseAllPrefFalse() { |
| 129 |
IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore(); |
| 130 |
preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_STICKY_VIEW_CLOSE_IN_ALL, "false"); |
| 131 |
|
| 132 |
IWorkbench workbench = window.getWorkbench(); |
| 133 |
IIntroPart part = workbench.getIntroManager().showIntro(window, false); |
| 134 |
assertNotNull(part); |
| 135 |
IWorkbenchPage activePage = window.getActivePage(); |
| 136 |
IPerspectiveDescriptor oldDesc = activePage.getPerspective(); |
| 137 |
activePage.setPerspective(WorkbenchPlugin.getDefault() |
| 138 |
.getPerspectiveRegistry().findPerspectiveWithId( |
| 139 |
"org.eclipse.ui.tests.api.SessionPerspective")); |
| 140 |
|
| 141 |
IViewPart viewPart = window.getActivePage().findView( |
| 142 |
IIntroConstants.INTRO_VIEW_ID); |
| 143 |
assertNotNull(viewPart); |
| 144 |
|
| 145 |
window.getActivePage().hideView(viewPart); |
| 146 |
viewPart = window.getActivePage().findView( |
| 147 |
IIntroConstants.INTRO_VIEW_ID); |
| 148 |
assertNull(viewPart); |
| 149 |
|
| 150 |
activePage.setPerspective(oldDesc); |
| 151 |
viewPart = window.getActivePage().findView( |
| 152 |
IIntroConstants.INTRO_VIEW_ID); |
| 153 |
assertNotNull(viewPart); |
| 154 |
|
| 155 |
preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_STICKY_VIEW_CLOSE_IN_ALL, "false"); |
| 156 |
} |
| 157 |
|
| 158 |
/** |
| 159 |
* Open the intro, change perspective, close the intro |
| 160 |
* and ensure that the intro has been closed in the |
| 161 |
* other perspective. |
| 162 |
* See bug 174213 |
| 163 |
*/ |
| 164 |
public void testPerspectiveChangeWithCloseAllPrefTrue() { |
| 165 |
IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore(); |
| 166 |
preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_STICKY_VIEW_CLOSE_IN_ALL, "true"); |
| 167 |
|
| 168 |
IWorkbench workbench = window.getWorkbench(); |
| 169 |
IIntroPart part = workbench.getIntroManager().showIntro(window, false); |
| 170 |
assertNotNull(part); |
| 171 |
IWorkbenchPage activePage = window.getActivePage(); |
| 172 |
IPerspectiveDescriptor oldDesc = activePage.getPerspective(); |
| 173 |
activePage.setPerspective(WorkbenchPlugin.getDefault() |
| 174 |
.getPerspectiveRegistry().findPerspectiveWithId( |
| 175 |
"org.eclipse.ui.tests.api.SessionPerspective")); |
| 176 |
|
| 177 |
IViewPart viewPart = window.getActivePage().findView( |
| 178 |
IIntroConstants.INTRO_VIEW_ID); |
| 179 |
assertNotNull(viewPart); |
| 180 |
|
| 181 |
window.getActivePage().hideView(viewPart); |
| 182 |
viewPart = window.getActivePage().findView( |
| 183 |
IIntroConstants.INTRO_VIEW_ID); |
| 184 |
assertNull(viewPart); |
| 185 |
|
| 186 |
activePage.setPerspective(oldDesc); |
| 187 |
viewPart = window.getActivePage().findView( |
| 188 |
IIntroConstants.INTRO_VIEW_ID); |
| 189 |
assertNull(viewPart); |
| 190 |
|
| 191 |
preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_STICKY_VIEW_CLOSE_IN_ALL, "false"); |
| 192 |
} |
| 118 |
|
193 |
|
| 119 |
public void testPerspectiveReset() { |
194 |
public void testPerspectiveReset() { |
| 120 |
IWorkbench workbench = window.getWorkbench(); |
195 |
IWorkbench workbench = window.getWorkbench(); |