Java Code Examples for org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView#setFocus()

The following examples show how to use org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView#setFocus() . 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: SWTBotUtils.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Opens a trace in an editor and get the TmfEventsEditor
 *
 * @param bot
 *            the workbench bot
 * @param projectName
 *            the name of the project that contains the trace
 * @param elementPath
 *            the trace element path (relative to Traces folder)
 * @return TmfEventsEditor the opened editor
 */
public static TmfEventsEditor openEditor(SWTWorkbenchBot bot, String projectName, IPath elementPath) {
    final SWTBotView projectExplorerView = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectExplorerView.setFocus();
    SWTBot projectExplorerBot = projectExplorerView.bot();

    final SWTBotTree tree = projectExplorerBot.tree();
    projectExplorerBot.waitUntil(ConditionHelpers.isTreeNodeAvailable(projectName, tree));
    final SWTBotTreeItem treeItem = tree.getTreeItem(projectName);
    treeItem.expand();

    SWTBotTreeItem tracesNode = getTraceProjectItem(projectExplorerBot, treeItem, "Traces");
    tracesNode.expand();

    SWTBotTreeItem currentItem = tracesNode;
    for (String segment : elementPath.segments()) {
        currentItem = getTraceProjectItem(projectExplorerBot, currentItem, segment);
        currentItem.doubleClick();
    }

    SWTBotEditor editor = bot.editorByTitle(elementPath.toString());
    IEditorPart editorPart = editor.getReference().getEditor(false);
    assertTrue(editorPart instanceof TmfEventsEditor);
    return (TmfEventsEditor) editorPart;
}
 
Example 2
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test check callstack at a time with function map
 *
 * @throws IOException
 *             Missing file
 */
@Test
public void testGoToTimeAndCheckStackWithNames() throws IOException {
    goToTime(TIMESTAMPS[0]);
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();

    URL mapUrl = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt");
    String absoluteFile = FileLocator.toFileURL(mapUrl).getFile();
    TmfFileDialogFactory.setOverrideFiles(absoluteFile);

    SWTBotShell shell = openSymbolProviderDialog();
    SWTBot shellBot = shell.bot();
    shellBot.button("Add...").click();
    shellBot.button("OK").click();
    shellBot.waitUntil(Conditions.shellCloses(shell));
    SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(viewBot.bot());
    SWTBotTimeGraphEntry[] threads = timeGraph.getEntry(TRACE, PROCESS).getEntries();
    assertEquals(1, threads.length);
    assertEquals(THREAD, threads[0].getText(0));
    waitForSymbolNames("main", "event_loop", "handle_event");
}
 
Example 3
Source File: MemoryUsageViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Test if Memory Usage is populated
 */
@Test
public void testOpenMemoryUsage() {
    SWTBotView viewBot = fBot.viewById(UstMemoryUsageView.ID);
    viewBot.setFocus();

    // Do some basic validation
    Matcher<Chart> matcher = WidgetOfType.widgetOfType(Chart.class);
    Chart chart = viewBot.bot().widget(matcher);

    checkAllEntries();

    // Verify that the chart has 4 series
    fBot.waitUntil(ConditionHelpers.numberOfSeries(chart, EXPECTED_NUM_SERIES));

    ISeriesSet seriesSet = chart.getSeriesSet();
    ISeries<?>[] series = seriesSet.getSeries();
    // Verify that each series is a ILineSeries
    for (ISeries<?> serie : series) {
        assertTrue(serie instanceof ILineSeries);
    }
}
 
Example 4
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Open a trace in an editor
 *
 * @throws Exception
 *             if problem occurs
 */
@Before
public void beforeTest() throws Exception {
    SWTBotUtils.openView(ControlView.ID);
    WaitUtils.waitForJobs();
    URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path("testfiles" + File.separator + getTestStream()), null);
    File testfile = new File(FileLocator.toFileURL(location).toURI());
    fTestFile = testfile.getAbsolutePath();

    // Create root component
    SWTBotView viewBot = fBot.viewById(ControlView.ID);
    viewBot.setFocus();
    IViewPart part = viewBot.getViewReference().getView(true);
    ControlView view = (ControlView) part;
    fRoot = view.getTraceControlRoot();

    // Create node component
    fNode = new TargetNodeComponent(getNodeName(), fRoot, fProxy);
    fRoot.addChild(fNode);
    fTree = viewBot.bot().tree();
}
 
