for (int i = 0; i < this.viewer.getTable().getItemCount(); i++) {
String element = this.viewer.getElementAt(i).toString();
if (configName.equals(element)) {
// fire event for a changed view configuration
fireStateChange(new StateChangeEvent(configName,
StateChangeType.CHANGE));
return;
}
}
this.viewer.add(configName);
// fire event for a newly created view configuration
fireStateChange(new StateChangeEvent(configName,
StateChangeType.CREATE));
} else if (buttonId == DELETE_ID) {
ISelection selection = this.viewer.getSelection();
if (selection != null && selection instanceof IStructuredSelection) {
String configName = ((IStructuredSelection) selection)
.getFirstElement().toString();
PersistenceHelper.deleteState(configName, this.properties);
// remove the state name out of the viewer
this.viewer.getTable().deselectAll();
this.viewer.remove(configName);
this.configNameText.setText(""); //$NON-NLS-1$
// fire event for a deleted view configuration
fireStateChange(new StateChangeEvent(configName,
StateChangeType.DELETE));
}
} else if (buttonId == LOAD_ID) {
ISelection selection = this.viewer.getSelection();
if (selection != null && selection instanceof IStructuredSelection) {