### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.tests Index: Eclipse JFace Tests/org/eclipse/ui/tests/RCPSessionApplication.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/ui/tests/RCPSessionApplication.java,v retrieving revision 1.1 diff -u -r1.1 RCPSessionApplication.java --- Eclipse JFace Tests/org/eclipse/ui/tests/RCPSessionApplication.java 23 Apr 2009 16:15:29 -0000 1.1 +++ Eclipse JFace Tests/org/eclipse/ui/tests/RCPSessionApplication.java 4 Nov 2010 11:47:02 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 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 @@ -19,10 +19,12 @@ public class RCPSessionApplication implements IApplication { + private boolean windowlessApp = false; + public Object start(IApplicationContext context) throws Exception { Display display = PlatformUI.createDisplay(); try { - PlatformUI.createAndRunWorkbench(display, new RCPTestWorkbenchAdvisor()); + PlatformUI.createAndRunWorkbench(display, new RCPTestWorkbenchAdvisor(windowlessApp)); } finally { if (display != null) display.dispose(); @@ -42,4 +44,12 @@ } }); } + + /** + * @param windowlessApp The windowlessApp to set. + */ + public void setWindowlessApp(boolean windowlessApp) { + this.windowlessApp = windowlessApp; + } + } \ No newline at end of file Index: Eclipse JFace Tests/org/eclipse/ui/tests/WindowlessRCPApplication.java =================================================================== RCS file: Eclipse JFace Tests/org/eclipse/ui/tests/WindowlessRCPApplication.java diff -N Eclipse JFace Tests/org/eclipse/ui/tests/WindowlessRCPApplication.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Eclipse JFace Tests/org/eclipse/ui/tests/WindowlessRCPApplication.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +/******************************************************************************* + * 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; + + +public class WindowlessRCPApplication extends RCPSessionApplication { + + public WindowlessRCPApplication() { + setWindowlessApp(true); + } + +} \ No newline at end of file Index: Eclipse UI Tests/org/eclipse/ui/tests/session/SessionTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/session/SessionTests.java,v retrieving revision 1.22 diff -u -r1.22 SessionTests.java --- Eclipse UI Tests/org/eclipse/ui/tests/session/SessionTests.java 23 Apr 2009 16:15:29 -0000 1.22 +++ Eclipse UI Tests/org/eclipse/ui/tests/session/SessionTests.java 4 Nov 2010 11:47:05 -0000 @@ -17,6 +17,7 @@ import junit.framework.Test; import junit.framework.TestSuite; +import org.eclipse.jface.util.Util; import org.eclipse.ui.tests.harness.util.TweakletCheckTest; import org.eclipse.ui.tests.markers.MarkersViewColumnSizeTest; import org.eclipse.ui.tests.statushandlers.StatusHandlerConfigurationSuite; @@ -46,6 +47,20 @@ addThemeTests(); addStatusHandlingTests(); addRestoredSessionTest(); + addWindowlessSessionTest(); + } + + /** + * + */ + private void addWindowlessSessionTest() { + // Windowless apps are available only on Cocoa + if(Util.isCocoa()) { + Map arguments = new HashMap(2); + arguments.put("product", null); + arguments.put("testApplication", "org.eclipse.ui.tests.windowLessRcpApplication"); + addTest(new WorkbenchSessionTest("windowlessSessionTests",WindowlessSessionTest.class, arguments)); + } } /** Index: Eclipse UI Tests/org/eclipse/ui/tests/session/WindowlessSessionTest.java =================================================================== RCS file: Eclipse UI Tests/org/eclipse/ui/tests/session/WindowlessSessionTest.java diff -N Eclipse UI Tests/org/eclipse/ui/tests/session/WindowlessSessionTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Eclipse UI Tests/org/eclipse/ui/tests/session/WindowlessSessionTest.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,42 @@ +/******************************************************************************* + + * 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.session; + +import org.eclipse.ui.tests.harness.util.UITestCase; + + +/** + * @since 3.7 + */ +public class WindowlessSessionTest extends UITestCase { + + public WindowlessSessionTest(String name) { + super(name); + } + + public void testWindowlessWorkbench() throws Exception { + + // There should not be any windows in this app + assertTrue(fWorkbench.getWorkbenchWindowCount() == 0); + +// // Now open a window +// IWorkbenchWindow window = fWorkbench.openWorkbenchWindow(null); +// +// // window count should be 1 +// assertTrue(fWorkbench.getWorkbenchWindowCount() == 1); +// +// window.close(); +// +// // now the workbench should stay without a window +// assertTrue(fWorkbench.getWorkbenchWindowCount() == 0); + } +} Index: plugin.xml =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.tests/plugin.xml,v retrieving revision 1.289 diff -u -r1.289 plugin.xml --- plugin.xml 12 Apr 2010 14:56:44 -0000 1.289 +++ plugin.xml 4 Nov 2010 11:47:10 -0000 @@ -4295,4 +4295,16 @@ + + + + + + #P org.eclipse.ui.tests.harness Index: src/org/eclipse/ui/tests/harness/util/RCPTestWorkbenchAdvisor.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.tests.harness/src/org/eclipse/ui/tests/harness/util/RCPTestWorkbenchAdvisor.java,v retrieving revision 1.2 diff -u -r1.2 RCPTestWorkbenchAdvisor.java --- src/org/eclipse/ui/tests/harness/util/RCPTestWorkbenchAdvisor.java 25 May 2009 20:52:38 -0000 1.2 +++ src/org/eclipse/ui/tests/harness/util/RCPTestWorkbenchAdvisor.java 4 Nov 2010 11:47:13 -0000 @@ -50,6 +50,8 @@ /** Default value of -1 causes the option to be ignored. */ private int idleBeforeExit = -1; + private boolean windowlessApp = false; + /** * Traps whether or not calls to displayAccess in the UI thread resulted in * an exception. Should be false. @@ -62,8 +64,15 @@ this.idleBeforeExit = -1; } - public RCPTestWorkbenchAdvisor(int idleBeforeExit) { - this.idleBeforeExit = idleBeforeExit; + /** + * + * Enables the RCP application to runwithout a workbench window + * + * @param runWithoutWindow + * + */ + public RCPTestWorkbenchAdvisor(boolean windowlessApp) { + this.windowlessApp = windowlessApp; } /* @@ -87,6 +96,12 @@ prefs.setValue(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP, false); prefs.setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false); + + if(windowlessApp) { + configurer.setSaveAndRestore(true); + configurer.setExitOnLastWindowClose(false); + } + } /*