Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem#expand()
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem#expand() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwtBotProjectHelper.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public static SWTBotTreeItem expandNode(final AbstractSWTBot<?> bot, final String node) { SWTBotTreeItem item = null; if ((bot instanceof SWTBotTree)) { item = ((SWTBotTree)bot).getTreeItem(node); } else { if ((bot instanceof SWTBotTreeItem)) { item = ((SWTBotTreeItem)bot).getNode(node); } } boolean _isExpanded = item.isExpanded(); boolean _not = (!_isExpanded); if (_not) { item.expand(); } return item; }
Example 2
Source File: ProjectExplorerTraceActionsTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static void verifyExperimentCopy(SWTBotTreeItem copiedExpItem, boolean isDeepCopied) { SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); tracesFolder.expand(); SWTBotTreeItem[] traceItems = tracesFolder.getItems(); copiedExpItem.expand(); if (isDeepCopied) { /* * Traces folder should contain the previous two traces and the new folder for * the copied traces */ assertEquals(3, traceItems.length); copiedExpItem.getNode(RENAMED_EXP_DEEP_COPY + '/' + TRACE_NAME); copiedExpItem.getNode(RENAMED_EXP_DEEP_COPY + '/' + RENAMED_AS_NEW_TRACE_NAME); SWTBotTreeItem deepCopiedExpTracesFolder = SWTBotUtils.getTraceProjectItem(fBot, tracesFolder, RENAMED_EXP_DEEP_COPY); deepCopiedExpTracesFolder.expand(); SWTBotTreeItem[] expTracesFolderItems = deepCopiedExpTracesFolder.getItems(); assertEquals(2, expTracesFolderItems.length); for (SWTBotTreeItem traceItem : expTracesFolderItems) { testLinkStatus(traceItem, false); } } else { assertEquals(2, traceItems.length); copiedExpItem.getNode(TRACE_NAME); copiedExpItem.getNode(RENAMED_AS_NEW_TRACE_NAME); } }
Example 3
Source File: SwtBotTreeActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Blocks the caller until the tree item has the given item text. * * @param tree the tree item to search * @param nodeText the item text to look for * @throws org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException if the item could not * be found within the timeout period */ private static void waitUntilTreeItemHasItem(SWTBot bot, final SWTBotTreeItem tree, final String nodeText) { // Attempt #1 if (!waitUntilTreeHasItemImpl(bot, tree.widget, nodeText)) { // Attempt #2: Something went wrong, try to cautiously reopen it. bot.sleep(1000); // There isn't a method to collapse, so double-click instead tree.doubleClick(); bot.waitUntil(new TreeCollapsedCondition(tree.widget)); bot.sleep(1000); tree.expand(); bot.waitUntil(new TreeExpandedCondition(tree.widget)); if (!waitUntilTreeHasItemImpl(bot, tree.widget, nodeText)) { printTree(tree.widget); throw new TimeoutException( String.format("Timed out waiting for %s, giving up...", nodeText)); } } }
Example 4
Source File: SmartImportBdmIT.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_import_when_bdm_are_not_confilicting() throws Exception { BotApplicationWorkbenchWindow workbenchBot = new BotApplicationWorkbenchWindow(bot); ImportBdmWizardBot importBot = workbenchBot.importBDM(); importBot.setArchive(getFileURL("/smartImport/model_not_conflicting.zip")); SWTBotTree importTree = bot.tree(); bot.waitUntil(importBot.treeItemAvailable(importTree, BUSINESS_PACKAGE)); bot.waitUntil(importBot.treeItemAvailable(importTree, String.format("%s (%s)", HUMAN_PACKAGE, Messages.skipped))); assertThat(bot.button(org.bonitasoft.studio.ui.i18n.Messages.importLabel).isEnabled()).isTrue(); SWTBotTreeItem treeItem = importTree.getTreeItem(BUSINESS_PACKAGE); treeItem.expand(); bot.waitUntil(importBot.treeNodeAvailable(treeItem, ACCOUNT_BO)); bot.waitUntil(importBot.treeNodeAvailable(treeItem, String.format("%s (%s)", LOAN_BO, Messages.skipped))); importBot.doImport(); BusinessObjectModelFileStore fileStore = (BusinessObjectModelFileStore) repositoryStore.getChild("bom.xml", true); assertThat(fileStore.getContent().getBusinessObjects()).extracting(BusinessObject::getQualifiedName) .containsExactlyInAnyOrder(toQualifiedName(BUSINESS_PACKAGE, LOAN_BO), toQualifiedName(BUSINESS_PACKAGE, ACCOUNT_BO), toQualifiedName(HUMAN_PACKAGE, PERSON_BO), toQualifiedName(HUMAN_PACKAGE, ADDRESS_BO)); }
Example 5
Source File: SmartImportBdmIT.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void should_overwrite_when_conflicts_are_not_solvable() throws Exception { BotApplicationWorkbenchWindow workbenchBot = new BotApplicationWorkbenchWindow(bot); ImportBdmWizardBot importBot = workbenchBot.importBDM(); importBot.setArchive(getFileURL("/smartImport/model_conflicting_not_ok.zip")); SWTBotTree importTree = bot.tree(); bot.waitUntil(importBot.treeItemAvailable(importTree, EMPLOYEE_PACKAGE)); bot.waitUntil(importBot.treeItemAvailable(importTree, BUSINESS_PACKAGE)); assertThat(bot.button(org.bonitasoft.studio.ui.i18n.Messages.importLabel).isEnabled()).isTrue(); SWTBotTreeItem businessTreeItem = importTree.getTreeItem(BUSINESS_PACKAGE); SWTBotTreeItem personTreeItem = importTree.getTreeItem(EMPLOYEE_PACKAGE); businessTreeItem.expand(); personTreeItem.expand(); bot.waitUntil(importBot.treeNodeAvailable(businessTreeItem, String.format(org.bonitasoft.studio.businessobject.i18n.Messages.conflictingWithSameObject, LOAN_BO))); bot.waitUntil(importBot.treeNodeAvailable(personTreeItem, String.format(org.bonitasoft.studio.businessobject.i18n.Messages.objectAlreadyExistsInAnotherPackage, PERSON_BO, "com.company.human"))); importBot.doImport(); BusinessObjectModelFileStore fileStore = (BusinessObjectModelFileStore) repositoryStore.getChild("bom.xml", true); assertThat(fileStore.getContent().getBusinessObjects()).extracting(BusinessObject::getQualifiedName) .containsExactlyInAnyOrder(toQualifiedName(BUSINESS_PACKAGE, LOAN_BO), toQualifiedName(EMPLOYEE_PACKAGE, PERSON_BO)); }
Example 6
Source File: CoreSwtbotTools.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Attempts to expand all nodes along the path specified by the node array parameter. * The method is copied from SWTBotTree with an additional check if the node is already expanded. * * @param bot * tree bot, must not be {@code null} * @param nodes * node path to expand, must not be {@code null} or empty * @return the last tree item that was expanded, or {@code null} if no item was found */ public static SWTBotTreeItem expandNode(final SWTBotTree bot, final String... nodes) { Assert.isNotNull(bot, ARGUMENT_BOT); Assert.isNotNull(nodes, ARGUMENT_NODES); assertArgumentIsNotEmpty(nodes, ARGUMENT_NODES); new SWTBot().waitUntil(widgetIsEnabled(bot)); SWTBotTreeItem item = bot.getTreeItem(nodes[0]); if (!item.isExpanded()) { item.expand(); } final List<String> asList = new ArrayList<String>(Arrays.asList(nodes)); asList.remove(0); if (!asList.isEmpty()) { item = expandNode(item, asList.toArray(new String[asList.size()])); } return item; }
Example 7
Source File: SwtBotWizardUtil.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Select a tree item. * * @param treeItem * the tree node * @param name * the name of the item to look for * @return true, if item was found and selected */ private static boolean selectTreeItem(final SWTBotTreeItem treeItem, final String name) { if (name.equals(treeItem.getText())) { treeItem.select(); return true; } if (!treeItem.isExpanded()) { treeItem.expand(); } for (SWTBotTreeItem item : treeItem.getItems()) { if (selectTreeItem(item, name)) { return true; } } return false; }
Example 8
Source File: CoreSwtbotTools.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Expands the node matching the given node texts. * The method is copied from SWTBotTreeItem with an additional check if the node is already expanded. * * @param bot * tree item bot, must not be {@code null} * @param nodes * the text on the node, must not be {@code null} or empty * @return the last tree node that was expanded, never {@code null} */ public static SWTBotTreeItem expandNode(final SWTBotTreeItem bot, final String... nodes) { Assert.isNotNull(bot, ARGUMENT_BOT); Assert.isNotNull(nodes, ARGUMENT_NODES); assertArgumentIsNotEmpty(nodes, ARGUMENT_NODES); SWTBotTreeItem item = bot; for (String node : nodes) { item = item.getNode(node); if (!item.isExpanded()) { item.expand(); } } return item; }
Example 9
Source File: ProjectExplorerAnalysisTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static Set<AnalysisNode> getAnalysisNodes(SWTWorkbenchBot bot, String name, boolean isExperiment) { SWTBotTreeItem traceNode = getExpandedTraceNode(bot, name, isExperiment); SWTBotTreeItem viewNode = traceNode.getNode("Views"); viewNode.expand(); SWTBotTreeItem[] analysisNodes = viewNode.getItems(); assertNotNull(analysisNodes); int length = analysisNodes.length; Set<AnalysisNode> actualNodes = new HashSet<>(); for (int i = 0; i < length; i++) { SWTBotTreeItem analysisNode = analysisNodes[i]; actualNodes.add(new AnalysisNode(analysisNode.getText(), analysisNode.isEnabled(), analysisNode.isVisible())); } return actualNodes; }
Example 10
Source File: FetchRemoteTracesTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static void openRemoteProfilePreferences() { SWTBotShell preferencesShell = SWTBotUtils.openPreferences(fBot); // The first tree is the preference "categories" on the left side SWTBot bot = preferencesShell.bot(); SWTBotTree tree = bot.tree(0); SWTBotTreeItem treeNode = tree.getTreeItem("Tracing"); treeNode.select(); treeNode.expand(); bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable("Remote Profiles", treeNode)); treeNode = treeNode.getNode("Remote Profiles"); treeNode.select(); }
Example 11
Source File: XMLAnalysesManagerPreferencePageTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static SWTBotShell openXMLAnalysesPreferences() { SWTBotShell preferencesShell = SWTBotUtils.openPreferences(fBot, MANAGE_XML_ANALYSES_PREF_TITLE); SWTBot bot = preferencesShell.bot(); SWTBotTree tree = bot.tree(0); SWTBotTreeItem treeNode = tree.getTreeItem("Tracing"); treeNode.select(); treeNode.expand(); bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable("XML Analyses", treeNode)); treeNode = treeNode.getNode("XML Analyses"); treeNode.select(); return preferencesShell; }
Example 12
Source File: ProjectExplorerTraceActionsTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test that removing a trace from an experiment: removes it from the experiment * but does not delete the experiment if empty, keeps in in the Traces folders */ @Test public void test4_12RemoveTraceFromExperiment() { /* * close the editor for the trace to avoid name conflicts with the one for the * experiment */ fBot.closeAllEditors(); // create experiment SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); traceItem.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, TRACE_NAME)); // find the trace under the experiment fBot.viewByTitle(PROJECT_EXPLORER_VIEW_NAME).setFocus(); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable("ExampleCustomTxt.log [1]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "ExampleCustomTxt.log [1]"); expItem.expand(); SWTBotTreeItem expTrace = expItem.getNode(TRACE_NAME); // remove the trace from the experiment expTrace.contextMenu().menu("Remove").click(); SWTBotShell shell = fBot.shell("Confirm Remove").activate(); shell.bot().button("Yes").click(); fBot.waitUntil(Conditions.shellCloses(shell), DISK_ACCESS_TIMEOUT); // ensure that it is properly removed from the experiment. SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "ExampleCustomTxt.log [0]"); // ensure that the trace still exists in the Traces folder SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); }
Example 13
Source File: BotTreeView.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void selectFirstSequenceFlow(final String pPool) { waitUntilPoolDisplayed(pPool); final SWTBotTreeItem treeItem = overviewTree.getTreeItem(pPool); if (!treeItem.isExpanded()) { treeItem.expand(); } treeItem.select("Sequence Flow"); }
Example 14
Source File: TraceTypePreferencePageTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static List<String> getSelectTraceTypeMenuItems() { SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); tracesFolder.expand(); SWTBotTreeItem trace = tracesFolder.getNode("syslog_collapse"); trace.select(); List<String> menuItems = trace.contextMenu().menu("Select Trace Type...").menuItems(); return menuItems; }
Example 15
Source File: TraceTypePreferencePageTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static SWTBotShell openTraceTypePreferences() { SWTBotShell preferencesShell = SWTBotUtils.openPreferences(fBot); SWTBot bot = preferencesShell.bot(); SWTBotTree tree = bot.tree(0); SWTBotTreeItem treeNode = tree.getTreeItem("Tracing"); treeNode.select(); treeNode.expand(); bot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable("Trace Types", treeNode)); treeNode = treeNode.getNode("Trace Types"); treeNode.select(); return preferencesShell; }
Example 16
Source File: BotBdmModelEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public BotBdmModelEditor renameBusinessObject(String packageName, String oldName, String newName) { SWTBotTree businessObjectTree = getBusinessObjectTree(); bot.waitUntil(treeItemAvailable(businessObjectTree, packageName)); SWTBotTreeItem packageItem = businessObjectTree.getTreeItem(packageName); packageItem.expand(); bot.waitUntil(nodeAvailable(packageItem, oldName)); packageItem.getNode(oldName).click(); bot.textWithId(SWTBOT_ID_BO_NAME_TEXTEDITOR) .setText(newName) .pressShortcut(Keystrokes.CR); businessObjectTree.setFocus(); return this; }
Example 17
Source File: SwtBotProjectActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static void deleteLaunchConfigs(final SWTWorkbenchBot bot) { SwtBotUtils.print("\tDeleting launch configs"); SwtBotLaunchManagerActions.terminateAllLaunchConfigs(bot); SwtBotMenuActions.openDebugConfiguration(bot); // TODO change to Messages.get SWTBotTreeItem subTree = bot.tree(0).getTreeItem("GWT Development Mode (DevMode)"); subTree.expand(); SWTBotTreeItem[] items = subTree.getItems(); if (items != null && items.length > 0) { for (int i=0; i < items.length; i++) { SwtBotUtils.print("\t\tDeleting launcher i=" + i); items[i].contextMenu("Delete").click(); SwtBotUtils.performAndWaitForWindowChange(bot, new Runnable() { @Override public void run() { bot.button("Yes").click(); } }); bot.sleep(500); } } bot.button("Close").click(); SwtBotUtils.print("\tDeleted launch configs"); }
Example 18
Source File: FilterViewerTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Return all timestamps ending with 100... for reasons */ @Test public void testTimestampFilter() { SWTBotView viewBot = fBot.viewById(FilterView.ID); viewBot.setFocus(); SWTBot filterBot = viewBot.bot(); SWTBotTree treeBot = filterBot.tree(); viewBot.toolbarButton("Add new filter").click(); treeBot.getTreeItem("FILTER <name>").select(); SWTBotText textBot = filterBot.text(); textBot.setFocus(); String filterName = "timestamp"; textBot.setText(filterName); SWTBotTreeItem filterNodeBot = treeBot.getTreeItem(FILTER_TEST + filterName); filterNodeBot.click(); filterNodeBot.contextMenu("TRACETYPE").click(); filterNodeBot.expand(); SWTBotCCombo comboBot = filterBot.ccomboBox(); comboBot.setSelection(TRACETYPE); filterNodeBot.getNode(WITH_TRACETYPE).expand(); // -------------------------------------------------------------------- // add AND // -------------------------------------------------------------------- filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(AND).click(); // -------------------------------------------------------------------- // add CONTAINS "100" // -------------------------------------------------------------------- filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).contextMenu(CONTAINS).click(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).expand(); comboBot = filterBot.ccomboBox(1); // aspect comboBot.setSelection(TIMESTAMP); textBot = filterBot.text(); textBot.setFocus(); textBot.setText("100"); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).getNode("Timestamp CONTAINS \"100\"").select(); filterNodeBot.getNode(WITH_TRACETYPE).getNode(AND).select(); viewBot.toolbarButton("Save filters").click(); String ret = applyFilter(fBot, filterName); assertEquals("10/100", ret); }
Example 19
Source File: BotBdmIndexesEditor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void selectBusinessObject(String packageName, String businessObject) { SWTBotTreeItem packageItem = getBusinessObjectTree().getTreeItem(packageName); packageItem.expand(); packageItem.getNode(businessObject).select(); }
Example 20
Source File: AbstractOutlineViewTest.java From dsl-devkit with Eclipse Public License 1.0 | 2 votes |
/** * Expands the given {@link SWTBotTreeItem} if it is not expanded already. * * @param treeItem * the tree item to be expanded */ protected void expandIfNotExpanded(final SWTBotTreeItem treeItem) { if (!treeItem.isExpanded()) { treeItem.expand(); } }