EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.dialogs.parameters]

COVERAGE SUMMARY FOR SOURCE FILE [CreateEditorContents.java]

nameclass, %method, %block, %line, %
CreateEditorContents.java0%   (0/2)0%   (0/24)0%   (0/384)0%   (0/94)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CreateEditorContents0%   (0/1)0%   (0/22)0%   (0/373)0%   (0/91)
<static initializer> 0%   (0/1)0%   (0/20)0%   (0/3)
CreateEditorContents (Composite): void 0%   (0/1)0%   (0/11)0%   (0/4)
access$0 (CreateEditorContents): TableViewer 0%   (0/1)0%   (0/3)0%   (0/1)
create (Composite): CreateEditorContents 0%   (0/1)0%   (0/5)0%   (0/1)
createNameColumnCellEditor (): void 0%   (0/1)0%   (0/10)0%   (0/2)
createSeparator (Composite): void 0%   (0/1)0%   (0/14)0%   (0/3)
createTypeColumnCellEditor (TransactionalEditingDomain): void 0%   (0/1)0%   (0/11)0%   (0/3)
getColumnNames (): String [] 0%   (0/1)0%   (0/2)0%   (0/1)
getViewer (): TableViewer 0%   (0/1)0%   (0/3)0%   (0/1)
init (Composite): void 0%   (0/1)0%   (0/234)0%   (0/48)
setAddButtonActionListener (SelectionListener): void 0%   (0/1)0%   (0/5)0%   (0/2)
setDeleteButtonActionListener (SelectionListener): void 0%   (0/1)0%   (0/5)0%   (0/2)
setDeleteItemsEnabled (boolean): void 0%   (0/1)0%   (0/5)0%   (0/2)
setDownButtonActionListener (SelectionListener): void 0%   (0/1)0%   (0/5)0%   (0/2)
setDownItemsEnabled (boolean): void 0%   (0/1)0%   (0/5)0%   (0/2)
setUpButtonActionListener (SelectionListener): void 0%   (0/1)0%   (0/5)0%   (0/2)
setUpItemsEnabled (boolean): void 0%   (0/1)0%   (0/5)0%   (0/2)
setViewerCellModifier (ICellModifier): void 0%   (0/1)0%   (0/5)0%   (0/2)
setViewerContentProvider (IContentProvider): void 0%   (0/1)0%   (0/5)0%   (0/2)
setViewerInput (Object): void 0%   (0/1)0%   (0/5)0%   (0/2)
setViewerLabelProvider (IBaseLabelProvider): void 0%   (0/1)0%   (0/5)0%   (0/2)
setViewerSelectionChangedListener (ISelectionChangedListener): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class CreateEditorContents$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
CreateEditorContents$1 (CreateEditorContents): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/5)0%   (0/2)

