private void createActions() {
addAction = new Action() {
public void run() {
ListProxy rules = (ListProxy) getSelectedStyleSheetProxy().
getPropertyProxy(ThemeModel.RULES);
Operation addOp = rules.prepareCreateAndAddProxyItemOperation();
context.executeOperation(addOp);
refreshRuleTable();
}
};
addAction.setText(EditorMessages.getString(
RESOURCE_PREFIX + "addAction.text"));
newAction = new Action() {
public void run() {
SelectorGroupWizard wizard = new SelectorGroupWizard(
getShell(),
context.getProject());
wizard.open();
SelectorGroup group = wizard.getSelectorGroup();
if (group != null) {
ListProxy rules = (ListProxy) getSelectedStyleSheetProxy().
getPropertyProxy(ThemeModel.RULES);
Operation addOp = rules.prepareCreateAndAddProxyItemOperation();
context.executeOperation(addOp);
BeanProxy newRule = (BeanProxy) rules.getItemProxy(rules.size() - 1);
ListProxy selectors = (ListProxy) newRule.getPropertyProxy(Rule.SELECTORS);
Operation setOp = selectors.prepareSetModelObjectOperation(wizard.getSelectorGroup().getSelectors());
context.executeOperation(setOp);
}
}
};
newAction.setText(EditorMessages.getString(
RESOURCE_PREFIX + "newAction.text"));
deleteAction = new Action() {
public void run() {
ListProxy rules = (ListProxy) getSelectedStyleSheetProxy().
getPropertyProxy(ThemeModel.RULES);
IStructuredSelection selection =
(IStructuredSelection) ruleTable.getSelection();
if (!selection.isEmpty()) {
Proxy selected = (Proxy) selection.getFirstElement();
Operation delOp =
rules.prepareRemoveProxyItemOperation(selected);
context.executeOperation(delOp);
refreshRuleTable();
}