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 156419 Details for
Bug 299426
provide tweaklet in o.e.ui.tests to allow e4 compat to run the tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
api test facade v01
apiTestsFacade-v01.txt (text/plain), 23.34 KB, created by
Paul Webster
on 2010-01-18 13:17:14 EST
(
hide
)
Description:
api test facade v01
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2010-01-18 13:17:14 EST
Size:
23.34 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.tests >Index: Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java,v >retrieving revision 1.24 >diff -u -r1.24 IDeprecatedWorkbenchPageTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java 25 May 2009 20:52:54 -0000 1.24 >+++ Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java 18 Jan 2010 18:15:50 -0000 >@@ -23,14 +23,14 @@ > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.ide.IDE; >-import org.eclipse.ui.internal.WorkbenchPage; >-import org.eclipse.ui.internal.registry.IActionSetDescriptor; >+import org.eclipse.ui.internal.tweaklets.Tweaklets; > import org.eclipse.ui.part.FileEditorInput; > import org.eclipse.ui.tests.harness.util.ArrayUtil; > import org.eclipse.ui.tests.harness.util.CallHistory; > import org.eclipse.ui.tests.harness.util.EmptyPerspective; > import org.eclipse.ui.tests.harness.util.FileUtil; > import org.eclipse.ui.tests.harness.util.UITestCase; >+import org.eclipse.ui.tests.helpers.TestFacade; > > public class IDeprecatedWorkbenchPageTest extends UITestCase { > >@@ -39,6 +39,8 @@ > private IWorkbenchWindow fWin; > > private IProject proj; >+ >+ private TestFacade facade; > > public IDeprecatedWorkbenchPageTest(String testName) { > super(testName); >@@ -48,6 +50,7 @@ > super.doSetUp(); > fWin = openTestWindow(); > fActivePage = fWin.getActivePage(); >+ facade = (TestFacade) Tweaklets.get(TestFacade.KEY); > } > > protected void doTearDown() throws Exception { >@@ -801,48 +804,30 @@ > > public void testShowActionSet() { > String id = MockActionDelegate.ACTION_SET_ID; >- WorkbenchPage page = (WorkbenchPage) fActivePage; > >- int totalBefore = page.getActionSets().length; >+ int totalBefore = facade.getActionSetCount(fActivePage); > fActivePage.showActionSet(id); > >- IActionSetDescriptor[] sets = ((WorkbenchPage) fActivePage) >- .getActionSets(); >- boolean found = false; >- for (int i = 0; i < sets.length; i++) >- if (id.equals(sets[i].getId())) >- found = true; >- assertEquals(found, true); >+ facade.assertActionSetId(fActivePage, id, true); > > // check that the method does not add an invalid action set to itself > id = IConstants.FakeID; > fActivePage.showActionSet(id); > >- sets = ((WorkbenchPage) fActivePage).getActionSets(); >- found = false; >- for (int i = 0; i < sets.length; i++) >- if (id.equals(sets[i].getId())) >- found = true; >- assertEquals(found, false); >- assertEquals(page.getActionSets().length, totalBefore + 1); >+ facade.assertActionSetId(fActivePage, id, false); >+ assertEquals(facade.getActionSetCount(fActivePage), totalBefore + 1); > } > > public void testHideActionSet() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; >- int totalBefore = page.getActionSets().length; >+ int totalBefore = facade.getActionSetCount(fActivePage); > > String id = MockWorkbenchWindowActionDelegate.SET_ID; > fActivePage.showActionSet(id); >- assertEquals(page.getActionSets().length, totalBefore + 1); >+ assertEquals(facade.getActionSetCount(fActivePage), totalBefore + 1); > > fActivePage.hideActionSet(id); >- assertEquals(page.getActionSets().length, totalBefore); >+ assertEquals(facade.getActionSetCount(fActivePage), totalBefore); > >- IActionSetDescriptor[] sets = page.getActionSets(); >- boolean found = false; >- for (int i = 0; i < sets.length; i++) >- if (id.equals(sets[i].getId())) >- found = true; >- assertEquals(found, false); >+ facade.assertActionSetId(fActivePage, id, false); > } > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java,v >retrieving revision 1.89 >diff -u -r1.89 IWorkbenchPageTest.java >--- Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java 13 Jan 2010 14:32:15 -0000 1.89 >+++ Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java 18 Jan 2010 18:15:50 -0000 >@@ -56,20 +56,17 @@ > import org.eclipse.ui.commands.ICommandService; > import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.ide.IDE; >-import org.eclipse.ui.internal.Perspective; >-import org.eclipse.ui.internal.SaveableHelper; >-import org.eclipse.ui.internal.WorkbenchPage; > import org.eclipse.ui.internal.WorkbenchPlugin; >-import org.eclipse.ui.internal.registry.IActionSetDescriptor; >+import org.eclipse.ui.internal.tweaklets.Tweaklets; > import org.eclipse.ui.internal.util.Util; > import org.eclipse.ui.navigator.resources.ProjectExplorer; > import org.eclipse.ui.part.FileEditorInput; > import org.eclipse.ui.part.IPage; >-import org.eclipse.ui.tests.PerspectiveState; > import org.eclipse.ui.tests.harness.util.CallHistory; > import org.eclipse.ui.tests.harness.util.EmptyPerspective; > import org.eclipse.ui.tests.harness.util.FileUtil; > import org.eclipse.ui.tests.harness.util.UITestCase; >+import org.eclipse.ui.tests.helpers.TestFacade; > import org.eclipse.ui.texteditor.ITextEditor; > import org.eclipse.ui.views.contentoutline.ContentOutline; > >@@ -132,6 +129,8 @@ > } > }; > >+ private TestFacade facade; >+ > > > public IWorkbenchPageTest(String testName) { >@@ -144,6 +143,7 @@ > fActivePage = fWin.getActivePage(); > logStatus = null; > logCount = 0; >+ facade = (TestFacade) Tweaklets.get(TestFacade.KEY); > Platform.addLogListener(openAndHideListener); > } > >@@ -940,17 +940,16 @@ > new String[] { "init", "createPartControl", "setFocus" })); > assertTrue(!view.equals(view2)); > >- WorkbenchPage page = (WorkbenchPage) fActivePage; >- IViewReference ref = (IViewReference) page.getReference(view); >- IViewReference ref2 = (IViewReference) page.getReference(view2); >- page.addFastView(ref); >- page.addFastView(ref2); >+ IViewReference ref = (IViewReference) fActivePage.getReference(view); >+ IViewReference ref2 = (IViewReference) fActivePage.getReference(view2); >+ facade.addFastView(fActivePage, ref); >+ facade.addFastView(fActivePage, ref2); > >- page.activate(view); >- assertEquals(view, page.getActivePart()); >+ fActivePage.activate(view); >+ assertEquals(view, fActivePage.getActivePart()); > >- page.activate(view2); >- assertEquals(view2, page.getActivePart()); >+ fActivePage.activate(view2); >+ assertEquals(view2, fActivePage.getActivePart()); > } > > /** >@@ -965,14 +964,13 @@ > MockViewPart view2 = (MockViewPart) fActivePage.showView( > MockViewPart.IDMULT, "2", IWorkbenchPage.VIEW_ACTIVATE); > >- WorkbenchPage page = (WorkbenchPage) fActivePage; >- IViewReference ref = (IViewReference) page.getReference(view); >- IViewReference ref2 = (IViewReference) page.getReference(view2); >- page.addFastView(ref); >- page.addFastView(ref2); >+ IViewReference ref = (IViewReference) fActivePage.getReference(view); >+ IViewReference ref2 = (IViewReference) fActivePage.getReference(view2); >+ facade.addFastView(fActivePage, ref); >+ facade.addFastView(fActivePage, ref2); > > IMemento memento = XMLMemento.createWriteRoot("page"); >- page.saveState(memento); >+ facade.saveState(fActivePage, memento); > IMemento persps = memento.getChild("perspectives"); > IMemento persp = persps.getChildren("perspective")[0]; > IMemento[] fastViews = persp.getChild("fastViews").getChildren("view"); >@@ -1055,7 +1053,7 @@ > assertEquals(fActivePage.findView(viewId), null); > > try { >- SaveableHelper.testSetAutomatedResponse(1); // No >+ facade.saveableHelperSetAutomatedResponse(1); // No > view = (SaveableMockViewPart) fActivePage.showView(viewId); > view.setDirty(true); > fActivePage.hideView(view); >@@ -1065,7 +1063,7 @@ > assertTrue(callTrace.contains("dispose")); > assertEquals(fActivePage.findView(viewId), null); > >- SaveableHelper.testSetAutomatedResponse(2); // Cancel >+ facade.saveableHelperSetAutomatedResponse(2); // Cancel > view = (SaveableMockViewPart) fActivePage.showView(viewId); > view.setDirty(true); > fActivePage.hideView(view); >@@ -1075,7 +1073,7 @@ > assertFalse(callTrace.contains("dispose")); > assertEquals(fActivePage.findView(viewId), view); > >- SaveableHelper.testSetAutomatedResponse(0); // Yes >+ facade.saveableHelperSetAutomatedResponse(0); // Yes > view = (SaveableMockViewPart) fActivePage.showView(viewId); > view.setDirty(true); > fActivePage.hideView(view); >@@ -1088,7 +1086,7 @@ > // don't leave the view showing, or the UI will block on window > // close > } finally { >- SaveableHelper.testSetAutomatedResponse(-1); // restore default >+ facade.saveableHelperSetAutomatedResponse(-1); // restore default > // (prompt) > } > } >@@ -1113,7 +1111,7 @@ > assertEquals(fActivePage.findView(UserSaveableMockViewPart.ID), null); > > try { >- SaveableHelper.testSetAutomatedResponse(3); // DEFAULT >+ facade.saveableHelperSetAutomatedResponse(3); // DEFAULT > view = (UserSaveableMockViewPart) fActivePage.showView(viewId); > view.setDirty(true); > view2 = (UserSaveableMockViewPart) fActivePage.showView(viewId, >@@ -1137,8 +1135,8 @@ > // don't leave the view showing, or the UI will block on window > // close > } finally { >- SaveableHelper >- .testSetAutomatedResponse(SaveableHelper.USER_RESPONSE); // restore >+ facade >+ .saveableHelperSetAutomatedResponse(-1); // restore > // default > // (prompt) > } >@@ -1159,7 +1157,7 @@ > assertEquals(fActivePage.findView(UserSaveableSharedViewPart.ID), null); > > try { >- SaveableHelper.testSetAutomatedResponse(3); // DEFAULT >+ facade.saveableHelperSetAutomatedResponse(3); // DEFAULT > UserSaveableSharedViewPart.SharedModel model = new UserSaveableSharedViewPart.SharedModel(); > view = (UserSaveableSharedViewPart) fActivePage.showView(viewId); > view.setSharedModel(model); >@@ -1189,8 +1187,8 @@ > // don't leave the view showing, or the UI will block on window > // close > } finally { >- SaveableHelper >- .testSetAutomatedResponse(SaveableHelper.USER_RESPONSE); // restore >+ facade >+ .saveableHelperSetAutomatedResponse(-1); // restore > // default > // (prompt) > fActivePage.hideView(view); >@@ -1589,49 +1587,31 @@ > > public void testShowActionSet() { > String id = MockActionDelegate.ACTION_SET_ID; >- WorkbenchPage page = (WorkbenchPage) fActivePage; > >- int totalBefore = page.getActionSets().length; >+ int totalBefore = facade.getActionSetCount(fActivePage); > fActivePage.showActionSet(id); > >- IActionSetDescriptor[] sets = ((WorkbenchPage) fActivePage) >- .getActionSets(); >- boolean found = false; >- for (int i = 0; i < sets.length; i++) >- if (id.equals(sets[i].getId())) >- found = true; >- assertEquals(found, true); >+ facade.assertActionSetId(fActivePage, id, true); > > // check that the method does not add an invalid action set to itself > id = IConstants.FakeID; > fActivePage.showActionSet(id); > >- sets = ((WorkbenchPage) fActivePage).getActionSets(); >- found = false; >- for (int i = 0; i < sets.length; i++) >- if (id.equals(sets[i].getId())) >- found = true; >- assertEquals(found, false); >- assertEquals(page.getActionSets().length, totalBefore + 1); >+ facade.assertActionSetId(fActivePage, id, false); >+ assertEquals(facade.getActionSetCount(fActivePage), totalBefore + 1); > } > > public void testHideActionSet() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; >- int totalBefore = page.getActionSets().length; >+ int totalBefore = facade.getActionSetCount(fActivePage); > > String id = MockWorkbenchWindowActionDelegate.SET_ID; > fActivePage.showActionSet(id); >- assertEquals(page.getActionSets().length, totalBefore + 1); >+ assertEquals(facade.getActionSetCount(fActivePage), totalBefore + 1); > > fActivePage.hideActionSet(id); >- assertEquals(page.getActionSets().length, totalBefore); >+ assertEquals(facade.getActionSetCount(fActivePage), totalBefore); > >- IActionSetDescriptor[] sets = page.getActionSets(); >- boolean found = false; >- for (int i = 0; i < sets.length; i++) >- if (id.equals(sets[i].getId())) >- found = true; >- assertEquals(found, false); >+ facade.assertActionSetId(fActivePage, id, false); > } > > /** >@@ -1831,7 +1811,6 @@ > * Test opening a perspective with a fast view. > */ > public void testOpenPerspectiveWithFastView() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; > > try { > fWin.getWorkbench().showPerspective( >@@ -1840,13 +1819,14 @@ > fail("Unexpected WorkbenchException: " + e); > } > >- assertEquals(page.getFastViews().length, 1); >- assertEquals(page.getFastViews()[0].getId(), >+ IViewReference[] fastViews = facade.getFastViews(fActivePage); >+ assertEquals(fastViews.length, 1); >+ assertEquals(fastViews[0].getId(), > "org.eclipse.ui.views.ResourceNavigator"); >- assertEquals(page.getViewReferences().length, 1); >- assertTrue(page.getViewReferences()[0].isFastView()); >+ assertEquals(fActivePage.getViewReferences().length, 1); >+ assertTrue(fActivePage.getViewReferences()[0].isFastView()); > >- IPerspectiveDescriptor persp = page.getPerspective(); >+ IPerspectiveDescriptor persp = fActivePage.getPerspective(); > > ICommandService commandService = (ICommandService) fWorkbench.getService(ICommandService.class); > Command command = commandService.getCommand("org.eclipse.ui.window.closePerspective"); >@@ -1875,7 +1855,6 @@ > * @since 3.1 > */ > public void testOpenPerspectiveWithMultiViewPlaceholdersAtTopLevel() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; > > try { > fWin.getWorkbench().showPerspective( >@@ -1885,8 +1864,7 @@ > fail("Unexpected WorkbenchException: " + e); > } > >- PerspectiveState state = new PerspectiveState(page); >- ArrayList partIds = state.getPartIds(null); >+ ArrayList partIds = facade.getPerspectivePartIds(fActivePage, null); > assertTrue(partIds.contains("*")); > assertTrue(partIds.contains(MockViewPart.IDMULT)); > assertTrue(partIds.contains(MockViewPart.IDMULT + ":secondaryId")); >@@ -1902,7 +1880,6 @@ > * @since 3.1 > */ > public void testOpenPerspectiveWithMultiViewPlaceholdersInPlaceholderFolder() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; > > try { > fWin >@@ -1914,8 +1891,7 @@ > fail("Unexpected WorkbenchException: " + e); > } > >- PerspectiveState state = new PerspectiveState(page); >- ArrayList partIds = state.getPartIds("placeholderFolder"); >+ ArrayList partIds = facade.getPerspectivePartIds(fActivePage,"placeholderFolder"); > assertTrue(partIds.contains("*")); > assertTrue(partIds.contains(MockViewPart.IDMULT)); > assertTrue(partIds.contains(MockViewPart.IDMULT + ":secondaryId")); >@@ -1929,8 +1905,6 @@ > * @since 3.1 > */ > public void testOpenPerspectiveWithMultiViewPlaceholdersInFolder() { >- WorkbenchPage page = (WorkbenchPage) fActivePage; >- > try { > fWin > .getWorkbench() >@@ -1941,8 +1915,7 @@ > fail("Unexpected WorkbenchException: " + e); > } > >- PerspectiveState state = new PerspectiveState(page); >- ArrayList partIds = state.getPartIds("folder"); >+ ArrayList partIds = facade.getPerspectivePartIds(fActivePage,"folder"); > assertTrue(partIds.contains("*")); > assertTrue(partIds.contains(MockViewPart.IDMULT)); > assertTrue(partIds.contains(MockViewPart.IDMULT + ":secondaryId")); >@@ -2121,7 +2094,7 @@ > */ > public void testClosePerspectiveDoesNotPromptBug272070() throws Exception { > try { >- SaveableHelper.testSetAutomatedResponse(2); >+ facade.saveableHelperSetAutomatedResponse(2); > proj = FileUtil > .createProject("testClosePerspectiveDoesNotPromptBug272070"); > >@@ -2177,8 +2150,8 @@ > assertFalse("The view should be hidden", fActivePage > .isPartVisible(view)); > } finally { >- SaveableHelper >- .testSetAutomatedResponse(SaveableHelper.USER_RESPONSE); >+ facade >+ .saveableHelperSetAutomatedResponse(-1); > } > } > >@@ -2227,7 +2200,7 @@ > public void testCloseAllPerspectivesDoesNotPromptBug272070() > throws Exception { > try { >- SaveableHelper.testSetAutomatedResponse(2); >+ facade.saveableHelperSetAutomatedResponse(2); > proj = FileUtil > .createProject("testCloseAllPerspectivesDoesNotPromptBug272070"); > >@@ -2283,8 +2256,8 @@ > assertFalse("The view should be hidden", fActivePage > .isPartVisible(view)); > } finally { >- SaveableHelper >- .testSetAutomatedResponse(SaveableHelper.USER_RESPONSE); >+ facade >+ .saveableHelperSetAutomatedResponse(-1); > } > } > >@@ -2989,16 +2962,14 @@ > fActivePage.setPartState(reference, IWorkbenchPage.STATE_MINIMIZED); > > // since it's minimized, it should be a fast view >- Perspective perspective = ((WorkbenchPage) fActivePage) >- .getActivePerspective(); >- assertTrue("A minimized view should be a fast view", perspective >- .isFastView(reference)); >+ assertTrue("A minimized view should be a fast view", facade >+ .isFastView(fActivePage, reference)); > > // try to restore it > fActivePage.setPartState(reference, IWorkbenchPage.STATE_RESTORED); > // since it's maximized, it should not be a fast view >- assertFalse("A restored view should not be a fast view", perspective >- .isFastView(reference)); >+ assertFalse("A restored view should not be a fast view", facade >+ .isFastView(fActivePage, reference)); > } > > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacade.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacade.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacade.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacade.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 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.tests.helpers; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.IViewReference; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.internal.tweaklets.Tweaklets; >+import org.eclipse.ui.internal.tweaklets.Tweaklets.TweakKey; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public abstract class TestFacade { >+ public static TweakKey KEY = new Tweaklets.TweakKey(TestFacade.class); >+ >+ static { >+ // load the default, but carefully >+ try { >+ Class testClass = TestFacade.class.getClassLoader().loadClass("org.eclipse.ui.tests.helpers.TestFacadeImpl"); >+ Tweaklets.setDefault(TestFacade.KEY, testClass.newInstance()); >+ } catch (ClassNotFoundException e) { >+ // we're in e4 land, that boat won't float >+ } catch (InstantiationException e) { >+ // we're in e4 land, that boat won't float >+ } catch (IllegalAccessException e) { >+ // we're in e4 land, that boat won't float >+ } >+ } >+ >+ public abstract void assertActionSetId(IWorkbenchPage page, String id, boolean condition); >+ >+ public abstract int getActionSetCount(IWorkbenchPage page); >+ >+ public abstract void addFastView(IWorkbenchPage page, IViewReference ref); >+ >+ public abstract IStatus saveState(IWorkbenchPage page, IMemento memento); >+ >+ public abstract IViewReference[] getFastViews(IWorkbenchPage page); >+ >+ public abstract ArrayList getPerspectivePartIds(IWorkbenchPage page, String folderId); >+ >+ public abstract boolean isFastView(IWorkbenchPage page, IViewReference ref); >+ public abstract void saveableHelperSetAutomatedResponse(int response); >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacadeImpl.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacadeImpl.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacadeImpl.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/helpers/TestFacadeImpl.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,101 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 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.tests.helpers; >+ >+import java.util.ArrayList; >+ >+import junit.framework.Assert; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.IViewReference; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.internal.SaveableHelper; >+import org.eclipse.ui.internal.WorkbenchPage; >+import org.eclipse.ui.internal.registry.IActionSetDescriptor; >+import org.eclipse.ui.tests.PerspectiveState; >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class TestFacadeImpl extends TestFacade { >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see >+ * org.eclipse.ui.tests.helpers.TestFacade#assertActionSetFound(org.eclipse >+ * .ui.IWorkbenchPage, java.lang.String) >+ */ >+ public void assertActionSetId(IWorkbenchPage page, String id, boolean condition) { >+ IActionSetDescriptor[] sets = ((WorkbenchPage) page).getActionSets(); >+ boolean found = false; >+ for (int i = 0; i < sets.length && !found; i++) { >+ if (id.equals(sets[i].getId())) { >+ found = true; >+ } >+ } >+ Assert.assertEquals("Failed for " + id, condition, found); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#getActionSetCount(org.eclipse.ui.IWorkbenchPage) >+ */ >+ public int getActionSetCount(IWorkbenchPage page) { >+ return ((WorkbenchPage) page).getActionSets().length; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#addFastView(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IViewReference) >+ */ >+ public void addFastView(IWorkbenchPage page, IViewReference ref) { >+ ((WorkbenchPage) page).addFastView(ref); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#saveState(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IMemento) >+ */ >+ public IStatus saveState(IWorkbenchPage page, IMemento memento) { >+ return ((WorkbenchPage)page).saveState(memento); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#getFastViews(org.eclipse.ui.IWorkbenchPage) >+ */ >+ public IViewReference[] getFastViews(IWorkbenchPage page) { >+ return ((WorkbenchPage)page).getFastViews(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#getPerspectivePartIds(org.eclipse.ui.IWorkbenchPage, java.lang.String) >+ */ >+ public ArrayList getPerspectivePartIds(IWorkbenchPage page, String folderId) { >+ PerspectiveState state = new PerspectiveState(page); >+ return state.getPartIds(folderId); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#isFastView(org.eclipse.ui.IWorkbenchPage, org.eclipse.ui.IViewReference) >+ */ >+ public boolean isFastView(IWorkbenchPage page, IViewReference ref) { >+ return ((WorkbenchPage)page).isFastView(ref); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.helpers.TestFacade#testSetAutomatedResponse(int) >+ */ >+ public void saveableHelperSetAutomatedResponse(int response) { >+ SaveableHelper.testSetAutomatedResponse(response); >+ } >+ >+}
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 299426
:
156399
| 156419 |
158490