Style namedStyle = Utilities.sf.createStyle();
namedStyle.featureTypeStyles().add(featureTypeStyle);
namedStyle.setName(selectedRule.getName());
try {
polygonStyleManager.addStyle(new StyleWrapper(namedStyle));
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
final Button saveAllButton = new Button(rulesGroup, SWT.PUSH);
saveAllButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
saveAllButton.setImage(saveAllImg);
saveAllButton.setToolTipText(Messages.PolygonPropertiesEditor_17);
saveAllButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected( SelectionEvent e ) {
String newStyleName = Messages.PolygonPropertiesEditor_18;
InputDialog iDialog = new InputDialog(saveAllButton.getShell(), Messages.PolygonPropertiesEditor_19,
Messages.PolygonPropertiesEditor_20, newStyleName, null);
iDialog.setBlockOnOpen(true);
int open = iDialog.open();
if (open == SWT.CANCEL) {
return;
}
String name = iDialog.getValue();
if (name == null || name.length() == 0) {
name = newStyleName;
}
styleWrapper.setName(name);
try {
polygonStyleManager.addStyle(styleWrapper);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
Button deleteButton = new Button(rulesGroup, SWT.PUSH);
deleteButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
deleteButton.setImage(delImg);
deleteButton.setToolTipText(Messages.PolygonPropertiesEditor_21);
deleteButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected( SelectionEvent e ) {
StyleWrapper styleWrapper = polygonStyleManager.getCurrentSelectedStyle();
if (styleWrapper == null) {
return;
}
try {
polygonStyleManager.removeStyle(styleWrapper);
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
Button loadButton = new Button(rulesGroup, SWT.PUSH);
loadButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
loadButton.setImage(loadImg);
loadButton.setToolTipText(Messages.PolygonPropertiesEditor_22);
loadButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected( SelectionEvent e ) {
StyleWrapper styleWrapperToLoad = polygonStyleManager.getCurrentSelectedStyle();
if (styleWrapperToLoad == null) {
return;
}
List<FeatureTypeStyleWrapper> featureTypeStylesWrapperList = styleWrapperToLoad.getFeatureTypeStylesWrapperList();
for( FeatureTypeStyleWrapper featureTypeStyleWrapper : featureTypeStylesWrapperList ) {
styleWrapper.addFeatureTypeStyle(featureTypeStyleWrapper.getFeatureTypeStyle());
}
reloadGroupsAndRules();