Coverage Report - org.eclipse.swtbot.swt.finder.resolvers.ExpandItemResolver
 
Classes in this File Line Coverage Branch Coverage Complexity
ExpandItemResolver
81%
9/11
30%
3/10
1.5
 
 1  
 /*******************************************************************************
 2  
  * Copyright (c) 2011 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.widgets.Control;
 17  
 import org.eclipse.swt.widgets.ExpandItem;
 18  
 import org.eclipse.swt.widgets.Widget;
 19  
 
 20  
 /**
 21  
  * Resolves {@link ExpandItem}s.
 22  
  * 
 23  
  * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
 24  
  */
 25  8053
 public class ExpandItemResolver implements IChildrenResolver, IParentResolver {
 26  
 
 27  
         public List getChildren(Widget w) {
 28  52
                 ArrayList children = new ArrayList();
 29  52
                 Control control = ((ExpandItem) w).getControl();
 30  52
                 if (control != null)
 31  52
                         children.add(control);
 32  52
                 return children;
 33  
         }
 34  
 
 35  
         public boolean hasChildren(Widget w) {
 36  104
                 return canResolve(w) && ((ExpandItem) w).getControl() != null;
 37  
         }
 38  
 
 39  
         public boolean canResolve(Widget w) {
 40  208
                 return w instanceof ExpandItem;
 41  
         }
 42  
 
 43  
         public Class[] getResolvableClasses() {
 44  8053
                 return new Class[] { ExpandItem.class };
 45  
         }
 46  
 
 47  
         public Widget getParent(Widget w) {
 48  0
                 return canResolve(w) ? ((ExpandItem) w).getParent() : null;
 49  
         }
 50  
 
 51  
         public boolean hasParent(Widget w) {
 52  0
                 return getParent(w) != null;
 53  
         }
 54  
 
 55  
 }