01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.testing;
11:
12: import org.eclipse.swt.widgets.Composite;
13: import org.eclipse.swt.widgets.Control;
14: import org.eclipse.ui.internal.PartSite;
15: import org.eclipse.ui.testing.IWorkbenchPartTestable;
16:
17: /**
18: * Implementation of {@link IWorkbenchPartTestable}.
19: *
20: * @since 3.3
21: */
22: public class WorkbenchPartTestable implements IWorkbenchPartTestable {
23:
24: private Composite composite;
25:
26: /**
27: * Create a new instance of this class based on the provided part.
28: *
29: * @param partSite the part to test
30: */
31: public WorkbenchPartTestable(PartSite partSite) {
32: Composite paneComposite = (Composite) partSite.getPane()
33: .getControl();
34: Control[] paneChildren = paneComposite.getChildren();
35: this .composite = ((Composite) paneChildren[0]);
36: }
37:
38: /* (non-Javadoc)
39: * @see org.eclipse.ui.testing.IWorkbenchPartTestable#getControl()
40: */
41: public Composite getControl() {
42: return composite;
43: }
44: }
|