use of org.netxms.ui.eclipse.epp.widgets.RuleEditor in project netxms by netxms.
the class EventProcessingPolicyEditor method deleteSelectedRules.
/**
* Delete selected rules
*/
private void deleteSelectedRules() {
for (RuleEditor e : selection) {
policy.deleteRule(e.getRule());
ruleEditors.remove(e);
e.dispose();
}
// Renumber rules
for (int i = 0; i < ruleEditors.size(); i++) ruleEditors.get(i).setRuleNumber(i + 1);
selection.clear();
lastSelectedRule = -1;
onSelectionChange();
updateEditorAreaLayout();
setModified(true);
}
use of org.netxms.ui.eclipse.epp.widgets.RuleEditor in project netxms by netxms.
the class EventProcessingPolicyEditor method pasteRules.
/**
* Paste rules from internal clipboard
*/
private void pasteRules() {
int position = lastSelectedRule;
RuleEditor anchor = null;
if (position < ruleEditors.size() - 1) {
for (int i = position; i < ruleEditors.size(); i++) if (!ruleEditors.get(i).isDisposed()) {
anchor = ruleEditors.get(i);
break;
}
}
for (EventProcessingPolicyRule rule : clipboard.paste()) {
rule.setRuleNumber(position + 1);
policy.insertRule(rule, position);
RuleEditor editor = new RuleEditor(dataArea, rule, this);
ruleEditors.add(position, editor);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
editor.setLayoutData(gd);
if (anchor != null)
editor.moveAbove(anchor);
position++;
}
for (int i = position; i < ruleEditors.size(); i++) ruleEditors.get(i).setRuleNumber(i + 1);
updateEditorAreaLayout();
setModified(true);
}
Aggregations