Example 5
Source File: ResourcesViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Before Test
 */
@Override
@Before
public void before() {
    SWTBotView viewBot = getViewBot();
    viewBot.show();
    super.before();
    viewBot.setFocus();
}
 
Example 6
Source File: AbstractOutlineViewTest.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the outline view of the currently active editor.
 *
 * @return the {@link SWTBotView} representing the outline view
 * @throw WidgetNotFoundException if there is no active editor
 */
// CHECKSTYLE:CONSTANTS-OFF
protected SWTBotView openOutlineViewOfActiveEditor() {
  getBot().menu("Window").menu("Show View").menu("Outline").click();
  SWTBotView outlineView = getBot().viewById("org.eclipse.ui.views.ContentOutline");
  assertNotNull("outline view present", outlineView);

  SwtBotViewUtil.waitUntilViewIsLoaded(outlineView);
  outlineView.setFocus();

  return outlineView;
}
 
Example 7
Source File: ImportAndReadPcapTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void testStreamView(IViewReference viewPart) {
    SWTBotView botView = new SWTBotView(viewPart, fBot);
    StreamListView slv = (StreamListView) getViewPart("Stream List");
    botView.setFocus();
    SWTBotTree botTree = fBot.tree();
    assertNotNull(botTree);
    final TmfSelectionRangeUpdatedSignal signal = new TmfSelectionRangeUpdatedSignal(slv, fDesired1.getTimestamp());
    slv.broadcast(signal);
    WaitUtils.waitForJobs();
    // FIXME This is a race condition:
    // TmfEventsTable launches an async exec that may be run after the wait
    // for jobs. This last delay catches it.
    SWTBotUtils.delay(1000);

}
 
Example 8
Source File: SWTBotUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Deletes a project
 *
 * @param projectName
 *            the name of the tracing project
 * @param deleteResources
 *            whether or not to deleted resources under the project
 * @param bot
 *            the workbench bot
 */
public static void deleteProject(final String projectName, boolean deleteResources, SWTWorkbenchBot bot) {
    // Wait for any analysis to complete because it might create
    // supplementary files
    WaitUtils.waitForJobs();
    try {
        ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).refreshLocal(IResource.DEPTH_INFINITE, null);
    } catch (CoreException e) {
    }

    WaitUtils.waitForJobs();

    closeSecondaryShells(bot);
    WaitUtils.waitForJobs();

    if (!ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).exists()) {
        return;
    }

    focusMainWindow(bot.shells());

    final SWTBotView projectViewBot = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectViewBot.setFocus();

    SWTBotTree treeBot = projectViewBot.bot().tree();
    SWTBotTreeItem treeItem = treeBot.getTreeItem(projectName);
    SWTBotMenu contextMenu = treeItem.contextMenu("Delete");
    contextMenu.click();

    handleDeleteDialog(deleteResources, bot);
    WaitUtils.waitForJobs();
}
 
Example 9
Source File: AddProjectNatureTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static void toggleFilters(boolean checked) {
    SWTBotView viewBot = fBot.viewByTitle(PROJECT_EXPLORER_TITLE);
    viewBot.setFocus();

    SWTBotRootMenu viewMenu = viewBot.viewMenu();
    String title = CUSTOMIZE_VIEW_DIALOG_TITLE_4_7;
    try {
        viewMenu.menu(CUSTOMIZE_VIEW_MENU_ITEM_4_7).click();
    } catch (WidgetNotFoundException e) {
        viewMenu.menu(CUSTOMIZE_VIEW_MENU_ITEM_4_6).click();
        title = CUSTOMIZE_VIEW_DIALOG_TITLE_4_6;
    }
    SWTBotShell shell = fBot.shell(title).activate();
    // Select first cTabItem which has name 'Filters' in 4.10 or older, and 'Pre-set filters' starting with 4.11
    shell.bot().cTabItem(0).activate();

    SWTBotTable table = shell.bot().table();
    SWTBotTableItem item = table.getTableItem(CUSTOMIZE_VIEW_RESOURCES_FILTER);
    item.select();
    if (checked != item.isChecked()) {
        item.toggleCheck();
    }
    item = table.getTableItem(CUSTOMIZE_VIEW_SHADOW_FILTER);
    item.select();
    if (checked != item.isChecked()) {
        item.toggleCheck();
    }

    shell.bot().button(OK_BUTTON).click();
}
 
