use of org.eclipse.sirius.web.services.explorer.api.IRenameTreeItemHandler in project sirius-web by eclipse-sirius.
the class ExplorerDescriptionProvider method getRenameHandler.
private IStatus getRenameHandler(VariableManager variableManager, String newLabel) {
var optionalEditingContext = variableManager.get(IEditingContext.EDITING_CONTEXT, IEditingContext.class);
var optionalTreeItem = variableManager.get(TreeItem.SELECTED_TREE_ITEM, TreeItem.class);
if (optionalEditingContext.isPresent() && optionalTreeItem.isPresent()) {
IEditingContext editingContext = optionalEditingContext.get();
TreeItem treeItem = optionalTreeItem.get();
// @formatter:off
var optionalHandler = this.renameTreeItemHandlers.stream().filter(handler -> handler.canHandle(editingContext, treeItem, newLabel)).findFirst();
if (optionalHandler.isPresent()) {
IRenameTreeItemHandler renameTreeItemHandler = optionalHandler.get();
return renameTreeItemHandler.handle(editingContext, treeItem, newLabel);
}
}
// $NON-NLS-1$
return new Failure("");
}
Aggregations