protected override void OnExecute(object parameter) { if (!CanExecute(parameter) || !(parameter is CodeExplorerItemViewModel node)) { return; } if (node is CodeExplorerCustomFolderViewModel folderNode) { _renameFolderCommand.Execute(folderNode); return; } if (node.Declaration == null) { return; } try { _refactoring.Refactor(node.Declaration); } catch (RefactoringAbortedException) { } catch (RefactoringException exception) { _failureNotifier.Notify(exception); } }
protected override void OnExecute(object parameter) { if (!(parameter is System.ValueTuple <IAnnotation, ICodeExplorerNode> data)) { return; } var(annotation, node) = data; var target = node?.Declaration; try { var model = ModelFromParameter(annotation, target); if (!annotation.AllowedArguments.HasValue || annotation.AllowedArguments.Value > 0 || annotation is IAttributeAnnotation) { model = _userInteraction.UserModifiedModel(model); } _annotateAction.Refactor(model); } catch (RefactoringAbortedException) {} catch (RefactoringException exception) { _failureNotifier.Notify(exception); } }
protected override void OnExecute(object parameter) { if (!CanExecute(parameter)) { return; } try { var model = ModelFromParameter(parameter); ValidateModel(model); _refactoringAction.Refactor(model); } catch (RefactoringAbortedException) { } catch (RefactoringException exception) { _failureNotifier.Notify(exception); } }
protected override void OnExecute(object parameter) { if (!CanExecute(parameter) || !(parameter is CodeExplorerItemViewModel node) || node.Declaration == null) { return; } try { _refactoring.Refactor(node.Declaration); } catch (RefactoringAbortedException) { } catch (RefactoringException exception) { _failureNotifier.Notify(exception); } }
private static void ExecuteRefactoringAction <TModel>( TModel model, object parameter, Action <TModel> initialModelValidation, Func <TModel, object, TModel> modelModification, IRefactoringAction <TModel> refactoringAction, IRefactoringFailureNotifier failureNotifier) where TModel : class, IRefactoringModel { try { initialModelValidation(model); var modifiedModel = modelModification(model, parameter); refactoringAction.Refactor(modifiedModel); } catch (RefactoringAbortedException) {} catch (RefactoringException exception) { failureNotifier.Notify(exception); } }