Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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: Wed Jul 23 07:19:04 EDT 2025

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

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

Back to the top