Example 10
Source File: ControlFlowViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Before Test
 */
@Override
@Before
public void before() {
    SWTBotView viewBot = getViewBot();
    viewBot.show();
    super.before();
    viewBot.setFocus();
}
 
Example 11
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test if callstack is populated
 */
@Test
public void testOpenCallstack() {
    SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();
    waitForSymbolNames("0x40472b");
}
 
Example 12
Source File: FlameChartViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
private static SWTBotShell openSymbolProviderDialog() {
    final SWTBotView viewBot = sfBot.viewById(FlameChartView.ID);
    viewBot.setFocus();
    viewBot.toolbarButton(CONFIGURE_SYMBOL_PROVIDERS).click();
    return sfBot.shell("Symbol mapping");
}
 
Example 13
Source File: BotProcessDiagramPerspective.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public BotTreeView getTreeViewPart() {
    final SWTBotView view = bot.viewById(SWTBotTestUtil.VIEWS_TREE_OVERVIEW);
    view.show();
    view.setFocus();
    return new BotTreeView(bot);
}
 
Example 14
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
     * test compare field >= 2
     */
    @Test
    public void testField01() {
        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 = "field";
        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 Compare > 1.5
        // --------------------------------------------------------------------

        filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(COMPARE).click();
        SWTBotTreeItem contentNode = filterNodeBot.getNode(WITH_TRACETYPE).getNode("<select aspect> " + "=" + " <value>");
        contentNode.expand();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(CONTENTS);
        textBot = filterBot.text(0); // field
        textBot.setFocus();
        textBot.setText(filterName);

        textBot = filterBot.text(1); // value
        textBot.setFocus();
        textBot.setText("1.5");
        filterBot.radio(">").click();

        // --------------------------------------------------------------------
        // apply
        // --------------------------------------------------------------------
        viewBot.toolbarButton("Save filters").click();

        String ret = applyFilter(fBot, filterName);
//        filterNodeBot.contextMenu().menu("Delete").click();
        assertEquals("50/100", ret);
    }
 
Example 15
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
     * Return all timestamps ending with 100... for reasons
     */
    @Test
    public void testTimestampEqualsOr() {
        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 = "matchAndEquals";
        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 OR
        // --------------------------------------------------------------------

        filterNodeBot.getNode(WITH_TRACETYPE).contextMenu(OR).click();

        // --------------------------------------------------------------------
        // add EQUALS "19...300"
        // --------------------------------------------------------------------

        SWTBotTreeItem orNode = filterNodeBot.getNode(WITH_TRACETYPE).getNode(OR);
        orNode.contextMenu("EQUALS").click();
        orNode.expand();
        orNode.getNode(0).select();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(TIMESTAMP);
        textBot = filterBot.text();
        textBot.setFocus();
        textBot.setText("19:00:00.000 000 300");

        // --------------------------------------------------------------------
        // add MATCHES "1"
        // --------------------------------------------------------------------
        orNode.contextMenu("MATCHES").click();
        orNode.expand();
        orNode.getNode(1).select();
        comboBot = filterBot.ccomboBox(1); // aspect
        comboBot.setSelection(CONTENTS);
        textBot = filterBot.text(0); // field
        textBot.setFocus();
        textBot.setText("field");
        textBot = filterBot.text(1); // value
        textBot.setFocus();
        textBot.setText("1");

        viewBot.toolbarButton("Save filters").click();

        String ret = applyFilter(fBot, filterName);
        assertEquals("26/100", ret);
//        filterNodeBot.contextMenu().menu("Delete").click();
    }
 
Example 16
Source File: FilterViewerTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 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 17
Source File: SDViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Test Sequence diagram print dialog
 */
