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

COVERAGE SUMMARY FOR SOURCE FILE [SetOutputVariableNameDialog.java]

nameclass, %method, %block, %line, %
SetOutputVariableNameDialog.java0%   (0/2)0%   (0/11)0%   (0/178)0%   (0/43)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SetOutputVariableNameDialog0%   (0/1)0%   (0/8)0%   (0/160)0%   (0/40)
SetOutputVariableNameDialog (Shell): void 0%   (0/1)0%   (0/14)0%   (0/4)
access$0 (SetOutputVariableNameDialog): Text 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (SetOutputVariableNameDialog, String): void 0%   (0/1)0%   (0/4)0%   (0/1)
cancelPressed (): void 0%   (0/1)0%   (0/6)0%   (0/3)
createDialogArea (Composite): Control 0%   (0/1)0%   (0/75)0%   (0/14)
getOutputVariableReference (): AbstractNamedReference 0%   (0/1)0%   (0/39)0%   (0/8)
getResult (): String 0%   (0/1)0%   (0/3)0%   (0/1)
referenceFactory (String, boolean): AbstractNamedReference 0%   (0/1)0%   (0/16)0%   (0/8)
     
class SetOutputVariableNameDialog$SetNameValidationListener0%   (0/1)0%   (0/3)0%   (0/18)0%   (0/3)
SetOutputVariableNameDialog$SetNameValidationListener (SetOutputVariableNameD... 0%   (0/1)0%   (0/6)0%   (0/1)
SetOutputVariableNameDialog$SetNameValidationListener (SetOutputVariableNameD... 0%   (0/1)0%   (0/4)0%   (0/1)
modifyText (ModifyEvent): void 0%   (0/1)0%   (0/8)0%   (0/2)

1package de.uka.ipd.sdq.pcm.dialogs.variablenames;
2 
3import org.eclipse.jface.dialogs.TitleAreaDialog;
4import org.eclipse.swt.SWT;
5import org.eclipse.swt.events.ModifyEvent;
6import org.eclipse.swt.events.ModifyListener;
7import org.eclipse.swt.events.SelectionAdapter;
8import org.eclipse.swt.layout.GridData;
9import org.eclipse.swt.layout.GridLayout;
10import org.eclipse.swt.widgets.Composite;
11import org.eclipse.swt.widgets.Control;
12import org.eclipse.swt.widgets.Label;
13import org.eclipse.swt.widgets.Shell;
14import org.eclipse.swt.widgets.Text;
15 
16import de.uka.ipd.sdq.stoex.AbstractNamedReference;
17import de.uka.ipd.sdq.stoex.NamespaceReference;
18import de.uka.ipd.sdq.stoex.StoexFactory;
19 
20public class SetOutputVariableNameDialog extends TitleAreaDialog {
21 
22        private String DIALOG_TITLE = "Enter Local Variable Name for Storing Output Variable";
23        private Text setNameText;
24        private String result;
25        
26        private class SetNameValidationListener extends SelectionAdapter implements ModifyListener {
27                public void modifyText(ModifyEvent e) {
28                        
29                        result = setNameText.getText();
30                }
31        }
32        
33        private SetNameValidationListener listener = new SetNameValidationListener();
34        
35        public SetOutputVariableNameDialog(Shell parentShell) {
36                super(parentShell);
37                // TODO Auto-generated constructor stub
38                
39        }
40 
41        @Override
42        protected Control createDialogArea(Composite parent) {
43                Composite area = (Composite) super.createDialogArea(parent);
44                Composite container = new Composite(area, SWT.NONE);
45                //container.setLayout(new FillLayout());
46                container.setLayoutData(new GridData(GridData.FILL_BOTH));
47                
48                this.setTitle(DIALOG_TITLE);
49 
50                
51                final GridLayout myGL = new GridLayout();
52                myGL.numColumns = 2;
53                container.setLayout(myGL);
54                
55                
56                Label setNameLabel = new Label(container, SWT.NONE);
57                setNameLabel.setText("Enter Local Variable Name:");
58                setNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
59                
60                setNameText = new Text(container, SWT.SINGLE | SWT.BORDER);
61                setNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
62                setNameText.addModifyListener(listener);
63                
64                return super.createDialogArea(parent);
65        }
66        
67        public String getResult(){
68                return result;
69        }
70 
71        @Override
72        protected void cancelPressed() {
73                // TODO Auto-generated method stub
74                super.cancelPressed();
75                result = null;
76        }
77 
78        public AbstractNamedReference getOutputVariableReference() {
79                String[] enteredNameSplitted = result.split("\\.");
80                AbstractNamedReference namedReference = referenceFactory(
81                                enteredNameSplitted[enteredNameSplitted.length - 1], true);
82 
83                for (int i=enteredNameSplitted.length-2; i>=0; i--){
84                        NamespaceReference nr = (NamespaceReference)referenceFactory(enteredNameSplitted[i], false);
85                        nr.setInnerReference_NamespaceReference(namedReference);
86                        namedReference = nr;
87                }
88                return namedReference;
89        }
90 
91        /**
92         * Create the AbstractNamedReference and set a string parameter
93         */
94        private AbstractNamedReference referenceFactory(String string,
95                        boolean shouldGenerateVariableReference) {
96                AbstractNamedReference parameterReference = null;
97                if (shouldGenerateVariableReference) {
98                        parameterReference = StoexFactory.eINSTANCE
99                                        .createVariableReference();
100                } else {
101                        parameterReference = StoexFactory.eINSTANCE
102                                        .createNamespaceReference();
103                }
104                parameterReference.setReferenceName(string);
105                return parameterReference;
106        }
107 
108}

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