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 [ParametersDialog.java]

nameclass, %method, %block, %line, %
ParametersDialog.java0%   (0/1)0%   (0/5)0%   (0/176)0%   (0/55)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParametersDialog0%   (0/1)0%   (0/5)0%   (0/176)0%   (0/55)
ParametersDialog (Shell, Signature): void 0%   (0/1)0%   (0/10)0%   (0/4)
configureShell (Shell): void 0%   (0/1)0%   (0/7)0%   (0/3)
createButtonsForButtonBar (Composite): void 0%   (0/1)0%   (0/8)0%   (0/3)
createDialogArea (Composite): Control 0%   (0/1)0%   (0/145)0%   (0/44)
getInitialSize (): Point 0%   (0/1)0%   (0/6)0%   (0/1)

1package de.uka.ipd.sdq.pcm.dialogs.parameters;
2 
3import java.util.ArrayList;
4 
5import org.eclipse.emf.ecore.EReference;
6import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
7import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
8import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
9import org.eclipse.emf.transaction.util.TransactionUtil;
10import org.eclipse.jface.dialogs.IDialogConstants;
11import org.eclipse.jface.dialogs.TitleAreaDialog;
12import org.eclipse.swt.SWT;
13import org.eclipse.swt.graphics.Point;
14import org.eclipse.swt.layout.FormLayout;
15import org.eclipse.swt.layout.GridData;
16import org.eclipse.swt.widgets.Composite;
17import org.eclipse.swt.widgets.Control;
18import org.eclipse.swt.widgets.Shell;
19 
20import de.uka.ipd.sdq.dialogs.selection.FilteredItemsAdapterFactory;
21import de.uka.ipd.sdq.pcm.dialogs.Messages;
22import de.uka.ipd.sdq.pcm.repository.Parameter;
23import de.uka.ipd.sdq.pcm.repository.Signature;
24import de.uka.ipd.sdq.pcm.repository.provider.RepositoryItemProviderAdapterFactory;
25import de.uka.ipd.sdq.pcmbench.ui.provider.PalladioItemProviderAdapterFactory;
26 
27/**
28 * @author Roman Andrej
29 * 
30 * The dialogue serves the input of parameter names and types in table cells. It
31 * a simple editor implemented for providing and deletion of types.
32 */
33public class ParametersDialog extends TitleAreaDialog {
34 
35        private ComposedAdapterFactory adapterFactory;
36 
37        private Signature signature;
38 
39        /**
40         * Creates a dialog with the given parent and edited properties name
41         * 
42         * @param parentShell
43         *            -object that returns the current parent shell columnName -
44         *            edited properties
45         */
46        public ParametersDialog(Shell parentShell, Signature signature) {
47                super(parentShell);
48                this.signature = signature;
49 
50                /**
51                 * the result of combining the constants which are required
52                 * to produce a typical application top level shell
53                 */
54                setShellStyle(SWT.RESIZE|SWT.TITLE|SWT.CLOSE |SWT.MIN|SWT.MAX);
55        }
56 
57        /* (non-Javadoc)
58         * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
59         */
60        @Override
61        protected void configureShell(Shell newShell) {
62                super.configureShell(newShell);
63                newShell.setText("OwnedParameters");
64        }
65        
66        /* (non-Javadoc)
67         * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
68         */
69        @Override
70        protected Control createDialogArea(Composite parent) {
71                setTitle(Messages.ParametersDialog_Title);
72 
73                Composite area = (Composite) super.createDialogArea(parent);
74                Composite container = new Composite(area, SWT.NONE);
75                container.setLayout(new FormLayout());
76                container.setLayoutData(new GridData(GridData.FILL_BOTH));
77 
78                ArrayList<Object> filterList = new ArrayList<Object>();
79                filterList.add(Parameter.class);
80                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
81 
82                adapterFactory = new ComposedAdapterFactory();
83                adapterFactory
84                                .addAdapterFactory(new RepositoryItemProviderAdapterFactory());
85 
86                CreateEditorContents editorContents = CreateEditorContents
87                                .create(container);
88 
89                editorContents
90                                .setViewerContentProvider(new AdapterFactoryContentProvider(
91                                                new FilteredItemsAdapterFactory(adapterFactory,
92                                                                filterList, additionalReferences)));
93                editorContents
94                                .setViewerLabelProvider(new AdapterFactoryLabelProvider(
95                                                new ParametersItemProviderAdapterFactory(
96                                                                new PalladioItemProviderAdapterFactory(
97                                                                                adapterFactory))));
98                editorContents.setViewerCellModifier(new ParametersCellModifier(
99                                editorContents.getViewer(), TransactionUtil
100                                                .getEditingDomain(signature)));
101                editorContents.createNameColumnCellEditor();
102                editorContents.createTypeColumnCellEditor(TransactionUtil
103                                .getEditingDomain(signature));
104                editorContents.setAddButtonActionListener(new AddParameterAction(
105                                signature));
106 
107                DeleteParameterAction deleteParameterAction = new DeleteParameterAction(
108                                signature);
109                UpParameterAction upParameterAction = new UpParameterAction(signature);
110                DownParameterAction downParameterAction = new DownParameterAction(
111                                signature);
112 
113                editorContents.setDeleteButtonActionListener(deleteParameterAction);
114                editorContents.setUpButtonActionListener(upParameterAction);
115                editorContents.setDownButtonActionListener(downParameterAction);
116 
117                editorContents.setViewerSelectionChangedListener(deleteParameterAction);
118                editorContents.setViewerSelectionChangedListener(upParameterAction);
119                editorContents.setViewerSelectionChangedListener(downParameterAction);
120 
121                editorContents.setViewerInput(signature);
122 
123                /** create separatot to button area */
124                ((CreateEditorContents) editorContents).createSeparator(parent);
125 
126                return area;
127        }
128 
129        /*
130         * (non-Javadoc)
131         * 
132         * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
133         */
134        @Override
135        protected void createButtonsForButtonBar(Composite parent) {
136                createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
137                                false);
138        }
139 
140        /* (non-Javadoc)
141         * @see org.eclipse.jface.dialogs.TitleAreaDialog#getInitialSize()
142         */
143        @Override
144        protected Point getInitialSize() {
145                return new Point(500, 375);
146        }
147}

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