@Test
public void testSDPrintUi() {
    SWTBotView viewBot = fBot.viewById(UML2DVIEW_ID);
    assertNotNull(viewBot);
    viewBot.setFocus();
    WaitUtils.waitForJobs();

    // Test print dialog
    SWTBotCanvas canvas = viewBot.bot().canvas(1);
    canvas.setFocus();
    canvas.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('P'));
    SWTBotShell printShell = fBot.shell("Print");
    assertNotNull(printShell);
    SWTBot printBot = printShell.bot();

    printBot.radio("Use current zoom").click();

    SWTBotRadio allPages = printBot.radio("All pages");
    SWTBotRadio currentView = printBot.radio("Current view");
    // 'All pages' and 'Current view' buttons will be enabled
    allPages.click();
    currentView.click();

    // Test 'Number of horizontal pages' button
    printBot.radio("Number of horizontal pages:").click();
    SWTBotText horizontalPagesText = printBot.text(0);
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), horizontalPagesText, "Number of horizontal pages should be 1");
    horizontalPagesText.setText("2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), horizontalPagesText, "Number of horizontal pages should be 2");
    assertFalse(currentView.isEnabled());

    // Test 'Number of vertical pages' button
    SWTBotText totalPagesText = printBot.textWithLabel("Total number of pages:");
    printBot.radio("Number of vertical pages:").click();
    SWTBotText verticalPagesText = printBot.text(1);
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), verticalPagesText, "Number of vertical pages should be 1");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), totalPagesText, "Total number of pages should be 1");
    verticalPagesText.setText("2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), verticalPagesText, "Number of vertical pages should be 2");
    assertFalse(currentView.isEnabled());

    // Test 'selected pages' button
    printBot.radio("Selected pages").click();
    assertFalse(currentView.isEnabled());

    // Test 'From pages' buttons
    printBot.radio("From page").click();
    SWTBotText fromText = printBot.text(3);
    SWTBotText toText = printBot.text(4);
    SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), fromText, "From text is not empty");
    SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), toText, "To text is not empty");
    fromText.setText("2");
    toText.setText("3");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), fromText, "From text is not 2");
    SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(3)), toText, "To text is not 3");
    assertFalse(currentView.isEnabled());

    // Don't actually print
    printBot.button("Cancel").click();
    printBot.waitUntil(Conditions.shellCloses(printShell));
}
 
Example 18
Source File: StandardImportGzipTraceTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Import a gzip trace
 */
@Test
public void testGzipImport() {
    final String traceType = "Test trace : TMF Tests";
    final String tracesNode = "Traces [1]";
    final SWTWorkbenchBot bot = getSWTBot();

    /*
     * Actual importing
     */
    openImportWizard();
    SWTBotImportWizardUtils.selectImportFromArchive(bot, fGzipTrace.getAbsolutePath());
    SWTBotImportWizardUtils.selectFolder(bot, true, ROOT_FOLDER);
    SWTBotCheckBox checkBox = bot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
    assertFalse(checkBox.isEnabled());
    SWTBotCombo comboBox = bot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType);
    comboBox.setSelection(traceType);
    importFinish();
    /*
     * Remove .gz extension
     */
    assertNotNull(fGzipTrace);
    String name = fGzipTrace.getName();
    assertNotNull(name);
    assertTrue(name.length() > 3);
    String traceName = name.substring(0, name.length() - 3);
    assertNotNull(traceName);
    assertFalse(traceName.isEmpty());

    /*
     * Open trace
     */
    SWTBotView projectExplorer = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectExplorer.setFocus();
    final SWTBotTree tree = projectExplorer.bot().tree();
    /*
     * This appears to be problematic due to the length of the file name and
     * the resolution in our CI.
     */
    SWTBotTreeItem treeItem = SWTBotUtils.getTreeItem(projectExplorer.bot(), tree, PROJECT_NAME, tracesNode, traceName);
    treeItem.doubleClick();
    WaitUtils.waitForJobs();
    /*
     * Check results
     */
    SWTBot editorBot = SWTBotUtils.activeEventsEditor(bot).bot();
    SWTBotTable editorTable = editorBot.table();
    final String expectedContent1 = "Type-1";
    final String expectedContent2 = "";
    editorBot.waitUntil(ConditionHelpers.isTableCellFilled(editorTable, expectedContent1, 2, 2));
    editorBot.waitUntil(ConditionHelpers.isTableCellFilled(editorTable, expectedContent2, 1, 0));
    String c22 = editorTable.cell(2, 2);
    String c10 = editorTable.cell(1, 0);
    assertEquals(expectedContent1, c22);
    assertEquals(expectedContent2, c10);
}
 
