Changeset 213
- Timestamp:
- 09/28/11 11:49:52 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swing/DlgInsert.java
r164 r213 2 2 3 3 import java.awt.BorderLayout; 4 import java.util.ArrayList;5 4 import java.util.Enumeration; 6 5 import java.util.List; 6 import java.util.SortedSet; 7 import java.util.TreeSet; 7 8 8 9 import de.ugoe.cs.eventbench.assertions.AssertEvent; … … 20 21 import javax.swing.JLabel; 21 22 import javax.swing.JTextField; 22 import javax.swing.DefaultComboBoxModel;23 23 import javax.swing.JOptionPane; 24 24 import javax.swing.JFileChooser; … … 29 29 import java.awt.event.ActionEvent; 30 30 import javax.swing.JScrollPane; 31 import javax.swing.JList;32 31 import javax.swing.border.EtchedBorder; 33 32 import javax.swing.JTree; 34 33 import javax.swing.tree.DefaultTreeModel; 35 34 import javax.swing.tree.DefaultMutableTreeNode; 35 import javax.swing.tree.TreeNode; 36 36 import javax.swing.tree.TreePath; 37 import javax.swing.event.TreeSelectionListener; 38 import javax.swing.event.TreeSelectionEvent; 39 37 import javax.swing.tree.TreeSelectionModel; 38 39 /** 40 * <p> 41 * This class provides the dialog to insert one of the available assertion 42 * types. 43 * </p> 44 * 45 * @author Jeffrey Hall 46 * @version 1.0 47 */ 40 48 public class DlgInsert extends JDialog { 41 49 … … 51 59 52 60 /** 53 * Launch the application. 61 * <p> 62 * Launch the dialog 63 * </p> 64 * 65 * @param sequences 66 * A list of the events where an assertion will be inserted. 67 * @param selectedIndex 68 * The position for inserting an assertion. 69 * @param insertBefore 70 * To decide if the user clicked 'insert before' or 'insert 71 * after'. 54 72 */ 55 73 public static void showDialog(List<Event<?>> sequences, int selectedIndex, … … 66 84 67 85 /** 86 * <p> 68 87 * Create the dialog. 69 */ 70 @SuppressWarnings("unchecked") 88 * </p> 89 * 90 * @param sequences 91 * A list of the events where an assertion will be inserted. 92 * @param selectedIndex 93 * The position for inserting an assertion. 94 * @param insertBefore 95 * To decide if the user clicked 'insert before' or 'insert 96 * after'. 97 */ 71 98 public DlgInsert(final List<Event<?>> sequences, final int selectedIndex, 72 99 final boolean insertBefore) { 73 74 final javax.swing.DefaultListModel modelListTargets = new javax.swing.DefaultListModel(); 100 initialize(sequences, selectedIndex, insertBefore); 101 } 102 103 /** 104 * <p> 105 * Initialize the contents of the frame. 106 * </p> 107 * 108 * @param sequences 109 * A list of the events where an assertion will be inserted. 110 * @param selectedIndex 111 * The position for inserting an assertion. 112 * @param insertBefore 113 * To decide if the user clicked 'insert before' or 'insert 114 * after'. 115 */ 116 private void initialize(final List<Event<?>> sequences, 117 final int selectedIndex, final boolean insertBefore) { 118 119 setResizable(false); 75 120 76 121 setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); … … 78 123 79 124 setModal(true); 80 setBounds(100, 100, 530, 631);125 setBounds(100, 100, 676, 673); 81 126 getContentPane().setLayout(new BorderLayout()); 82 127 contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); 83 128 getContentPane().add(contentPanel, BorderLayout.CENTER); 84 129 contentPanel.setLayout(null); 85 final JComboBox comboBox Testcase = new JComboBox();130 final JComboBox comboBoxAssertionType = new JComboBox(); 86 131 final JPanel panelTextEquals = new JPanel(); 87 132 panelTextEquals.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, … … 91 136 null)); 92 137 93 // JComboBox: comboBoxTestcase 94 comboBoxTestcase.addActionListener(new ActionListener() { 138 // ***** 139 // define your assertion types here 140 final int numberOfAssertionTypes = 2; 141 final JPanel[] panels = new JPanel[numberOfAssertionTypes]; 142 String[] assertionTypes = new String[numberOfAssertionTypes]; 143 144 panels[0] = panelTextEquals; 145 assertionTypes[0] = "TextEquals"; 146 panels[1] = panelFileEquals; 147 assertionTypes[1] = "OutputFileEquals"; 148 // ***** 149 150 // add assertion types to comboBox 151 for (int i = 0; i < numberOfAssertionTypes; i++) { 152 comboBoxAssertionType.addItem(assertionTypes[i]); 153 } 154 155 comboBoxAssertionType.setSelectedIndex(0); 156 comboBoxAssertionType.setBounds(90, 11, 180, 20); 157 contentPanel.add(comboBoxAssertionType); 158 159 final JPanel buttonPane = new JPanel(); 160 final JButton okButton = new JButton("Insert"); 161 162 // selecting of another assertion type 163 comboBoxAssertionType.addActionListener(new ActionListener() { 95 164 public void actionPerformed(ActionEvent arg0) { 96 165 if ("comboBoxChanged".equals(arg0.getActionCommand())) { 97 166 98 // TextEquals 99 if (comboBoxTestcase.getSelectedIndex() == 0) { 100 panelTextEquals.setVisible(true); 101 panelFileEquals.setVisible(false); 102 } 103 // FileEquals 104 else if (comboBoxTestcase.getSelectedIndex() == 1) { 105 panelTextEquals.setVisible(false); 106 panelFileEquals.setVisible(true); 107 } 167 selectAssertionType(numberOfAssertionTypes, panels, 168 comboBoxAssertionType.getSelectedIndex(), 169 buttonPane, okButton); 108 170 } 109 171 } 110 172 }); 111 comboBoxTestcase.setModel(new DefaultComboBoxModel(new String[] { 112 "TextEquals", "OutputFileEquals" })); 113 comboBoxTestcase.setSelectedIndex(0); 114 comboBoxTestcase.setBounds(91, 11, 178, 20); 115 contentPanel.add(comboBoxTestcase); 116 // *** 117 118 // JLabel 173 119 174 JLabel label = new JLabel("Testcase:"); 120 175 label.setBounds(12, 14, 86, 14); … … 126 181 JLabel label_2 = new JLabel("Target:"); 127 182 label_2.setBounds(10, 38, 86, 14); 128 // *** 129 130 // JTextField: textFieldExpectedValue 183 131 184 textFieldExpectedValue = new JTextField(); 132 185 textFieldExpectedValue.setColumns(10); 133 textFieldExpectedValue.setBounds(116, 8, 368, 20); 134 // *** 135 136 // JPanel: panel 186 textFieldExpectedValue.setBounds(116, 8, 524, 20); 187 137 188 panelTextEquals.setLayout(null); 138 panelTextEquals.setBounds(10, 39, 494, 350);189 panelTextEquals.setBounds(10, 40, 650, 401); 139 190 contentPanel.add(panelTextEquals); 140 191 panelTextEquals.add(label_1); … … 142 193 panelTextEquals.add(textFieldExpectedValue); 143 194 144 JScrollPane scrollPane = new JScrollPane();145 scrollPane.setBounds(421, 36, 63, 14);146 panelTextEquals.add(scrollPane);147 148 final JList listTargets = new JList(modelListTargets);149 scrollPane.setViewportView(listTargets);150 151 195 JScrollPane scrollPane_1 = new JScrollPane(); 152 scrollPane_1.setBounds(10, 63, 474, 276);196 scrollPane_1.setBounds(10, 58, 630, 291); 153 197 panelTextEquals.add(scrollPane_1); 154 198 155 // JTree to hold the targets156 199 final JTree tree = new JTree(); 157 tree.addTreeSelectionListener(new TreeSelectionListener() {158 public void valueChanged(TreeSelectionEvent arg0) {159 TreePath path = tree.getSelectionPath();160 textFieldExpectedValue.setText(path.toString());161 }162 });163 200 DefaultTreeModel treeModel = new DefaultTreeModel(null); 164 DefaultMutableTreeNode root = new DefaultMutableTreeNode("Targets"); 201 final DefaultMutableTreeNode root = new DefaultMutableTreeNode( 202 "Targets"); 165 203 treeModel.setRoot(root); 166 204 tree.setModel(treeModel); 167 205 168 // List<DefaultMutableTreeNode> nodes = new 169 // ArrayList<DefaultMutableTreeNode>(); 170 List<String> listTargets1 = new ArrayList<String>(); // targets out of 171 // GlobalDataContainer 172 List<String> sortedTargets = new ArrayList<String>(); // targets will be 173 // sorted by 174 // number of 175 // parts, 176 // splitted at 177 // "/>" 178 179 try { 180 listTargets1 = (List<String>) GlobalDataContainer.getInstance() 181 .getData("ListTargets"); 182 } catch (ClassCastException e) { 183 Console.println("Not able to cast data in GlobalDataContainer to List of Strings"); 184 } 185 186 int parts = 1; 187 while (sortedTargets.size() < listTargets1.size()) { 188 for (int i = 0; i < listTargets1.size(); i++) { 189 String splitted[] = listTargets1.get(i).split("/>"); 190 191 // sort targets by number of parts 192 if (splitted.length != parts) 193 continue; 194 195 sortedTargets.add(listTargets1.get(i)); 196 197 // insert in tree 198 DefaultMutableTreeNode node = compareTargetWithNode(root, 199 listTargets1.get(i)); 200 201 if (node == null) { 202 DefaultMutableTreeNode newNode[] = new DefaultMutableTreeNode[splitted.length]; 203 204 for (int j = 0; j < splitted.length; j++) { 205 newNode[j] = new DefaultMutableTreeNode(splitted[j] 206 + "/>"); 207 208 if (j == 0) { 209 root.add(newNode[0]); 210 } else { 211 newNode[j - 1].add(newNode[j]); 212 } 213 } 214 } else { 215 for (int j = 0; j < splitted.length; j++) { 216 if (node.toString().compareTo(splitted[j] + "/>") != 0) 217 continue; 218 219 DefaultMutableTreeNode newNode[] = new DefaultMutableTreeNode[splitted.length 220 - j - 1]; 221 for (int k = 0; k < newNode.length; k++) { 222 newNode[k] = new DefaultMutableTreeNode(splitted[j 223 + k + 1] 224 + "/>"); 225 226 if (k == 0) { 227 node.add(newNode[0]); 228 } else { 229 newNode[k - 1].add(newNode[k]); 230 } 231 } 232 } 233 } 234 } 235 parts++; 236 } 206 tree.getSelectionModel().setSelectionMode( 207 TreeSelectionModel.CONTIGUOUS_TREE_SELECTION); 208 buildTargetTree(root); 209 237 210 scrollPane_1.setViewportView(tree); 238 211 239 if (listTargets.getComponentCount() > 0) 240 listTargets.setSelectedIndex(0); 241 242 panelFileEquals.setBounds(12, 400, 494, 120); 212 // expand all targets 213 JButton btnExpandAll = new JButton("Expand all"); 214 btnExpandAll.addMouseListener(new MouseAdapter() { 215 public void mouseClicked(MouseEvent arg0) { 216 217 expandAll(tree, new TreePath(root), true); 218 } 219 }); 220 btnExpandAll.setBounds(10, 360, 112, 30); 221 panelTextEquals.add(btnExpandAll); 222 223 // collapse all targets 224 JButton btnCollapseAll = new JButton("Collapse all"); 225 btnCollapseAll.addMouseListener(new MouseAdapter() { 226 public void mouseClicked(MouseEvent arg0) { 227 expandAll(tree, new TreePath(root), false); 228 } 229 }); 230 btnCollapseAll.setBounds(132, 360, 112, 30); 231 panelTextEquals.add(btnCollapseAll); 232 233 panelFileEquals.setBounds(34, 452, 607, 120); 243 234 contentPanel.add(panelFileEquals); 244 235 panelFileEquals.setLayout(null); … … 250 241 251 242 textFieldActualFile = new JTextField(); 252 textFieldActualFile.setBounds(10, 30, 474, 20);243 textFieldActualFile.setBounds(10, 30, 587, 20); 253 244 panelFileEquals.add(textFieldActualFile); 254 245 textFieldActualFile.setColumns(10); 255 246 256 JButton btnNewButton = new JButton("Search file"); 257 btnNewButton.addMouseListener(new MouseAdapter() { 247 // open search file dialog 248 JButton btnSearchFile = new JButton("Search file"); 249 btnSearchFile.addMouseListener(new MouseAdapter() { 258 250 public void mouseClicked(MouseEvent arg0) { 259 251 final JFileChooser fc = new JFileChooser(); … … 264 256 } 265 257 }); 266 btn NewButton.setBounds(93, 61, 89, 23);267 panelFileEquals.add(btn NewButton);258 btnSearchFile.setBounds(93, 61, 89, 23); 259 panelFileEquals.add(btnSearchFile); 268 260 269 261 JLabel lblNewLabel_1 = new JLabel("Expected file:"); … … 273 265 textFieldExpectedFile = new JTextField(); 274 266 textFieldExpectedFile.setColumns(10); 275 textFieldExpectedFile.setBounds(10, 88, 474, 20);267 textFieldExpectedFile.setBounds(10, 88, 587, 20); 276 268 panelFileEquals.add(textFieldExpectedFile); 269 277 270 { 278 JPanel buttonPane = new JPanel();279 271 buttonPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, 280 272 null)); 281 buttonPane.setBounds(12, 5 31, 494, 51);273 buttonPane.setBounds(12, 583, 607, 51); 282 274 contentPanel.add(buttonPane); 283 275 { 284 // JButton: okButton 285 JButton okButton = new JButton("Insert"); 286 okButton.setBounds(349, 11, 135, 31); 276 // clicking 'Insert' 277 okButton.setBounds(462, 11, 135, 31); 287 278 okButton.addMouseListener(new MouseAdapter() { 288 279 public void mouseClicked(MouseEvent arg0) { 289 290 // FileEquals 291 if (panelFileEquals.isVisible()) { 292 if (textFieldActualFile.getText().length() == 0) 293 JOptionPane.showMessageDialog(null, 294 "Please declare an actual file.", 295 "No actual file declared", 296 JOptionPane.OK_OPTION); 297 else if (!new File(textFieldExpectedFile.getText()) 298 .exists()) { 299 if (textFieldExpectedFile.getText().length() == 0) 300 JOptionPane.showMessageDialog(null, 301 "Please choose an expected file.", 302 "No expected file chosen", 303 JOptionPane.OK_OPTION); 304 else 305 JOptionPane.showMessageDialog( 306 null, 307 "The expected file \"" 308 + textFieldActualFile 309 .getText() 310 + "\" does not exist.", 311 "Expected file does not exist", 312 JOptionPane.OK_OPTION); 313 return; 314 } else { 315 FileEqualsReplay file = new FileEqualsReplay(); 316 file.setActualFile(textFieldActualFile 317 .getText()); 318 file.setExpectedFile(textFieldExpectedFile 319 .getText()); 320 321 AssertEvent<FileEqualsReplay> e = new AssertEvent<FileEqualsReplay>( 322 "FileEquals"); 323 e.addReplayEvent(file); 324 e.setTarget(" "); 325 if (insertBefore) 326 sequences.add(selectedIndex, e); 327 else 328 sequences.add(selectedIndex + 1, e); 329 } 330 } 331 // TextEquals 332 else { 333 if (textFieldExpectedValue.getText().length() == 0) { 334 JOptionPane 335 .showMessageDialog( 336 null, 337 "\"Expected value\" is missing.", 338 "Expected value", 339 JOptionPane.OK_OPTION); 340 return; 341 } else if (listTargets.getSelectedIndex() == -1) { 342 JOptionPane.showMessageDialog(null, 343 "Please select a target.", 344 "No target selected", 345 JOptionPane.OK_OPTION); 346 return; 347 } else { 348 TextEqualsReplay text = new TextEqualsReplay(); 349 text.setExpectedValue(textFieldExpectedValue 350 .getText()); 351 text.setTarget(modelListTargets.get( 352 listTargets.getSelectedIndex()) 353 .toString()); 354 355 AssertEvent<TextEqualsReplay> e = new AssertEvent<TextEqualsReplay>( 356 "TextEquals"); 357 e.addReplayEvent(text); 358 e.setTarget(" "); 359 if (insertBefore) 360 sequences.add(selectedIndex, e); 361 else 362 sequences.add(selectedIndex + 1, e); 363 } 280 if (insertAssertion(sequences, selectedIndex, 281 insertBefore, tree, comboBoxAssertionType 282 .getSelectedItem().toString()) == false) { 283 return; 364 284 } 365 285 … … 371 291 buttonPane.add(okButton); 372 292 getRootPane().setDefaultButton(okButton); 373 // ***374 293 } 375 294 376 295 { 377 // JButton: cancelButton296 // clicking 'Cancel' 378 297 JButton cancelButton = new JButton("Cancel"); 379 298 cancelButton.setBounds(10, 11, 135, 31); … … 386 305 cancelButton.setActionCommand("Cancel"); 387 306 buttonPane.add(cancelButton); 388 // *** 389 } 390 } 391 // *** 392 } 393 307 } 308 } 309 310 selectAssertionType(numberOfAssertionTypes, panels, 311 comboBoxAssertionType.getSelectedIndex(), 312 buttonPane, okButton); 313 } 314 315 /** 316 * Build up the tree containing all available targets. 317 * 318 * @param root 319 * The tree root. 320 */ 321 @SuppressWarnings("unchecked") 322 private void buildTargetTree(final DefaultMutableTreeNode root) { 323 // get targets from GlobalDataContainer 324 SortedSet<String> listTargets = new TreeSet<String>(); 325 try { 326 listTargets = (SortedSet<String>) GlobalDataContainer.getInstance() 327 .getData("ListTargets"); 328 } catch (ClassCastException e) { 329 Console.println("Not able to cast data in GlobalDataContainer to SortedSet of Strings"); 330 } 331 332 // build the tree 333 for (String target : listTargets) { 334 DefaultMutableTreeNode currentParent = root; 335 336 String splitted[] = target.split("/>"); 337 338 for (String targetPart : splitted) { 339 DefaultMutableTreeNode node = compareTargetWithNode( 340 currentParent, targetPart + "/>"); 341 342 if (node != null) { 343 currentParent = node; 344 } else { 345 node = new DefaultMutableTreeNode(targetPart + "/>"); 346 currentParent.add(node); 347 currentParent = node; 348 } 349 } 350 } 351 } 352 353 /** 354 * Check if there is a child equal to 'target'. 355 * 356 * @param node 357 * The parent node which is browsed for a node equal to 'target'. 358 * @param target 359 * 'node' is browsed for this String. 360 * @return If there was no fitting node found, the return value is null. 361 * Otherwise it is the node. 362 */ 394 363 DefaultMutableTreeNode compareTargetWithNode(DefaultMutableTreeNode node, 395 364 String target) { … … 407 376 e.nextElement(), target); 408 377 if (nodeReturn == null) { 409 if (target.contains(node.toString())) 378 if (target.contains(node.toString())) { 410 379 return node; 411 } else 380 } 381 } else { 412 382 return nodeReturn; 383 } 413 384 } 414 385 } … … 416 387 return null; 417 388 } 389 390 /** 391 * Expand or collapse the target tree. 392 * 393 * @param tree 394 * The tree itself. 395 * @param parent 396 * The parent node which has to be expanded/collapsed. 397 * @param expand 398 * To choose wether it is expanded or collapsed. 399 */ 400 private void expandAll(JTree tree, TreePath parent, boolean expand) { 401 // Traverse children 402 TreeNode node = (TreeNode) parent.getLastPathComponent(); 403 if (node.getChildCount() >= 0) { 404 for (@SuppressWarnings("unchecked") 405 Enumeration<DefaultMutableTreeNode> e = node.children(); e 406 .hasMoreElements();) { 407 TreeNode n = (TreeNode) e.nextElement(); 408 TreePath path = parent.pathByAddingChild(n); 409 expandAll(tree, path, expand); 410 } 411 } 412 413 // Expansion or collapse must be done bottom-up 414 if (expand) { 415 tree.expandPath(parent); 416 } else { 417 tree.collapsePath(parent); 418 } 419 } 420 421 /** 422 * Select another assertion type in the comboBox. 423 * 424 * @param numberOfAssertionTypes 425 * Number of available assertion types. 426 * @param panels 427 * The corresponding panels of the types. 428 * @param selectedIndex 429 * The index of the selected type. 430 * @param buttonPane 431 * The buttonPane of the dialog. 432 * @param okButton 433 * The okButton of the buttonPane. 434 */ 435 private void selectAssertionType(final int numberOfAssertionTypes, 436 final JPanel[] panels, int selectedIndex, final JPanel buttonPane, 437 final JButton okButton) { 438 for (int i = 0; i < numberOfAssertionTypes; i++) { 439 panels[i].setVisible(false); 440 } 441 442 JPanel activePanel = panels[selectedIndex]; 443 activePanel.setVisible(true); 444 activePanel.setLocation(10, 40); 445 446 buttonPane.setLocation(activePanel.getX(), activePanel.getY() 447 + activePanel.getHeight() + 15); 448 buttonPane.setSize(activePanel.getWidth(), buttonPane.getHeight()); 449 setSize(activePanel.getX() + activePanel.getSize().width + 15, 450 buttonPane.getY() + buttonPane.getSize().height + 35); 451 okButton.setLocation(buttonPane.getWidth() - okButton.getWidth() - 10, 452 okButton.getY()); 453 454 } 455 456 /** 457 * To check if all the parameters needed where entered correctly. 458 * 459 * @param sequences 460 * A list of the events where an assertion will be inserted. 461 * @param selectedIndex 462 * The position for inserting an assertion. 463 * @param insertBefore 464 * To decide if the user clicked 'insert before' or 'insert 465 * after'. 466 * @param tree 467 * The target tree. 468 * @param selectedItem 469 * To identify the selected assertion type. 470 * @return If the assertion was inserted, the return value is true. 471 * Otherwise it is false. 472 */ 473 private boolean insertAssertion(final List<Event<?>> sequences, 474 final int selectedIndex, final boolean insertBefore, 475 final JTree tree, final String selectedItem) { 476 477 // FileEquals 478 if (selectedItem == "OutputFileEquals") { 479 if (textFieldActualFile.getText().length() == 0) { 480 JOptionPane.showMessageDialog(null, 481 "Please declare an actual file.", 482 "No actual file declared", JOptionPane.OK_OPTION); 483 484 return false; 485 } else if (!new File(textFieldExpectedFile.getText()).exists()) { 486 if (textFieldExpectedFile.getText().length() == 0) { 487 JOptionPane.showMessageDialog(null, 488 "Please choose an expected file.", 489 "No expected file chosen", JOptionPane.OK_OPTION); 490 } else { 491 JOptionPane.showMessageDialog(null, "The expected file \"" 492 + textFieldActualFile.getText() 493 + "\" does not exist.", 494 "Expected file does not exist", 495 JOptionPane.OK_OPTION); 496 } 497 498 return false; 499 } else { 500 FileEqualsReplay file = new FileEqualsReplay(); 501 file.setActualFile(textFieldActualFile.getText()); 502 file.setExpectedFile(textFieldExpectedFile.getText()); 503 504 AssertEvent<FileEqualsReplay> e = new AssertEvent<FileEqualsReplay>( 505 "FileEquals"); 506 e.addReplayEvent(file); 507 e.setTarget(" "); 508 if (insertBefore) 509 sequences.add(selectedIndex, e); 510 else 511 sequences.add(selectedIndex + 1, e); 512 } 513 } 514 // TextEquals 515 else if (selectedItem == "TextEquals") { 516 if (textFieldExpectedValue.getText().length() == 0) { 517 JOptionPane.showMessageDialog(null, 518 "\"Expected value\" is missing.", "Expected value", 519 JOptionPane.OK_OPTION); 520 return false; 521 } else if (tree.getSelectionCount() == 0 522 || tree.getSelectionPath().toString() 523 .compareTo("[Targets]") == 0) { 524 JOptionPane.showMessageDialog(null, "Please select a target.", 525 "No target selected", JOptionPane.OK_OPTION); 526 return false; 527 } else { 528 529 // get target *** 530 String selectionPath = tree.getSelectionPath().toString(); 531 532 // remove leading and ending brackets 533 selectionPath = selectionPath.substring(1); 534 selectionPath = selectionPath.substring(0, 535 selectionPath.length() - 1); 536 // remove leading string "targets" 537 selectionPath = selectionPath.substring(7); 538 539 String splitted[] = selectionPath.toString().split(", "); 540 541 // get all parents 542 String target = ""; 543 for (int i = 0; i < splitted.length; i++) { 544 target += splitted[i]; 545 } 546 // *** 547 548 TextEqualsReplay text = new TextEqualsReplay(); 549 text.setExpectedValue(textFieldExpectedValue.getText()); 550 text.setTarget(target); 551 552 AssertEvent<TextEqualsReplay> e = new AssertEvent<TextEqualsReplay>( 553 "TextEquals"); 554 e.addReplayEvent(text); 555 e.setTarget(" "); 556 if (insertBefore) 557 sequences.add(selectedIndex, e); 558 else 559 sequences.add(selectedIndex + 1, e); 560 } 561 } 562 563 return true; 564 } 418 565 }
Note: See TracChangeset
for help on using the changeset viewer.