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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractSWTVetoableValue.java]

nameclass, %method, %block, %line, %
AbstractSWTVetoableValue.java100% (2/2)60%  (3/5)66%  (29/44)69%  (9/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractSWTVetoableValue100% (1/1)33%  (1/3)56%  (19/34)60%  (6/10)
AbstractSWTVetoableValue (Widget): void 0%   (0/1)0%   (0/7)0%   (0/2)
getWidget (): Widget 0%   (0/1)0%   (0/3)0%   (0/1)
AbstractSWTVetoableValue (Realm, Widget): void 100% (1/1)79%  (19/24)86%  (6/7)
     
class AbstractSWTVetoableValue$1100% (1/1)100% (2/2)100% (10/10)100% (4/4)
AbstractSWTVetoableValue$1 (AbstractSWTVetoableValue): void 100% (1/1)100% (6/6)100% (2/2)
widgetDisposed (DisposeEvent): void 100% (1/1)100% (4/4)100% (2/2)

1/*******************************************************************************
2 * Copyright (c) 2006 The Pampered Chef, Inc. 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 *     The Pampered Chef, Inc. - initial API and implementation
10 ******************************************************************************/
11 
12package org.eclipse.jface.internal.databinding.provisional.swt;
13 
14import org.eclipse.core.databinding.observable.Realm;
15import org.eclipse.core.databinding.observable.value.AbstractVetoableValue;
16import org.eclipse.jface.databinding.swt.ISWTObservableValue;
17import org.eclipse.jface.databinding.swt.SWTObservables;
18import org.eclipse.swt.events.DisposeEvent;
19import org.eclipse.swt.events.DisposeListener;
20import org.eclipse.swt.widgets.Widget;
21 
22/**
23 * NON-API - An abstract superclass for vetoable values that gurantees that the 
24 * observable will be disposed when the control to which it is attached is
25 * disposed.
26 * 
27 * @since 1.1
28 */
29public abstract class AbstractSWTVetoableValue extends AbstractVetoableValue implements ISWTObservableValue {
30 
31        private final Widget widget;
32 
33        /**
34         * Standard constructor for an SWT VetoableValue.  Makes sure that
35         * the observable gets disposed when the SWT widget is disposed.
36         * 
37         * @param widget
38         */
39        protected AbstractSWTVetoableValue(Widget widget) {
40                this(SWTObservables.getRealm(widget.getDisplay()), widget);
41        }
42        
43        /**
44         * Constructs a new instance for the provided <code>realm</code> and <code>widget</code>.
45         * 
46         * @param realm
47         * @param widget
48         * @since 1.2
49         */
50        protected AbstractSWTVetoableValue(Realm realm, Widget widget) {
51                super(realm);
52                this.widget = widget;
53                if (widget == null) {
54                        throw new IllegalArgumentException("The widget parameter is null."); //$NON-NLS-1$
55                }
56                widget.addDisposeListener(disposeListener);
57        }
58        
59        private DisposeListener disposeListener = new DisposeListener() {
60                public void widgetDisposed(DisposeEvent e) {
61                        AbstractSWTVetoableValue.this.dispose();
62                }
63        };
64 
65        /**
66         * @return Returns the widget.
67         */
68        public Widget getWidget() {
69                return widget;
70        }
71}

[all classes][org.eclipse.jface.internal.databinding.provisional.swt]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov