import org.simantics.db.common.NamedResource;
import org.simantics.db.common.request.WriteRequest;
import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.function.DbConsumer;
import org.simantics.layer0.Layer0;
import org.simantics.modeling.userComponent.ComponentTypeCommands;
import org.simantics.scl.runtime.function.Function2;
public void editName(Table table, TableEditor editor, final ComponentTypeViewerPropertyInfo propertyInfo, TableItem selectedItem, int column,
Pattern namePattern) {
+ editName(table, editor, propertyInfo, selectedItem, column, namePattern, null);
+ }
+
+ public void editName(Table table, TableEditor editor, final ComponentTypeViewerPropertyInfo propertyInfo, TableItem selectedItem, int column,
+ Pattern namePattern, DbConsumer<WriteGraph> extraWriter) {
editName(table, editor, propertyInfo, selectedItem, column,
- (pInfo, name) -> validatePropertyName(pInfo, name, namePattern));
+ (pInfo, name) -> validatePropertyName(pInfo, name, namePattern),
+ extraWriter);
+ }
+
+ public void editName(Table table, TableEditor editor, ComponentTypeViewerPropertyInfo propertyInfo, TableItem selectedItem, int column,
+ Function2<ComponentTypeViewerPropertyInfo, String, String> nameValidator)
+ {
+ editName(table, editor, propertyInfo, selectedItem, column, nameValidator, null);
}
public void editName(Table table, TableEditor editor, final ComponentTypeViewerPropertyInfo propertyInfo, TableItem selectedItem, int column,
- Function2<ComponentTypeViewerPropertyInfo, String, String> nameValidator) {
+ Function2<ComponentTypeViewerPropertyInfo, String, String> nameValidator, DbConsumer<WriteGraph> extraWriter) {
int extraStyle = propertyInfo.immutable ? SWT.READ_ONLY : 0;
final Text text = new Text(table, SWT.NONE | extraStyle);
org.eclipse.swt.widgets.Listener listener =
ComponentTypeCommands.rename(graph, propertyInfo.resource, newValue);
if (setLabel)
ComponentTypeCommands.setLabel(graph, propertyInfo.resource, ComponentTypeCommands.camelCaseNameToLabel(newValue));
+
+ if (extraWriter != null)
+ extraWriter.accept(graph);
}
});
}