1 /******************************************************************************* 2 * Copyright (c) 2005, 2006 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.internal.testing; 12 13 import org.eclipse.swt.widgets.Composite; 14 import org.eclipse.swt.widgets.Control; 15 import org.eclipse.ui.internal.PartSite; 16 import org.eclipse.ui.testing.IWorkbenchPartTestable; 17 18 /** 19 * Implementation of {@link IWorkbenchPartTestable}. 20 * 21 * @since 3.3 22 */ 23 public class WorkbenchPartTestable implements IWorkbenchPartTestable { 24 25 private Composite composite; 26 27 /** 28 * Create a new instance of this class based on the provided part. 29 * 30 * @param partSite the part to test 31 */ 32 public WorkbenchPartTestable(PartSite partSite) { 33 Composite paneComposite = (Composite)partSite.getPane().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 } 45