Example 19
Source File: ActiveWelcomePageCondition.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean test() throws Exception {
    SWTBotView view = swtGefBot.viewById("org.eclipse.ui.internal.introview");
    view.setFocus();
    return view.isActive();
}
 
Example 20
Source File: DeleteSpecHandlerTest.java    From tlaplus with MIT License 4 votes vote down vote up
@Test
public void deleteMultipleSpecs() throws CoreException, IOException {
	// Make sure there are no specs at first
	assertEquals(0, Activator.getSpecManager().getSpecs().size());
	
	// create a valid path
	File fileA = File.createTempFile("DeleteMultiSpecA", TLAConstants.Files.TLA_EXTENSION);
	fileA.delete();
	// Create the spec file
	ResourcesPlugin.getWorkspace().run(ResourceHelper.createTLAModuleCreationOperation(new Path(fileA.getAbsolutePath())),
			new NullProgressMonitor());
	// Create the spec
	final Spec spec = Spec.createNewSpec("SpecA", fileA.getAbsolutePath(), false, new NullProgressMonitor());
	// Register the spec
	Activator.getSpecManager().addSpec(spec);

	// create a second valid path
	File fileB = File.createTempFile("DeleteMultiSpecB", TLAConstants.Files.TLA_EXTENSION);
	fileB.delete();
	// Create the spec file
	ResourcesPlugin.getWorkspace().run(ResourceHelper.createTLAModuleCreationOperation(new Path(fileB.getAbsolutePath())),
			new NullProgressMonitor());
	// Create the spec
	Spec specB = Spec.createNewSpec("SpecB", fileB.getAbsolutePath(), false, new NullProgressMonitor());
	// Register the spec
	Activator.getSpecManager().addSpec(specB);

	// Make sure there are no specs at first
	assertEquals(2, Activator.getSpecManager().getSpecs().size());
	
	Activator.getSpecManager().setSpecLoaded(spec);
	
	// Trigger update so that both specs show up in the explorer
	UIHelper.runUISync(new Runnable() {
		public void run() {
			ToolboxExplorer.refresh();
            final HashMap<String, String> parameters = new HashMap<String, String>();
            parameters.put(OpenSpecHandler.PARAM_SPEC, spec.getName());

            // runs the command
            UIHelper.runCommand(OpenSpecHandler.COMMAND_ID, parameters);
		}
	});
	
	bot.waitUntil(new SpecEditorOpenCondition(fileA.getName()));
	
	// Make sure one spec is open and has an editor
	assertEquals(1, UIHelper.getActivePage().getEditorReferences().length);
	assertNotNull(Activator.getSpecManager().getSpecLoaded());

	// Select tree
	SWTBotView specExplorer = bot.viewById(ToolboxExplorer.VIEW_ID);
	specExplorer.setFocus();

	// select tree items
	final SWTBotTree specExplorerTree = specExplorer.bot().tree();
	specExplorerTree.select(bot.tree().getTreeItem("SpecA [ " + fileA.getName() + " ]"),
			bot.tree().getTreeItem("SpecB [ " + fileB.getName() + " ]"));
	
	// main menu delete
	bot.menu("Edit").menu("Delete").click();

	// click the two dialogs that confirm deletion
	bot.shell("Delete specification?").activate();
	bot.button("Yes").click();
	bot.shell("Delete specification?").activate();
	bot.button("Yes").click();
	
	// Make sure all specs are gone
	assertEquals(0, Activator.getSpecManager().getSpecs().size());
	
	// Make sure no editor remained open
	assertEquals(0, UIHelper.getActivePage().getEditorReferences().length);
}