1package de.uka.ipd.sdq.pcm.dialogs.parameters;
2 
3import org.eclipse.emf.transaction.TransactionalEditingDomain;
4import org.eclipse.jface.viewers.CellEditor;
5import org.eclipse.jface.viewers.IBaseLabelProvider;
6import org.eclipse.jface.viewers.ICellModifier;
7import org.eclipse.jface.viewers.IContentProvider;
8import org.eclipse.jface.viewers.ISelectionChangedListener;
9import org.eclipse.jface.viewers.TableViewer;
10import org.eclipse.jface.viewers.TextCellEditor;
11import org.eclipse.swt.SWT;
12import org.eclipse.swt.events.SelectionAdapter;
13import org.eclipse.swt.events.SelectionEvent;
14import org.eclipse.swt.events.SelectionListener;
15import org.eclipse.swt.layout.FormAttachment;
16import org.eclipse.swt.layout.FormData;
17import org.eclipse.swt.layout.GridData;
18import org.eclipse.swt.widgets.Composite;
19import org.eclipse.swt.widgets.Label;
20import org.eclipse.swt.widgets.Table;
21import org.eclipse.swt.widgets.TableColumn;
22import org.eclipse.swt.widgets.ToolBar;
23import org.eclipse.swt.widgets.ToolItem;
24 
25import de.uka.ipd.sdq.pcm.dialogs.DialogsImages;
26 
27/**
28 * This class create a dialog area for Parameter-, DataTypeDialog. In order to
29 * make functionality possible from dialogue perfectly to, the following
30 * functions must be called:
31 * 
32 * setViewerContentProvider(IContentProvider contentProvider),
33 * setViewerLabelProvider(IBaseLabelProvider labelProvider),
34 * setViewerCellModifier(ICellModifier cellModifier),
35 * setAddButtonActionListener(SelectionListener listener),
36 * setDeleteButtonActionListener(SelectionListener listener),
37 * setUpButtonActionListener(SelectionListener listener),
38 * setDownButtonActionListener(SelectionListener listener),
39 * setViewerInput(Object input){
40 * 
41 * @author Roman Andrej
42 */
43public class CreateEditorContents {
44        // local value
45        private TableViewer viewer;
46        private ToolItem addItem,deleteItem,downItem,upItem;
47        private Table table;
48        //private TransactionalEditingDomain editingDomain;
49 
50        public static final int ICON_COLUMN_INDEX = 0;
51        public static final int CONTEXT_COLUMN_INDEX = 1;
52        public static final int TYPE_COLUMN_INDEX = 2;
53        public static final int NAME_COLUMN_INDEX = 3;
54 
55        /**
56         * Columns of a table, which is used into ParameterEditDialog
57         */
58        public final static String ATTRIBUTE_ICON_COLUMN = "";
59        public final static String CONTEXT_COLUMN = "Context";
60        public final static String TYPE_COLUMN = "Type";
61        public final static String NAME_COLUMN = "Name";
62 
63        // Set column names of Tabele
64        private static String[] columnNames = new String[] { ATTRIBUTE_ICON_COLUMN,
65                        CONTEXT_COLUMN, NAME_COLUMN, TYPE_COLUMN };
66        
67        /**
68         * Create the cell editors for Name, Type column
69         */
70        private CellEditor[] editors = new CellEditor[columnNames.length];
71 
72        private CreateEditorContents(Composite composite) {
73                init(composite);
74        }
75 
76        /** Factory Method */
77        public static CreateEditorContents create(Composite composite){
78                return new CreateEditorContents(composite);
79        }
80        
81        public void createNameColumnCellEditor(){
82                editors[NAME_COLUMN_INDEX] = new TextCellEditor(table);
83        }
84 
85        public void createTypeColumnCellEditor(TransactionalEditingDomain editingDomain) {
86                editors[TYPE_COLUMN_INDEX] = new TypeDialogCellEditor(table,
87                                editingDomain);
88        }
89        
90        public void setViewerContentProvider(IContentProvider contentProvider){
91                viewer.setContentProvider(contentProvider);
92        }
93        
94        public void setViewerLabelProvider(IBaseLabelProvider labelProvider) {
95                viewer.setLabelProvider(labelProvider);
96        }
97        
98        public void setViewerCellModifier(ICellModifier cellModifier){
99                viewer.setCellModifier(cellModifier);
100        }
101        
102        public void setAddButtonActionListener(SelectionListener listener){
103                addItem.addSelectionListener(listener);
104        }
105        
106        public void setDeleteButtonActionListener(SelectionListener listener){
107                deleteItem.addSelectionListener(listener);
108        }
109        
110        public void setUpButtonActionListener(SelectionListener listener){
111                upItem.addSelectionListener(listener);
112        }
113        
114        public void setDownButtonActionListener(SelectionListener listener){
115                downItem.addSelectionListener(listener);
116        }
117        
118        public void setViewerSelectionChangedListener(ISelectionChangedListener listener){
119                viewer.addSelectionChangedListener(listener);
120        }
121        
122        public void setViewerInput(Object input){
123                viewer.setInput(input);
124        }
125 
126        /** create dialog area          */
127        public void init(Composite composite) {
128 
129                FormData fdToolBar = new FormData();
130                fdToolBar.top = new FormAttachment(0, 5);
131                fdToolBar.right = new FormAttachment(100, -7);
132                fdToolBar.left = new FormAttachment(100, -37);
133                fdToolBar.bottom = new FormAttachment(94, 0);
134 
135                final ToolBar toolBar = new ToolBar(composite, SWT.VERTICAL | SWT.NONE);
136                toolBar.setLayoutData(fdToolBar);
137 
138                addItem = new ToolItem(toolBar, SWT.PUSH);
139                addItem.setImage(DialogsImages.imageRegistry.get(DialogsImages.ADD));
140                addItem.addSelectionListener(new SelectionAdapter(){
141 
142                        /* (non-Javadoc)
143                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
144                         */
145                        @Override
146                        public void widgetSelected(SelectionEvent e) {
147                                viewer.refresh();
148                        }
149                });
150 
151                deleteItem = new ToolItem(toolBar, SWT.PUSH);
152                deleteItem.setImage(DialogsImages.imageRegistry
153                                .get(DialogsImages.DELETE));
154                deleteItem.setEnabled(false);
155                
156                upItem = new ToolItem(toolBar, SWT.PUSH);
157                upItem.setImage(DialogsImages.imageRegistry
158                                .get(DialogsImages.UP));
159                upItem.setEnabled(false);
160                
161                downItem = new ToolItem(toolBar, SWT.PUSH);
162                downItem.setImage(DialogsImages.imageRegistry
163                                .get(DialogsImages.DOWN));
164                downItem.setEnabled(false);
165 
166                final FormData fdTableViewer = new FormData();
167                fdTableViewer.right = new FormAttachment(toolBar, -5, SWT.LEFT);
168                fdTableViewer.top = new FormAttachment(0, 5);
169                fdTableViewer.left = new FormAttachment(0, 5);
170                fdTableViewer.bottom = new FormAttachment(94, 0);
171 
172                viewer = new TableViewer(composite, SWT.FULL_SELECTION
173                                | SWT.BORDER);
174                table = viewer.getTable();
175                table.setLayoutData(fdTableViewer);
176                table.setLinesVisible(true);
177                table.setHeaderVisible(true);
178                // set column editoren
179                viewer.setColumnProperties(columnNames);
180                // Assign the cell editors to the viewer
181                viewer.setCellEditors(editors);
182 
183                // Definere the table columns
184                final TableColumn zeroColumn = new TableColumn(table, SWT.NONE);
185                zeroColumn.setResizable(false);
186                zeroColumn.setWidth(30);
187 
188                final TableColumn contextColumn = new TableColumn(table, SWT.NONE);
189                contextColumn.setWidth(100);
190                contextColumn.setText(CONTEXT_COLUMN);
191 
192                final TableColumn typeColumn = new TableColumn(table, SWT.NONE);
193                typeColumn.setWidth(140);
194                typeColumn.setText(TYPE_COLUMN);
195 
196                final TableColumn nameColumn = new TableColumn(table, SWT.NONE);
197                nameColumn.setWidth(100);
198                nameColumn.setText(NAME_COLUMN);
199 
200                // Set EditorContent for Up/Down button validation
201                UpDownButtonsValidator.getSingelton().setContents(this);
202        }
203        
204        /** set upItem - ToolItem enabled or disabled */
205        public void setUpItemsEnabled(boolean enabled) {
206                upItem.setEnabled(enabled);
207        }
208 
209        /** set downItem - ToolItem enabled or disabled */
210        public void setDownItemsEnabled(boolean enabled) {
211                downItem.setEnabled(enabled);
212        }
213        
214        /** set deleteItem - ToolItem enabled or disabled */
215        public void setDeleteItemsEnabled(boolean enabled) {
216                deleteItem.setEnabled(enabled);
217        }
218        
219        public void createSeparator(Composite composite) {
220                Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
221                separator.setLayoutData(new GridData(492, SWT.DEFAULT));
222        }
223 
224        public static String[] getColumnNames() {
225                return columnNames;
226        }
227 
228        public TableViewer getViewer() {
229                return viewer;
230        }
231}

[all classes][de.uka.ipd.sdq.pcm.dialogs.parameters]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov