org.eclipse.swtbot.eclipse.finder.widgets
Class SWTBotMultiPageEditor

java.lang.Object
  extended by org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart<IEditorReference>
      extended by org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor
          extended by org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor

public class SWTBotMultiPageEditor
extends SWTBotEditor

Base class for all multi-page editors in Eclipse.

Note: It is recommend that clients decorate this class with their own custom wrappers.

Note: This API is very new, experimental and subject to change.

 public class PDEManifestEditor extends SWTBotMultiPageEditor {
        public PDEManifestEditor(SWTBotMultiPageEditor editor, SWTWorkbenchBot bot) {
                super(editor.getReference(), bot);
                this.editor = editor;
        }
 
        // any custom behavior you need to test
        public activateBuildPropertiesTab() {
                activatePage("build.properties");
        }
 
        public SWTBotStyledText buildProperties() {
                activateBuildPropertiesTab();
                return SWTBotStyledText((StyledText) findWidget(widgetOfType(StyledText.class)));
        }
 }
 

Since:
2.0
Author:
Ketan Patel, Ketan Padegaonkar

Field Summary
protected  CTabFolder tabFolder
          The tabFolder widget.
 
Fields inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart
bot, log, partReference
 
Constructor Summary
SWTBotMultiPageEditor(IEditorReference editorReference, SWTWorkbenchBot bot)
          Constructs an instance of the given object.
 
Method Summary
 SWTBotCTabItem activatePage(Matcher<? extends Widget> titleMatcher)
          Sets the currently active page.
 SWTBotCTabItem activatePage(String pageText)
          Sets the currently active page.
 String getActivePageTitle()
          Returns the title of the currently active page or null if there is no active page
 int getPageCount()
          Returns the number of pages in this multi-page editor.
 List<String> getPagesTitles()
          Returns a list of title of all the pages in this multi-page editor.
 boolean isActivePage(Matcher<String> titleMatcher)
           
 boolean isActivePage(String pageText)
           
 
Methods inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor
close, isActive, isDirty, save, saveAndClose, setFocus, show, toTextEditor
 
Methods inherited from class org.eclipse.swtbot.eclipse.finder.widgets.SWTBotWorkbenchPart
assertActive, bot, findWidget, findWidgets, getReference, getTitle, getToolbarButtons, getWidget, toolbarButton, toolbarDropDownButton, toolbarPushButton, toolbarRadioButton, toolbarToggleButton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tabFolder

protected final CTabFolder tabFolder
The tabFolder widget.

Constructor Detail

SWTBotMultiPageEditor

public SWTBotMultiPageEditor(IEditorReference editorReference,
                             SWTWorkbenchBot bot)
Constructs an instance of the given object.

Parameters:
editorReference - the editor reference.
bot - the instance of SWTWorkbenchBot which will be used to drive operations on behalf of this object.
Throws:
WidgetNotFoundException - if the widget is null or widget has been disposed.
Method Detail

getPageCount

public int getPageCount()
Returns the number of pages in this multi-page editor.

Returns:
the number of pages

activatePage

public SWTBotCTabItem activatePage(String pageText)
Sets the currently active page.

Parameters:
pageText - the text label for the page to be activated
Returns:
the CTabItem that was activated.

activatePage

public SWTBotCTabItem activatePage(Matcher<? extends Widget> titleMatcher)
Sets the currently active page.

Parameters:
titleMatcher - the title matcher for the page to be activated.
Returns:
the CTabItem that was activated.

getActivePageTitle

public String getActivePageTitle()
Returns the title of the currently active page or null if there is no active page

Returns:
the title of the currently active page or null if there is no active page

getPagesTitles

public List<String> getPagesTitles()
Returns a list of title of all the pages in this multi-page editor.

Returns:
List of title of all pages; empty list if no pages.

isActivePage

public boolean isActivePage(String pageText)
Parameters:
pageText - the page title to test
Returns:
true if the currently active page has given title, false otherwise.

isActivePage

public boolean isActivePage(Matcher<String> titleMatcher)
Parameters:
titleMatcher - the title matcher for the active page
Returns:
true if the currently active page title matches, false otherwise.