View | Details | Raw Unified | Return to bug 74073 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse JFace Tests/org/eclipse/ui/tests/RCPSessionApplication.java (-2 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2009 IBM Corporation and others.
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 19-28 Link Here
19
19
20
public class RCPSessionApplication implements IApplication {
20
public class RCPSessionApplication implements IApplication {
21
	
21
	
22
	private boolean windowlessApp = false;
23
	
22
	public Object start(IApplicationContext context) throws Exception {
24
	public Object start(IApplicationContext context) throws Exception {
23
		Display display = PlatformUI.createDisplay();
25
		Display display = PlatformUI.createDisplay();
24
		try {
26
		try {
25
			PlatformUI.createAndRunWorkbench(display, new RCPTestWorkbenchAdvisor());
27
			PlatformUI.createAndRunWorkbench(display, new RCPTestWorkbenchAdvisor(windowlessApp));
26
		} finally {
28
		} finally {
27
			if (display != null)
29
			if (display != null)
28
				display.dispose();
30
				display.dispose();
Lines 42-45 Link Here
42
			}
44
			}
43
		});
45
		});
44
	}
46
	}
47
	
48
	/**
49
	 * @param windowlessApp The windowlessApp to set.
50
	 */
51
	public void setWindowlessApp(boolean windowlessApp) {
52
		this.windowlessApp = windowlessApp;
53
	}
54
	
45
}
55
}
(-)Eclipse (+20 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.ui.tests;
12
13
14
public class WindowlessRCPApplication extends RCPSessionApplication {
15
	
16
	public WindowlessRCPApplication() {
17
		setWindowlessApp(true);
18
	}
19
20
}
(-)Eclipse UI Tests/org/eclipse/ui/tests/session/SessionTests.java (+15 lines)
Lines 17-22 Link Here
17
import junit.framework.Test;
17
import junit.framework.Test;
18
import junit.framework.TestSuite;
18
import junit.framework.TestSuite;
19
19
20
import org.eclipse.jface.util.Util;
20
import org.eclipse.ui.tests.harness.util.TweakletCheckTest;
21
import org.eclipse.ui.tests.harness.util.TweakletCheckTest;
21
import org.eclipse.ui.tests.markers.MarkersViewColumnSizeTest;
22
import org.eclipse.ui.tests.markers.MarkersViewColumnSizeTest;
22
import org.eclipse.ui.tests.statushandlers.StatusHandlerConfigurationSuite;
23
import org.eclipse.ui.tests.statushandlers.StatusHandlerConfigurationSuite;
Lines 46-51 Link Here
46
		addThemeTests();
47
		addThemeTests();
47
		addStatusHandlingTests();
48
		addStatusHandlingTests();
48
		addRestoredSessionTest();
49
		addRestoredSessionTest();
50
		addWindowlessSessionTest();
51
	}
52
53
	/**
54
	 * 
55
	 */
56
	private void addWindowlessSessionTest() {
57
		// Windowless apps are available only on Cocoa 
58
		if(Util.isCocoa()) {
59
			Map arguments = new HashMap(2);
60
			arguments.put("product", null);
61
			arguments.put("testApplication", "org.eclipse.ui.tests.windowLessRcpApplication");
62
			addTest(new WorkbenchSessionTest("windowlessSessionTests",WindowlessSessionTest.class, arguments));
63
		}
49
	}
64
	}
50
65
51
	/**
66
	/**
(-)Eclipse (+42 lines)
Added Link Here
1
/*******************************************************************************
2
3
 * Copyright (c) 2010 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *     IBM Corporation - initial API and implementation
11
 ******************************************************************************/
12
package org.eclipse.ui.tests.session;
13
14
import org.eclipse.ui.tests.harness.util.UITestCase;
15
16
17
/**
18
 * @since 3.7
19
 */
20
public class WindowlessSessionTest extends UITestCase {
21
	
22
	public WindowlessSessionTest(String name) {
23
		super(name);
24
	}
25
26
	public void testWindowlessWorkbench() throws Exception {
27
		
28
		// There should not be any windows in this app
29
		assertTrue(fWorkbench.getWorkbenchWindowCount() == 0);
30
31
//		// Now open a window
32
//		IWorkbenchWindow window = fWorkbench.openWorkbenchWindow(null);
33
//
34
//		// window count should be 1
35
//		assertTrue(fWorkbench.getWorkbenchWindowCount() == 1);
36
//
37
//		window.close();
38
//
39
//		// now the workbench should stay without a window
40
//		assertTrue(fWorkbench.getWorkbenchWindowCount() == 0);
41
	}
42
}
(-)plugin.xml (+12 lines)
Lines 4295-4298 Link Here
4295
	      <run class="org.eclipse.ui.tests.RCPSessionApplication"> </run>
4295
	      <run class="org.eclipse.ui.tests.RCPSessionApplication"> </run>
4296
	   </application>
4296
	   </application>
4297
   </extension>
4297
   </extension>
4298
   <extension
4299
         id="windowLessRcpApplication"
4300
         point="org.eclipse.core.runtime.applications">
4301
      <application
4302
            cardinality="singleton-global"
4303
            thread="main"
4304
            visible="true">
4305
         <run
4306
               class="org.eclipse.ui.tests.WindowlessRCPApplication">
4307
         </run>
4308
      </application>
4309
   </extension>
4298
</plugin>
4310
</plugin>
(-)src/org/eclipse/ui/tests/harness/util/RCPTestWorkbenchAdvisor.java (-2 / +17 lines)
Lines 50-55 Link Here
50
	/** Default value of -1 causes the option to be ignored. */
50
	/** Default value of -1 causes the option to be ignored. */
51
	private int idleBeforeExit = -1;
51
	private int idleBeforeExit = -1;
52
52
53
	private boolean windowlessApp = false;
54
53
	/**
55
	/**
54
	 * Traps whether or not calls to displayAccess in the UI thread resulted in
56
	 * Traps whether or not calls to displayAccess in the UI thread resulted in
55
	 * an exception. Should be false.
57
	 * an exception. Should be false.
Lines 62-69 Link Here
62
		this.idleBeforeExit = -1;
64
		this.idleBeforeExit = -1;
63
	}
65
	}
64
66
65
	public RCPTestWorkbenchAdvisor(int idleBeforeExit) {
67
	/**
66
		this.idleBeforeExit = idleBeforeExit;
68
	 * 
69
	 * Enables the RCP application to runwithout a workbench window
70
	 * 
71
	 * @param runWithoutWindow
72
	 * 
73
	 */
74
	public RCPTestWorkbenchAdvisor(boolean windowlessApp) {
75
		this.windowlessApp = windowlessApp;
67
	}
76
	}
68
77
69
	/*
78
	/*
Lines 87-92 Link Here
87
		prefs.setValue(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP,
96
		prefs.setValue(IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP,
88
				false);
97
				false);
89
		prefs.setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
98
		prefs.setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, false);
99
		
100
		if(windowlessApp) {
101
			configurer.setSaveAndRestore(true);
102
			configurer.setExitOnLastWindowClose(false);
103
		}
104
		
90
	}
105
	}
91
106
92
	/*
107
	/*

Return to bug 74073