Source:
<code>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(); <START> checkExpectedElementsInSelection(editor, null, 0, false); <END> 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); }</code><technical_language>for diagram, for reveal created view select for hidden views, for tree/table want reveal created view select parent DTreeItem/DLine expanded, this is default for DLine for DTreeItem</technical_language>

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); }