//
// CSS Style Editor
//
////////////////////////////////////////////////////////////////////////////
public void test_styleDialog() throws Exception {
final PropertyTable propertyTable = new PropertyTable(TEST_COMBO_SHELL, SWT.NONE);
try {
final Property property = getStyleProperty(null);
final PropertyEditor propertyEditor = property.getEditor();
// activate
propertyTable.setInput(new Property[]{property});
propertyTable.setActiveProperty(property);
propertyTable.activateEditor(property, null);
// open dialog and use "Cancel"
new UiContext().executeAndCheck(new UIRunnable() {
public void run(UiContext context) throws Exception {
openCssStyleEditorDialog(propertyTable, property, propertyEditor);
}
}, new UIRunnable() {
public void run(UiContext context) throws Exception {
context.useShell("CSS Style Editor");
context.clickButton("Cancel");
}
});
// open dialog and use "OK"
new UiContext().executeAndCheck(new UIRunnable() {
public void run(UiContext context) throws Exception {
openCssStyleEditorDialog(propertyTable, property, propertyEditor);
}
}, new UIRunnable() {
public void run(UiContext context) throws Exception {
context.useShell("CSS Style Editor");
context.clickButton("OK");
}
});
assertEditor(getStyleSource(null));
// open dialog and use "Apply"
new UiContext().executeAndCheck(new UIRunnable() {
public void run(UiContext context) throws Exception {
openCssStyleEditorDialog(propertyTable, property, propertyEditor);
}
}, new UIRunnable() {
public void run(UiContext context) throws Exception {
context.useShell("CSS Style Editor");
// make selection in rules
org.eclipse.swt.widgets.List rulesList =
context.findWidgets(org.eclipse.swt.widgets.List.class).get(1);
rulesList.select(1);
// apply style
context.clickButton("Apply");
}
});
// "second" was selected
assertEditor(getStyleSource("setStyleName('second')"));
} finally {
propertyTable.dispose();
}
}