Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » eclipse perspective changes C to Java
eclipse perspective changes C to Java [message #457854] Sun, 02 August 2009 02:22
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 155
Registered: July 2009
Senior Member
I'm evaluating this to run test cases in a CDT environment, which I
installed after the java tools, along with mingw C++ tools and gdb, as
suggested in the CDT notes.

I had a test case that already had excerpts from your java examples, and
then I started adding C test cases. One thing I noticed when was that
the default automatic perspective switching between Java and C
perspectives appeared to be the cause of a lot of failures. I put code in
the beforeClass() to turn off all the automatic perspective switching in
the preferences, and most of the problems disappeared. After this, I
just activate the perspectives I need during the run manually with code
like below.

SWTBotPerspective clangPerspective = bot.perspectiveByLabel("C/C++");
clangPerspective.activate();



Here's the added code in beforeClass;

bot = new SWTWorkbenchBot();
bot.viewByTitle("Welcome").close();
baseShell=bot.activeShell();
bot.menu("File").menu("Switch Workspace").menu("Other...").click();
bot.button("Cancel").click();



bot.menu("Window").menu("Preferences").click();
SWTBotShell prefsShell = bot.shell("Preferences");
prefsShell.activate();
// now bot is acting on prefsShell?
SWTBotTreeItem treeItem =
bot.tree().getTreeItem("Run/Debug").select().expand().click();
treeItem.getNode("Perspectives").select().expand().click();

// This form ignores the & in the label that creates the underscored
shortcut letter
bot.radioInGroup("Never","Open the associated perspective when
launching").click();

bot.radioInGroup("Never","Open the associated perspective when an
application suspends").click();

prefsShell.activate();
bot.button("OK").click();
bot.waitUntil(shellCloses(prefsShell));


bot.menu("Window").menu("Preferences").click();
prefsShell = bot.shell("Preferences");
prefsShell.activate();

treeItem =
bot.tree().getTreeItem("General").select().expand().click();
treeItem.getNode("Perspectives").select().expand().click();

// This form ignores the & in the label that creates the underscored
shortcut letter
bot.radioInGroup("Never open","Open the associated perspective when
creating a new project").click();


bot.button("OK").click();
bot.waitUntil(shellCloses(prefsShell));
Previous Topic:cannot find plugin error when running headless ant
Next Topic:C tools test cases
Goto Forum:
  


Current Time: Thu Apr 18 12:07:58 GMT 2024

Powered by FUDForum. Page generated in 0.01548 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top