Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to insert text into a text editor tab of a multipage editor?
How to insert text into a text editor tab of a multipage editor? [message #540285] Tue, 15 June 2010 10:25 Go to next message
ashitha shetty is currently offline ashitha shetty
Messages: 17
Registered: March 2010
Junior Member
Hi,

I have a multi page editor consisting of AbstractDecoratedTextEditor, StructuredTextEditor pages.
I want to insert text content in each of these tabs.

SWTBotEditor activeEditor = bot.activeEditor();
activeEditor.toTextEditor().setText("Sample text");

The above code snippet inserts text into the editor in the last tab. Is there a way to insert text in each of the tabs individually?

Best Regards,
Ashitha.
Re: How to insert text into a text editor tab of a multipage editor? [message #540389 is a reply to message #540285] Tue, 15 June 2010 20:05 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 6/15/10 7:25 AM, ashitha wrote:
> Hi,
>
> I have a multi page editor consisting of AbstractDecoratedTextEditor,
> StructuredTextEditor pages.
> I want to insert text content in each of these tabs.
>
>
> SWTBotEditor activeEditor = bot.activeEditor();
> activeEditor.toTextEditor().setText("Sample text");
>
> The above code snippet inserts text into the editor in the last tab. Is
> there a way to insert text in each of the tabs individually?
>
> Best Regards,
> Ashitha.

Multipage editors are not supported out of the box. You'll need to
activate a particular page of the multipage editor before getting the
styled text. editor.toTextEditor() will just get the last styledtext in
the multipage editor.

Here's what may work for you:

editor = bot.activeEditor();
editorBot = editor.bot();
editorBot.cTabItem("Page Title").activate();
textEditor = editorBot.styledText();
textEditor.setText("Whatever");

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: How to insert text into a text editor tab of a multipage editor? [message #540427 is a reply to message #540389] Wed, 16 June 2010 02:51 Go to previous message
ashitha shetty is currently offline ashitha shetty
Messages: 17
Registered: March 2010
Junior Member
Hi Ketan,

It worked.Thanks for your help!

Regards,
Ashitha.
Previous Topic:Accessing "View Menu"?
Next Topic:About double click of tableItem
Goto Forum:
  


Current Time: Thu Aug 28 19:21:33 EDT 2014

Powered by FUDForum. Page generated in 0.08308 seconds