Coverage Report - org.eclipse.swtbot.swt.finder.resolvers.CTabItemResolver
 
Classes in this File Line Coverage Branch Coverage Complexity
CTabItemResolver
100%
11/11
50%
5/10
1.5
 
 1  
 /*******************************************************************************
 2  
  * Copyright (c) 2008 Ketan Padegaonkar 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  
  *     Ketan Padegaonkar - initial API and implementation
 10  
  *******************************************************************************/
 11  
 package org.eclipse.swtbot.swt.finder.resolvers;
 12  
 
 13  
 import java.util.ArrayList;
 14  
 import java.util.List;
 15  
 
 16  
 import org.eclipse.swt.custom.CTabItem;
 17  
 import org.eclipse.swt.widgets.Control;
 18  
 import org.eclipse.swt.widgets.Widget;
 19  
 
 20  
 /**
 21  
  * Resolves {@link CTabItem}s.
 22  
  * 
 23  
  * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
 24  
  * @version $Id$
 25  
  */
 26  5053
 public class CTabItemResolver implements IChildrenResolver, IParentResolver {
 27  
 
 28  
         public List getChildren(Widget w) {
 29  43
                 ArrayList children = new ArrayList();
 30  43
                 Control control = ((CTabItem) w).getControl();
 31  43
                 if (control != null)
 32  43
                         children.add(control);
 33  43
                 return children;
 34  
         }
 35  
 
 36  
         public boolean hasChildren(Widget w) {
 37  86
                 return canResolve(w) && ((CTabItem) w).getControl() != null;
 38  
         }
 39  
 
 40  
         public boolean canResolve(Widget w) {
 41  175
                 return w instanceof CTabItem;
 42  
         }
 43  
 
 44  
         public Class[] getResolvableClasses() {
 45  5053
                 return new Class[] { CTabItem.class };
 46  
         }
 47  
 
 48  
         public Widget getParent(Widget w) {
 49  3
                 return canResolve(w) ? ((CTabItem) w).getParent() : null;
 50  
         }
 51  
 
 52  
         public boolean hasParent(Widget w) {
 53  2
                 return getParent(w) != null;
 54  
         }
 55  
 
 56  
 }