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

COVERAGE SUMMARY FOR SOURCE FILE [EncodingFieldEditor.java]

nameclass, %method, %block, %line, %
EncodingFieldEditor.java0%   (0/1)0%   (0/4)0%   (0/47)0%   (0/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EncodingFieldEditor0%   (0/1)0%   (0/4)0%   (0/47)0%   (0/13)
EncodingFieldEditor (String, String, Composite): void 0%   (0/1)0%   (0/6)0%   (0/2)
EncodingFieldEditor (String, String, String, Composite): void 0%   (0/1)0%   (0/7)0%   (0/2)
doStore (): void 0%   (0/1)0%   (0/28)0%   (0/8)
getStoredValue (): String 0%   (0/1)0%   (0/6)0%   (0/1)

1/*******************************************************************************
2 * Copyright (c) 2004, 2007 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.ui.ide.dialogs;
12 
13import org.eclipse.swt.widgets.Composite;
14import org.eclipse.swt.widgets.Group;
15import org.eclipse.ui.ide.IDEEncoding;
16 
17/**
18 * The EncodingFieldEditor is a field editor that allows the 
19 * user to set an encoding on a preference in a preference
20 * store.
21 * <p>
22 * This class may be instantiated; it is not intended to be subclassed.
23 * </p>
24 * 
25 * @since 3.1
26 */
27public final class EncodingFieldEditor extends AbstractEncodingFieldEditor {
28 
29        
30        /**
31         * Creates a new encoding field editor with the given preference name, label
32         * and parent.
33         * 
34         * @param name
35         *            the name of the preference this field editor works on
36         * @param labelText
37         *            the label text of the field editor
38         * @param groupTitle
39         *            the title for the field editor's control. If groupTitle is 
40         *            <code>null</code> the control will be unlabelled
41         *            (by default a {@link Composite} instead of a {@link Group}.
42         * @param parent
43         *            the parent of the field editor's control
44         * @see AbstractEncodingFieldEditor#setGroupTitle(String)
45         * @since 3.3
46         */
47        public EncodingFieldEditor(String name, String labelText,
48                        String groupTitle, Composite parent) {
49                super(name, labelText, groupTitle, parent);
50        }
51        /**
52         * Create a new instance of the receiver on the preference called name
53         * with a label of labelText.
54         * @param name
55         * @param labelText
56         * @param parent
57         */
58        public EncodingFieldEditor(String name, String labelText, Composite parent) {
59                super(name, labelText, parent);
60        }
61        /* (non-Javadoc)
62         * @see org.eclipse.ui.internal.ide.dialogs.AbstractEncodingFieldEditor#getStoredValue()
63         */
64        protected String getStoredValue() {
65                return getPreferenceStore().getString(getPreferenceName());
66        }
67        
68        /* (non-Javadoc)
69         * @see org.eclipse.jface.preference.FieldEditor#doStore()
70         */
71        protected void doStore() {
72                String encoding = getSelectedEncoding();
73                
74                if(hasSameEncoding(encoding)) {
75                        return;
76                }
77                
78                IDEEncoding.addIDEEncoding(encoding);        
79                
80                if (encoding.equals(getDefaultEnc())) {
81                        getPreferenceStore().setToDefault(getPreferenceName());
82                } else {
83                        getPreferenceStore().setValue(getPreferenceName(), encoding);
84                }
85        }
86 
87}

[all classes][org.eclipse.ui.ide.dialogs]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov