class NewPluginPopUp implements NewPluginPopUpView.Presenter {

    @Override
    public void onOK(final String name,
                     final PluginType type) {

        pluginNameValidator.validate(name + ".plugin",
                                     new ValidatorWithReasonCallback() {
                                         @Override
                                         public void onFailure(final String reason) {
                                             if (ValidationErrorReason.EMPTY_NAME.name().equals(reason)) {
                                                 view.handleNameValidationError(view.emptyName());
                                             } else if (ValidationErrorReason.DUPLICATED_NAME.name().equals(reason)) {
                                                 view.handleNameValidationError(view.duplicatedName());
                                             } else {
                                                 view.handleNameValidationError(view.invalidName());
                                             }
                                         }

                                         @Override
                                         public void onSuccess() {
                                             pluginServices.call(new RemoteCallback<Plugin>() {
                                                                     @Override
                                                                     public void callback(final Plugin response) {
                                                                         placeManager.goTo(getPathPlaceRequest(response));
                                                                         hide();
                                                                     }
                                                                 },
                                                                 new ErrorCallback<Object>() {
                                                                     @Override
                                                                     public boolean error(final Object message,
                                                                                          final Throwable throwable) {
                                                                         if (throwable instanceof PluginAlreadyExists) {
                                                                             view.handleNameValidationError(view.duplicatedName());
                                                                         } else {
                                                                             view.handleNameValidationError(view.invalidName());
                                                                         }
                                                                         return false;
                                                                     }
                                                                 }).createNewPlugin(name,
                                                                                    type);
                                         }

                                         @Override
                                         public void onFailure() {
                                             view.handleNameValidationError(view.invalidName());
                                         }
                                     });
    }

    protected  NewPluginPopUp();
    @Inject public  NewPluginPopUp(final NewPluginPopUpView view);

}