Index: trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertTextEquals.java
===================================================================
--- trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertTextEquals.java	(revision 655)
+++ trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/InsertTextEquals.java	(revision 659)
@@ -1,5 +1,6 @@
+
 package de.ugoe.cs.quest.ui.swt;
 
-import java.util.SortedSet;
+import java.util.List;
 
 import org.eclipse.swt.widgets.Composite;
@@ -14,6 +15,9 @@
 
 import de.ugoe.cs.quest.assertions.TextEqualsAssertEventType;
+import de.ugoe.cs.quest.assertions.TextEqualsReplay;
 import de.ugoe.cs.quest.eventcore.Event;
-import de.ugoe.cs.util.ArrayTools;
+import de.ugoe.cs.quest.eventcore.IEventTarget;
+import de.ugoe.cs.quest.eventcore.guimodel.GUIModel;
+import de.ugoe.cs.quest.eventcore.guimodel.IGUIElement;
 
 import org.eclipse.swt.events.SelectionAdapter;
@@ -22,6 +26,5 @@
 public class InsertTextEquals extends AbstractInsertEventComposite {
     private Text expectedText;
-    private Tree targetTree;
-    private Text targetText;
+    private Tree guiTree;
 
     /**
@@ -31,6 +34,6 @@
      * @param style
      */
-    public InsertTextEquals(Composite parent, int style, SortedSet<String> targets) {
-        super(parent, style, targets);
+    public InsertTextEquals(Composite parent, int style, GUIModel guiModel) {
+        super(parent, style, guiModel);
         setLayout(new GridLayout(3, false));
 
@@ -42,32 +45,7 @@
         expectedText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
 
-        Label lblTargetWidget = new Label(this, SWT.NONE);
-        lblTargetWidget.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-        lblTargetWidget.setText("Target Widget:");
-
-        targetText = new Text(this, SWT.BORDER);
-        targetText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-        new Label(this, SWT.NONE);
-
-        targetTree = new Tree(this, SWT.BORDER);
-        targetTree.addSelectionListener(new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                TreeItem[] selection = targetTree.getSelection();
-                if (selection.length == 1) {
-                    TreeItem item = selection[0];
-                    String targetString = item.getText();
-                    item = item.getParentItem();
-                    while (item != null) {
-                        // TODO the "." is hard coded for the JFCMonitor. should be flexible
-                        targetString = item.getText() + "." + targetString;
-                        item = item.getParentItem();
-                    }
-                    targetText.setText(targetString);
-                }
-            }
-        });
-        targetTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
-        buildTargetTree();
+        guiTree = new Tree(this, SWT.BORDER);
+        guiTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
+        buildGuiTree();
         new Label(this, SWT.NONE);
 
@@ -76,5 +54,5 @@
             @Override
             public void widgetSelected(SelectionEvent e) {
-                expandAll(targetTree, true);
+                expandAll(guiTree, true);
             }
         });
@@ -85,5 +63,5 @@
             @Override
             public void widgetSelected(SelectionEvent e) {
-                expandAll(targetTree, false);
+                expandAll(guiTree, false);
             }
         });
@@ -99,49 +77,39 @@
     @Override
     public Event getEvent() {
-        // TODO make compatible to new event core
-        /*
-         * IEventTarget target = targetText.getText(); TextEqualsReplay replay = new
-         * TextEqualsReplay(expectedText.getText(), target);
-         */
-        Event event = new Event(new TextEqualsAssertEventType());
-        /*
-         * event.setTarget(target); event.addReplayable(replay);
-         */
+        // TODO possibly display error if no target is selected
+        TreeItem[] selection = guiTree.getSelection();
+        IEventTarget target = null;
+        TextEqualsReplay replay = null;
+        if (selection.length == 1) {
+            target = (IEventTarget) selection[0].getData();
+            replay = new TextEqualsReplay(expectedText.getText(), target.toString());
+        }
+
+        Event event = new Event(new TextEqualsAssertEventType(), target);
+
+        event.setTarget(target);
+        if (replay != null) {
+            event.addReplayable(replay);
+        }
+
         return event;
     }
 
-    private void buildTargetTree() {
-        for (String target : targets) {
-            TreeItem currentParent = null;
-            TreeItem[] currentItems = targetTree.getItems();
+    private void buildGuiTree() {
+        for (IGUIElement element : guiModel.getRootElements()) {
+            TreeItem child = new TreeItem(guiTree, SWT.NULL);
+            child.setText(element.toString());
+            child.setData(element);
+            buildGuiTree(child, guiModel.getChildren(element));
+        }
+    }
 
-            // TODO needs rule for target splitting. currently its hard coded for JFCEvent targets.
-            String[] targetParts = target.split("\\.\\[");
-            for (String targetPart : targetParts) {
-                String[] currentTexts = new String[currentItems.length];
-                for (int i = 0; i < currentItems.length; i++) {
-                    currentTexts[i] = currentItems[i].getText();
-                }
-                if (currentParent != null) {
-                    targetPart = "[" + targetPart;
-                }
-                int index = ArrayTools.findIndex(currentTexts, targetPart);
-                if (index >= 0) {
-                    currentParent = currentItems[index];
-                }
-                else {
-                    if (currentParent == null) {
-                        currentParent = new TreeItem(targetTree, SWT.NULL);
-                        currentParent.setText(targetPart);
-                    }
-                    else {
-                        currentParent = new TreeItem(currentParent, SWT.NULL);
-                        currentParent.setText(targetPart);
-                    }
-                }
-                currentItems = currentParent.getItems();
-            }
+    private void buildGuiTree(TreeItem currentParent, List<IGUIElement> elements) {
+        for (IGUIElement element : elements) {
+            TreeItem child = new TreeItem(currentParent, SWT.NULL);
+            child.setText(element.toString());
+            child.setData(element);
+            buildGuiTree(child, guiModel.getChildren(element));
         }
-
     }
 
