Source:
public void testSelectionAfterTreeItemCreationTool() { DTreeItem dTreeItem = treeClasses.getOwnedTreeItems().get(0); final String tool_Name = "Tree_CreateItem"; final AbstractToolDescription tool = getTool(tool_Name); changeSelectionExpression(tool, "[instance/]", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem, dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0, false); TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(dTreeItem); CommandStack commandStack = transactionalEditingDomain.getCommandStack(); Command expandCarDTreeItemCmd = SetCommand.create(transactionalEditingDomain, dTreeItem, TreePackage.Literals.DTREE_ITEM__EXPANDED, true); commandStack.execute(expandCarDTreeItemCmd); refresh(new EObjectQuery(dTreeItem).getRepresentation().get(), true); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0, false); changeSelectionExpression(tool, "", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem.getContainer(), dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); changeSelectionExpression(tool, "service:" + DslCommonPlugin.PLUGIN_ID + ".tools.api.interpreter.StandardServices", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem.getContainer(), dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); }

Target:
public void testSelectionAfterTreeItemCreationTool() { DTreeItem dTreeItem = treeClasses.getOwnedTreeItems().get(0); final String tool_Name = "Tree_CreateItem"; final AbstractToolDescription tool = getTool(tool_Name); changeSelectionExpression(tool, "[instance/]", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem, dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0, false); TransactionalEditingDomain transactionalEditingDomain = TransactionUtil.getEditingDomain(dTreeItem); CommandStack commandStack = transactionalEditingDomain.getCommandStack(); Command expandCarDTreeItemCmd = SetCommand.create(transactionalEditingDomain, dTreeItem, TreePackage.Literals.DTREE_ITEM__EXPANDED, true); commandStack.execute(expandCarDTreeItemCmd); refresh(new EObjectQuery(dTreeItem).getRepresentation().get(), true); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0, false); changeSelectionExpression(tool, "[instance/]", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem, dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 1, false); changeSelectionExpression(tool, "", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem.getContainer(), dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 1); changeSelectionExpression(tool, "[/]", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem.getContainer(), dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); changeSelectionExpression(tool, "service:stdEmptyCollection", false); TestsUtil.synchronizationWithUIThread(); applyTreeItemCreationTool(tool_Name, dTreeItem.getContainer(), dTreeItem.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); }