use of org.netxms.ui.eclipse.epp.widgets.RuleEditor in project netxms by netxms.
the class EventProcessingPolicyEditor method moveSelection.
/**
* Moves rule selection
*
* @param anchor - where the selection is being moved
*/
public void moveSelection(RuleEditor anchor) {
if (selection.contains(anchor)) {
for (RuleEditor s : selection) s.setDragged(false);
return;
}
List<RuleEditor> movedRuleEditors = new ArrayList<RuleEditor>();
for (RuleEditor e : ruleEditors) {
if (!selection.contains(e)) {
movedRuleEditors.add(e);
if (e.equals(anchor)) {
RuleEditor curr = anchor;
for (RuleEditor s : selection) {
movedRuleEditors.add(s);
s.moveBelow(curr);
curr = s;
s.setDragged(false);
}
}
}
}
policy = new EventProcessingPolicy(movedRuleEditors.size());
int i = 0;
for (RuleEditor e : movedRuleEditors) {
policy.addRule(e.getRule());
e.setRuleNumber(++i);
}
ruleEditors = movedRuleEditors;
anchor.setDragged(false);
updateEditorAreaLayout();
setModified(true);
}
use of org.netxms.ui.eclipse.epp.widgets.RuleEditor in project netxms by netxms.
the class EventProcessingPolicyEditor method cutRules.
/**
* Cut selected rules to internal clipboard
*/
private void cutRules() {
clipboard.clear();
actionPaste.setEnabled(true);
for (RuleEditor e : selection) {
clipboard.add(e.getRule());
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 onFilterModify.
/**
* Handler for filter modification
*/
private void onFilterModify() {
filterText = filterControl.getText().trim().toLowerCase();
// change editors visibility
RuleEditor prev = null;
for (int i = 0; i < ruleEditors.size(); i++) {
RuleEditor e = ruleEditors.get(i);
boolean visible = isRuleVisible(e.getRule());
if (!e.isDisposed() && !visible) {
e.dispose();
selection.remove(e);
} else if (e.isDisposed() && visible) {
e = new RuleEditor(dataArea, e.getRule(), this);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
e.setLayoutData(gd);
if (prev != null)
e.moveBelow(prev);
else
e.moveAbove(null);
ruleEditors.set(i, e);
}
if (!e.isDisposed())
prev = e;
}
updateEditorAreaLayout();
}
use of org.netxms.ui.eclipse.epp.widgets.RuleEditor in project netxms by netxms.
the class EventProcessingPolicyEditor method copyRules.
/**
* Copy selected rules to internal clipboard
*/
private void copyRules() {
clipboard.clear();
actionPaste.setEnabled(true);
for (RuleEditor e : selection) clipboard.add(new EventProcessingPolicyRule(e.getRule()));
}
use of org.netxms.ui.eclipse.epp.widgets.RuleEditor in project netxms by netxms.
the class EventProcessingPolicyEditor method clearSelection.
/**
* Clear selection
*/
private void clearSelection() {
for (RuleEditor e : selection) e.setSelected(false);
selection.clear();
lastSelectedRule = -1;
}
Aggregations