EMMA Coverage Report (generated Mon Sep 29 15:05:28 EDT 2008)
[all classes][org.eclipse.jface.window]

COVERAGE SUMMARY FOR SOURCE FILE [SameShellProvider.java]

nameclass, %method, %block, %line, %
SameShellProvider.java100% (1/1)100% (2/2)87%  (20/23)94%  (5.7/6)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SameShellProvider100% (1/1)100% (2/2)87%  (20/23)94%  (5.7/6)
getShell (): Shell 100% (1/1)82%  (14/17)89%  (2.7/3)
SameShellProvider (Control): void 100% (1/1)100% (6/6)100% (3/3)

1/*******************************************************************************
2 * Copyright (c) 2000, 2005 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 *******************************************************************************/
11package org.eclipse.jface.window;
12 
13import org.eclipse.swt.widgets.Control;
14import org.eclipse.swt.widgets.Shell;
15 
16/**
17 * Standard shell provider that always returns the shell containing the given
18 * control. This will always return the correct shell for the control, even if
19 * the control is reparented.
20 * 
21 * @since 3.1
22 */
23public class SameShellProvider implements IShellProvider {
24 
25    private Control targetControl;
26    
27    /**
28     * Returns a shell provider that always returns the current
29     * shell for the given control.
30     * 
31     * @param targetControl control whose shell will be tracked, or null if getShell() should always
32     * return null
33     */
34    public SameShellProvider(Control targetControl) {
35        this.targetControl = targetControl;
36    }
37    
38    /* (non-javadoc)
39     * @see IShellProvider#getShell()
40     */
41    public Shell getShell() {
42        if (targetControl instanceof Shell) {
43            return (Shell)targetControl;
44        }
45        
46        return targetControl == null? null :targetControl.getShell();
47    }
48 
49}

[all classes][org.eclipse.jface.window]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov