ss: Move plugins to Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ctf.ui.swtbot.tests / src / org / eclipse / linuxtools / tmf / ctf / ui / swtbot / tests / AbstractImportAndReadSmokeTest.java
index 5b1838baf28ab877b52aa3aa90b6b4438f804c01..12803adb1950f32ec5940835371d4c504f3d3759 100644 (file)
@@ -30,6 +30,7 @@ import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfEvent;
 import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTrace;
 import org.eclipse.linuxtools.tmf.ctf.core.tests.shared.CtfTmfTestTrace;
 import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTracesFolder;
 import org.eclipse.linuxtools.tmf.ui.swtbot.tests.SWTBotUtil;
 import org.eclipse.linuxtools.tmf.ui.swtbot.tests.conditions.ConditionHelpers;
 import org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramView;
@@ -137,9 +138,12 @@ public abstract class AbstractImportAndReadSmokeTest {
 
     /**
      * Opens and get the TmfEventsEditor
+     *
+     * @param elementPath
+     *            the trace element path (relative to Traces folder)
      * @return TmfEventsEditor
      */
-    protected TmfEventsEditor openEditor() {
+    protected TmfEventsEditor openEditor(IPath elementPath) {
         final SWTBotView projectExplorerBot = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
         projectExplorerBot.setFocus();
 
@@ -147,29 +151,24 @@ public abstract class AbstractImportAndReadSmokeTest {
         final SWTBotTreeItem treeItem = tree.getTreeItem(getProjectName());
         treeItem.expand();
 
-        String nodeName = getFullNodeName(treeItem, "Traces");
+        String nodeName = getFullNodeName(treeItem, TmfTracesFolder.TRACES_FOLDER_NAME);
         fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, treeItem));
         SWTBotTreeItem tracesNode = treeItem.getNode(nodeName);
         tracesNode.expand();
 
-
-        SWTBotTreeItem traceParentNode = tracesNode;
-
-        if (supportsFolderStructure()) {
-            String nodeFolderName = getFullNodeName(tracesNode, TRACE_FOLDER);
-            fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeFolderName, tracesNode));
-            SWTBotTreeItem traceFolder = tracesNode.getNode(nodeFolderName);
-            traceFolder.select();
-            traceFolder.doubleClick();
-            traceParentNode = traceFolder;
+        SWTBotTreeItem currentNode = tracesNode;
+        for (String segment : elementPath.segments()) {
+            String fullNodeName = getFullNodeName(currentNode, segment);
+            fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(fullNodeName, currentNode));
+            SWTBotTreeItem newNode = currentNode.getNode(fullNodeName);
+            newNode.select();
+            newNode.doubleClick();
+            currentNode = newNode;
         }
 
-        fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(TRACE_NAME, traceParentNode));
-        traceParentNode.getNode(TRACE_NAME).select();
-        traceParentNode.getNode(TRACE_NAME).doubleClick();
         SWTBotUtil.delay(1000);
         SWTBotUtil.waitForJobs();
-        final String expectedTitle = supportsFolderStructure() ? TRACE_FOLDER + IPath.SEPARATOR + TRACE_NAME : TRACE_NAME;
+        final String expectedTitle = elementPath.toString();
 
         final IEditorPart iep[] = new IEditorPart[1];
         UIThreadRunnable.syncExec(new VoidResult() {
@@ -218,13 +217,6 @@ public abstract class AbstractImportAndReadSmokeTest {
      */
     protected abstract String getProjectName();
 
-    /**
-     * Returns whether or not that test support folder structure
-     *
-     * @return true if the test supports folder structure, false otherwise
-     */
-    protected abstract boolean supportsFolderStructure();
-
     // ---------------------------------------------
     // Helpers for testing views
     // ---------------------------------------------
This page took 0.028265 seconds and 5 git commands to generate.