SimpleFeatureType ft = (SimpleFeatureType) viewer.getInput();
if (e.character == SWT.ESC) {
nameText.setText(ft.getTypeName());
} else
if (e.character == SWT.Selection) {
SimpleFeatureTypeBuilder ftB = new SimpleFeatureTypeBuilder();
ftB.init(ft);
ftB.setName(nameText.getText());
featureType = ftB.buildFeatureType();
viewer.setInput(featureType);
} else {
errorDecorator.hide();
}
}
public void keyReleased( KeyEvent e ) {
SimpleFeatureType ft = (SimpleFeatureType) viewer.getInput();
SimpleFeatureTypeBuilder ftB = new SimpleFeatureTypeBuilder();
ftB.init(ft);
ftB.setName(nameText.getText());
featureType = ftB.buildFeatureType();
viewer.setInput(featureType);
}
public void focusGained( FocusEvent e ) {
int end = nameText.getText().length();
nameText.setSelection(0, end);
}
public void focusLost( FocusEvent e ) {
SimpleFeatureType ft = (SimpleFeatureType) viewer.getInput();
SimpleFeatureTypeBuilder ftB = new SimpleFeatureTypeBuilder();
ftB.init(ft);
ftB.setName(nameText.getText());
featureType = ftB.buildFeatureType();
viewer.setInput(featureType);
}
}