use of org.eclipse.sirius.web.services.explorer.api.IDeleteTreeItemHandler in project sirius-web by eclipse-sirius.
the class ExplorerDescriptionProvider method getDeleteHandler.
private IStatus getDeleteHandler(VariableManager variableManager) {
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.deleteTreeItemHandlers.stream().filter(handler -> handler.canHandle(editingContext, treeItem)).findFirst();
if (optionalHandler.isPresent()) {
IDeleteTreeItemHandler deleteTreeItemHandler = optionalHandler.get();
return deleteTreeItemHandler.handle(editingContext, treeItem);
}
}
// $NON-NLS-1$
return new Failure("");
}
Aggregations