-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPreviewDialog.java
More file actions
32 lines (25 loc) · 1.23 KB
/
PreviewDialog.java
File metadata and controls
32 lines (25 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package pageobjects;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.finders.ChildrenControlFinder;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
import utils.Driver;
public class PreviewDialog {
public static String getContent() throws Exception {
StyledText text = (StyledText) new ChildrenControlFinder(Driver.bot().activeShell().widget).findControls(WidgetMatcherFactory.widgetOfType(StyledText.class)).get(0);
SWTBotStyledText swtBotText = new SWTBotStyledText(text);
return swtBotText.getText();
}
public static void setContent(String content) {
StyledText text = (StyledText) new ChildrenControlFinder(Driver.bot().activeShell().widget).findControls(WidgetMatcherFactory.widgetOfType(StyledText.class)).get(0);
SWTBotStyledText swtBotText = new SWTBotStyledText(text);
swtBotText.setText(content);
}
public static void clickOk() {
SWTBotShell previewShell = Driver.bot().activeShell();
Driver.bot().button("OK").click();
Driver.bot().waitUntil(Conditions.shellCloses(previewShell));
}
}