Changeset 1283 for trunk


Ignore:
Timestamp:
07/30/13 09:41:12 (11 years ago)
Author:
pharms
Message:
  • removed bug that did not allow merging root nodes in the GUI model
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIModel.java

    r1260 r1283  
    428428        // check if both nodes have the same parent 
    429429        IGUIElement parentElement = guiElement1.getParent(); 
    430         if (parentElement != null && !parentElement.equals(guiElement2.getParent())) { 
     430        boolean sameParent = (parentElement != null) ? 
     431            parentElement.equals(guiElement2.getParent()) : (guiElement2.getParent() == null); 
     432             
     433        if (!sameParent) { 
    431434            throw new IllegalArgumentException("can only merge nodes with the same parent"); 
    432435        } 
     
    434437        // get the TreeNode of the parent of the GUI elements 
    435438        TreeNode parent = findNode(parentElement); 
     439         
     440        if ((parent == null) && (parentElement == null)) { 
     441            // merging root nodes. The parent is the root node of the GUI element tree 
     442            parent = root; 
     443        } 
    436444 
    437445        // get the TreeNodes for both GUI elements 
Note: See TracChangeset for help on using the changeset viewer.