iterator = createdFiles.iterator();
- while (iterator.hasNext()) {
- UIUtil.syncExec(() -> iterator.next().delete(true, null));
- iterator.remove();
- }
- super.resetWorkbench();
- }
-
- /**
- * @return The SWTBot instance over the {@code Project Explorer}.
- */
- public WindowBuilderProjectExplorerBot getProjectExplorer() {
- LOGGER.fine("Open Project Explorer");
- SWTBotView projectExplorer = viewByPartName("Project Explorer");
- LOGGER.fine("Opened Project Explorer");
- return new WindowBuilderProjectExplorerBot(projectExplorer.getViewReference(), this);
- }
-
- /**
- * Opens the {@code New} wizard from the main menu.
- *
- * @return the {@code New} wizard shell.
- */
- public SWTBotShell openNewWizard() {
- LOGGER.fine("Open New wizard");
- shell().menu().menu("File").menu("New", "Other...").click();
- LOGGER.fine("Opened New wizard");
- return activeShell();
- }
-
- // I/O
- private IFile getFile(String packageName, String fileName) {
- return UIUtil.syncCall(() -> {
- IFolder packageFolder = (IFolder) testProject.getPackage(packageName).getResource();
- return packageFolder.getFile(fileName);
- });
- }
-
- /**
- * Registers the given source file to be deleted after the current test has
- * concluded. The file is located in the root of the source directory.
- *
- *
- * Example: src/module-info.java
- *
- *
- * @param fileName The file name (e.g. {@code module-info.java}).
- */
- public void addFile(String fileName) {
- addFile("", fileName);
- }
-
- /**
- * Registers the given source file to be deleted after the current test has
- * concluded. The file is located in the source directory.
- *
- *
- * Example: src/test/Test.java
- *
- *
- * @param packageName The package name (e.g. {@code test}).
- * @param fileName The file name (e.g. {@code Test.java}.
- */
- public void addFile(String packageName, String fileName) {
- IFile sourceFile = getFile(packageName, fileName);
- createdFiles.add(sourceFile);
- }
-
- /**
- * Updates the content of the given source file. The file is located in the root
- * of the source directory and deleted after the test concludes. A new file is
- * created if necessary.
- *
- *
- * Example: src/module-info.java
- *
- *
- * @param fileName The file name (e.g. {@code module-info.java}).
- * @param content The file content.
- */
- public void setFileContent(String fileName, String content) {
- setFileContent("", fileName, content);
- }
-
- /**
- * Updates the content of the given source file. The file is deleted after the
- * test concludes. A new file is created if necessary.
- *
- *
- * Example: src/test/Test.java
- *
- *
- * @param packageName The package name (e.g. {@code test})
- * @param fileName The file name (e.g. {@code Test.java}).
- * @param content The file content.
- */
- public void setFileContent(String packageName, String fileName, String content) {
- UIUtil.syncExec(() -> {
- try (InputStream is = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
- IFile sourceFile = getFile(packageName, fileName);
- sourceFile.setContents(is, true, false, null);
- createdFiles.add(sourceFile);
- }
- });
- }
-
- /**
- * Returns the content of the given source file. The file is located in the root
- * of the source directory.
- *
- *
- * Example: src/module-info.java
- *
- *
- * @param fileName The file name (e.g. {@code module-info.java}).
- * @return The file content.
- */
- public String getFileContent(String fileName) {
- return getFileContent("", fileName);
- }
-
- /**
- * Returns the content of the given source file.
- *
- *
- * Example: src/test/Test.java
- *
- *
- * @param packageName The package name (e.g. {@code test})
- * @param fileName The file name (e.g. {@code Test.java}).
- * @return The file content.
- */
- public String getFileContent(String packageName, String fileName) {
- return UIUtil.syncCall(() -> {
- IFile sourceFile = getFile(packageName, fileName);
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try (InputStream is = sourceFile.getContents()) {
- is.transferTo(os);
- }
- return new String(os.toByteArray(), StandardCharsets.UTF_8);
- });
- }
-}
diff --git a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/swtbot/designer/rcp/RcpTests.java b/org.eclipse.wb.tests/src/org/eclipse/wb/tests/swtbot/designer/rcp/RcpTests.java
deleted file mode 100644
index 032bd21f9..000000000
--- a/org.eclipse.wb.tests/src/org/eclipse/wb/tests/swtbot/designer/rcp/RcpTests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2024 Patrick Ziegler and others.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * https://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Patrick Ziegler - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wb.tests.swtbot.designer.rcp;
-
-import org.eclipse.wb.tests.swtbot.designer.rcp.wizard.WizardTests;
-
-import org.junit.platform.suite.api.SelectClasses;
-import org.junit.platform.suite.api.Suite;
-
-/**
- * A collection of all SWTBot-based RCP tests.
- */
-@Suite
-@SelectClasses(WizardTests.class)
-public class RcpTests {
-
-}