Skip to content

Commit

Permalink
open package explorer programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Nov 23, 2022
1 parent f598a6b commit 9045690
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,13 @@ public static void beforeClass() throws Exception {

bot.viewByTitle(OUTLINE_VIEW).show();

openPackageExplorer();

// In Neon the Package Explorer is not part of the Plug-in Development perspective
// but in Kepler it is not available from the Window | Show View menu
if (!isKepler()) {
bot.menu("Window").menu("Show View").menu(PACKAGE_EXPLORER).click();
}
// if (!isKepler()) {
// bot.menu("Window").menu("Show View").menu(PACKAGE_EXPLORER).click();
// }
}

@AfterClass
Expand Down Expand Up @@ -493,6 +495,24 @@ public void run() {
});
}

protected static void openPackageExplorer() throws InterruptedException {
openViewById("org.eclipse.jdt.ui.PackageExplorer");
}

protected static void openViewById(final String viewId) throws InterruptedException {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
try {
workbench.getActiveWorkbenchWindow().getActivePage().showView(viewId);
} catch (WorkbenchException e) {
e.printStackTrace();
}
}
});
}

protected static boolean isOxygen() {
// org.eclipse.ui has minor number 109 for Oxygen
return getOrgEclipseUiMinorVersion() >= 109;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<stringAttribute key="featurePluginResolution" value="workspace"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.eclipse.emf.parsley.tests.swtbot/src/org/eclipse/emf/parsley/tests/swtbot/suite/EmfParsleyTestsSuite.java"/>
</listAttribute>
Expand All @@ -29,6 +30,7 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.emf.parsley.tests.swtbot.suite.EmfParsleyTestsSuite"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
Expand Down

0 comments on commit 9045690

Please sign in to comment.