addButton.setToolTipText(Messages.LinePropertiesEditor_6);
addButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected( SelectionEvent e ) {
FeatureTypeStyleWrapper selectedFtsw = getSelectedFtsw();
if (selectedFtsw == null) {
RuleWrapper selectedRule = getSelectedRule();
if (selectedRule != null) {
selectedFtsw = selectedRule.getParent();
}
}
if (selectedFtsw == null) {
MessageDialog.openWarning(addButton.getShell(), Messages.LinePropertiesEditor_7,
Messages.LinePropertiesEditor_8);
return;
}
RuleWrapper addedRuleWrapper = selectedFtsw.addRule(null, LineSymbolizerWrapper.class);
String tmpName = Messages.LinePropertiesEditor_9;
tmpName = Utilities.checkSameNameRule(addedRuleWrapper.getParent().getRulesWrapperList(), tmpName);
addedRuleWrapper.setName(tmpName);
reloadGroupsAndRules();
refreshPreviewCanvasOnStyle();
setRuleToSelected(addedRuleWrapper);
}
});
Button deleteButton = new Button(rulesGroup, SWT.PUSH);
deleteButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
deleteButton.setImage(delImg);
deleteButton.setToolTipText(Messages.LinePropertiesEditor_10);
deleteButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected( SelectionEvent e ) {
FeatureTypeStyleWrapper selectedFtsw = getSelectedFtsw();
RuleWrapper selectedRule = getSelectedRule();
if (selectedFtsw != null) {
styleWrapper.removeFeatureTypeStyle(selectedFtsw);
} else if (selectedRule != null) {
selectedRule.getParent().removeRule(selectedRule);
} else {
MessageDialog.openWarning(addButton.getShell(), Messages.LinePropertiesEditor_11, Messages.LinePropertiesEditor_12);
return;
}