/** * Select the tab defined in the PEE. * * @param propertiesEditionElement PropertiesEditionElement */ protected void initTab(PropertiesEditionElement propertiesEditionElement) { assertFalse(propertiesEditionElement.getViews().isEmpty()); if (EEFModelHelper.getComponent(propertiesEditionElement).getViews().size() > 1) { final ElementEditor elementEditor = propertiesEditionElement.getViews().get(0); final View view = EEFModelHelper.getView(elementEditor); if (view.getName() != null) { cTabItem(view.getName()).activate(); cTabItem(view.getName()).setFocus(); } } }
/** * Add ReferenceableObject. * * @param referenceableObject * @param eContainingFeature * @return */ private EObject add( ReferenceableObject referenceableObject, final EStructuralFeature eContainingFeature) { assertNotNull("The editeur is not opened.", editor); final EObject container = getEObjectFromReferenceableEObject(referenceableObject); assertNotNull("No container is found to launch add action.", container); final SWTBotTreeItem selectNode = selectNode(editor, container); assertNotNull("No element is selected in the editor", selectNode); SWTBotHelper.clickContextMenu(selectNode, eContainingFeature.getEType().getName()); SWTBotHelper.waitAllUiEvents(); return (EObject) EEFModelHelper.eGet(container, eContainingFeature); }
/** * Select the given element in the given editor. * * @param editor the editor where the bot must process * @param element the element to select * @return the selected node */ public SWTBotTreeItem selectNode(SWTBotTree tree, EObject element) { assertNotNull("The model has not been initialized.", testModelResource); final List<Object> expansionPath = EEFModelHelper.getExpansionPath(element); final Iterator<Object> iterator = expansionPath.iterator(); Object next = null; SWTBotTreeItem node2 = tree.getTreeItem(testModelResource.getURI().toString()); while (iterator.hasNext()) { node2.expand(); next = iterator.next(); node2 = selectSubNode(node2, next); } return node2; }
/** * Add PropertiesEditionElement. * * @param propertiesEditionElement * @param referenceableObject * @return */ private EObject add( PropertiesEditionElement propertiesEditionElement, ReferenceableObject referenceableObject) { SWTBotHelper.waitAllUiEvents(); assertNotNull("The editeur is not opened.", editor); final EObject container = getEObjectFromReferenceableEObject(referenceableObject); assertNotNull("No container is found to launch wizard.", container); SWTBotHelper.waitAllUiEvents(); final SWTBotTreeItem selectNode = selectNode(editor, container); assertNotNull("No element is selected in the editor", selectNode); initTab(propertiesEditionElement); assertFalse("The set action must be define in a sequence.", sequenceType == null); propertiesEdition.addFeature(selectNode, propertiesEditionElement, sequenceType); SWTBotHelper.waitAllUiEvents(); return (EObject) EEFModelHelper.eGet(container, propertiesEditionElement.getModel()); }