source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/InsertFileEquals.java @ 367

Last change on this file since 367 was 230, checked in by sherbold, 13 years ago
  • extended SWT-GUI with dialogs for editing sequences and adding of assertions

Comment for Revision 229 (comment missing due to Subversive bug):

  • changed de.ugoe.cs.eventbench.assertions.FileEqualsReplay? and de.ugoe.cs.eventbench.assertions.TextEqualsReplay? such that the actual and expected values are now defined via the constructor
  • changed storage method for targets that are found during the parsing of MFC usage log files. If the sequences are stored in the variable "seqsName" the targets are stored in the variable "seqsName_targets"
  • adapted classes in de.ugoe.cs.eventbench.swing to the changes above
  • marked the classes in de.ugoe.cs.eventbench.swing as deprecated as the Swing GUI will not be part of further maintenance. Use the SWT GUI instead.
  • Property svn:mime-type set to text/plain
File size: 2.6 KB
Line 
1package de.ugoe.cs.eventbench.swt;
2
3import java.util.SortedSet;
4
5import org.eclipse.swt.widgets.Composite;
6import org.eclipse.swt.widgets.FileDialog;
7import org.eclipse.swt.layout.GridLayout;
8import org.eclipse.swt.widgets.Label;
9import org.eclipse.swt.SWT;
10import org.eclipse.swt.widgets.Text;
11import org.eclipse.swt.layout.GridData;
12import org.eclipse.swt.widgets.Button;
13
14import de.ugoe.cs.eventbench.assertions.AssertEvent;
15import de.ugoe.cs.eventbench.assertions.FileEqualsReplay;
16import de.ugoe.cs.eventbench.data.Event;
17
18import org.eclipse.swt.events.SelectionAdapter;
19import org.eclipse.swt.events.SelectionEvent;
20
21public class InsertFileEquals extends AbstractInsertEventComposite {
22        private Text actualText;
23        private Text expectedText;
24
25        public InsertFileEquals(Composite parent, int style) {
26                this(parent, style, null);
27        }
28       
29        /**
30         * Create the composite.
31         * @param parent
32         * @param style
33         */
34        public InsertFileEquals(Composite parent, int style, SortedSet<String> targets) {
35                super(parent, style, targets);
36                setLayout(new GridLayout(3, false));
37               
38                               
39                                Label lblExpectedFile = new Label(this, SWT.NONE);
40                                lblExpectedFile.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
41                                lblExpectedFile.setText("Expected file:");
42               
43                expectedText = new Text(this, SWT.BORDER);
44                expectedText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
45               
46                Button btnSearch = new Button(this, SWT.NONE);
47                btnSearch.addSelectionListener(new SelectionAdapter() {
48                        @Override
49                        public void widgetSelected(SelectionEvent e) {
50                                FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
51                                String filename = fileDialog.open();
52                                if( filename!= null ) {
53                                        expectedText.setText(filename);
54                                }
55                        }
56                });
57                btnSearch.setText("Search...");
58               
59                Label lblActualFile = new Label(this, SWT.NONE);
60               
61                lblActualFile.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
62                lblActualFile.setText("Actual file:");
63               
64                actualText = new Text(this, SWT.BORDER);
65                actualText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
66                new Label(this, SWT.NONE);
67
68        }
69
70        @Override
71        protected void checkSubclass() {
72                // Disable the check that prevents subclassing of SWT components
73        }
74
75        @Override
76        public Event<?> getEvent() {
77                FileEqualsReplay replay = new FileEqualsReplay(expectedText.getText(), actualText.getText());
78                AssertEvent<FileEqualsReplay> event = new AssertEvent<FileEqualsReplay>("FileEqualsAssertion");
79                event.addReplayEvent(replay);
80                return event;
81        }
82
83}
Note: See TracBrowser for help on using the repository browser.