Skip to main content


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 14:25 Go to next message
ashitha shetty is currently offline ashitha shettyFriend
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] Wed, 16 June 2010 00:05 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
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 06:51 Go to previous message
ashitha shetty is currently offline ashitha shettyFriend
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: Fri Oct 04 20:40:21 GMT 2024

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

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

Back to the top