Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Open perspective
Open perspective [message #21741] Mon, 16 February 2009 09:33 Go to next message
Luis Miguel is currently offline Luis MiguelFriend
Messages: 31
Registered: July 2009
Member
Hello,
How Can I open "Others..." perspectives with SWTBot?
I write next actions:

SWTBotMenu sm =bot.menu("Window").menu("Open
Perspective").menu("Others...").click();

If I want to open "Resource" perspective, What action should I use?

Thanks and regards.

Luis Miguel
Re: Open perspective [message #21875 is a reply to message #21741] Mon, 16 February 2009 10:27 Go to previous messageGo to next message
hugulas chen is currently offline hugulas chenFriend
Messages: 10
Registered: July 2009
Junior Member
I call the method directly to open perspective.
Display.getDefault().syncExec(new Runnable() {

public void run() {
try {

PlatformUI.getWorkbench().showPerspective(perspectiveID,
getActiveWindow());
} catch (WorkbenchException e) {
throw new IllegalStateException(
"Could not find a workbench", e);
}
}
});
Is it possible to add it as a utility method in swtbot?
Re: Open perspective [message #21919 is a reply to message #21741] Mon, 16 February 2009 10:48 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Luis Miguel a écrit :
> Hello,
> How Can I open "Others..." perspectives with SWTBot?
> I write next actions:
>
> SWTBotMenu sm =bot.menu("Window").menu("Open
> Perspective").menu("Others...").click();
>
> If I want to open "Resource" perspective, What action should I use?
>
> Thanks and regards.
>
> Luis Miguel
>
Once you click on "Others..." menu item, you should get a dialog you can
get as a View. In it, you must catch the Table then the "Resources"
tableItem and click on it.

--
Cordialement

Vincent MAHÉ

Ingénieur Plate-forme OpenEmbeDD - http://openembedd.org
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
Re: Open perspective [message #21964 is a reply to message #21875] Mon, 16 February 2009 10:50 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
hugulas chen a écrit :
> I call the method directly to open perspective.
> Display.getDefault().syncExec(new Runnable() {
>
> public void run() {
> try {
> PlatformUI.getWorkbench().showPerspective(perspectiveID,
> getActiveWindow());
> } catch (WorkbenchException e) {
> throw new IllegalStateException(
> "Could not find a workbench", e);
> }
> }
> });
> Is it possible to add it as a utility method in swtbot?
>

It is a code access to the UI internals, which is not the goal of
SWTBot: simulate the manipulation of UI by a human user :-)

Have a look on the solution I propose in the same thread
--
Cordialement

Vincent MAHÉ

Ingénieur Plate-forme OpenEmbeDD - http://openembedd.org
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
Re: Open perspective [message #22008 is a reply to message #21875] Mon, 16 February 2009 11:03 Go to previous messageGo to next message
Luis Miguel is currently offline Luis MiguelFriend
Messages: 31
Registered: July 2009
Member
I do not know. I want to know if It is possible to add it as a utility
method in swtbot.
Re: Open perspective [message #22095 is a reply to message #21919] Mon, 16 February 2009 13:05 Go to previous messageGo to next message
Luis Miguel is currently offline Luis MiguelFriend
Messages: 31
Registered: July 2009
Member
Once you click on "Others..." menu item, you should get a dialog you can
get as a View. In it, you must catch the Table then the "Resources"
tableItem and click on it.
I can not get a dialog as a View. I am putting next actions:
bot.menu("Window").menu("Open perspective").menu("Others...").click();
SWTBotView sv=bot.view("Open perspective");

But the second action does not work by a WidgetNotFoundException. Are
there others actions for this?

Thanks!!

Luis Mihuel
Re: Open perspective [message #22139 is a reply to message #21741] Mon, 16 February 2009 13:13 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
There's a DSL project in SVN that provides convinience APIs that you're
looking for.

Switching perspective becomes as simple as:

Eclipse.workbench().switchToPerspective("Some Perspective");

There's not much API there but feedback and patches will be welcome.

-- Ketan

On 16/2/09 15:03, Luis Miguel wrote:
> Hello,
> How Can I open "Others..." perspectives with SWTBot?
> I write next actions:
>
> SWTBotMenu sm =bot.menu("Window").menu("Open
> Perspective").menu("Others...").click();
>
> If I want to open "Resource" perspective, What action should I use?
>
> Thanks and regards.
>
> Luis Miguel
>
Re: Open perspective [message #22225 is a reply to message #22139] Mon, 16 February 2009 15:12 Go to previous messageGo to next message
Luis Miguel is currently offline Luis MiguelFriend
Messages: 31
Registered: July 2009
Member
But what is the name of address from SVC? What I need to work the
action?Can I get the view with other action?

Luis Miguel
Re: Open perspective [message #22267 is a reply to message #22225] Mon, 16 February 2009 16:20 Go to previous messageGo to next message
Joe Luebker is currently offline Joe LuebkerFriend
Messages: 36
Registered: July 2009
Member
You may also want to look at the "An example of opening an Eclipse
perspective using SWTBot" discussion on this newsgroup. You can find the
following snippet there

// Change the perspective via the Open Perspective dialog
bot.menu("Window").menu("Open Perspective").menu("Other...").click();
SWTBotShell openPerspectiveShell = bot.shell("Open Perspective");
openPerspectiveShell.activate();

bot.table().select("Debug");
bot.button("OK").click();

Joe

Luis Miguel wrote:
> But what is the name of address from SVC? What I need to work the
> action?Can I get the view with other action?
>
> Luis Miguel
>
Re: Open perspective [message #22408 is a reply to message #21919] Mon, 16 February 2009 16:32 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Vincent Mahe a écrit :
> Luis Miguel a écrit :
>> Hello,
>> How Can I open "Others..." perspectives with SWTBot?
>> I write next actions:
>>
>> SWTBotMenu sm =bot.menu("Window").menu("Open
>> Perspective").menu("Others...").click();
>>
>> If I want to open "Resource" perspective, What action should I use?
>>
>> Thanks and regards.
>>
>> Luis Miguel
>>
> Once you click on "Others..." menu item, you should get a dialog you can
> get as a View. In it, you must catch the Table then the "Resources"
> tableItem and click on it.
>

Sorry for the mistake.
As explained later by Joe Luebker, dialogs are not Views but Shells

--
Cordialement

Vincent MAHÉ

Ingénieur Plate-forme OpenEmbeDD - http://openembedd.org
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
Re: Open perspective [message #22498 is a reply to message #22408] Tue, 17 February 2009 02:41 Go to previous messageGo to next message
hugulas chen is currently offline hugulas chenFriend
Messages: 10
Registered: July 2009
Junior Member
Vincent Mahe wrote:

> Vincent Mahe a écrit :
>> Luis Miguel a écrit :
>>> Hello,
>>> How Can I open "Others..." perspectives with SWTBot?
>>> I write next actions:
>>>
>>> SWTBotMenu sm =bot.menu("Window").menu("Open
>>> Perspective").menu("Others...").click();
>>>
>>> If I want to open "Resource" perspective, What action should I use?
>>>
>>> Thanks and regards.
>>>
>>> Luis Miguel
>>>
>> Once you click on "Others..." menu item, you should get a dialog you can
>> get as a View. In it, you must catch the Table then the "Resources"
>> tableItem and click on it.
>>

> Sorry for the mistake.
> As explained later by Joe Luebker, dialogs are not Views but Shells

Yes, this is a way which simulates the mouse click.If I need to demo it to
some others, it is a better choice.
Re: Open perspective [message #22671 is a reply to message #21741] Tue, 17 February 2009 23:52 Go to previous message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
http://wiki.eclipse.org/SWTBot/Snippets
Previous Topic:Table not doubleclicked
Next Topic:click on check-style button does not make it checked/unchecked
Goto Forum:
  


Current Time: Tue Mar 19 08:38:16 GMT 2024

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

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

Back to the top