@Test public void testAddNewProjectHandler() { doAnswer(invocation -> { ((Command) invocation.getArguments()[1]).execute(); return null; }).when(menuResourceHandlerWidget).init(any(), any()); doAnswer(invocation -> { ((Command) invocation.getArguments()[0]).execute(); return null; }).when(libraryPlaces).closeAllPlacesOrNothing(any()); final NewWorkspaceProjectHandler projectHandler = mock(NewWorkspaceProjectHandler.class); final Command command = mock(Command.class); when(projectHandler.getCommand(any())).thenReturn(command); presenter.addNewProjectHandler(projectHandler); verify(projectHandler).setOpenEditorOnCreation(false); verify(projectHandler).setCreationSuccessCallback(any()); verify(command).execute(); }
void addNewProjectHandler(final NewWorkspaceProjectHandler newWorkspaceProjectHandler) { newWorkspaceProjectHandler.setOpenEditorOnCreation(false); newWorkspaceProjectHandler.setCreationSuccessCallback(project -> { if (project != null) { libraryPlaces.goToProject(project); } }); final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(newWorkspaceProjectHandler.getDescription(), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); newWorkspaceProjectHandler.getCommand(newResourcePresenter).execute(); })); view.addOtherProject(menuResourceHandlerWidget); }
AddProjectButtonPresenter { void addNewProjectHandler(final NewWorkspaceProjectHandler newWorkspaceProjectHandler) { newWorkspaceProjectHandler.setOpenEditorOnCreation(false); newWorkspaceProjectHandler.setCreationSuccessCallback(project -> { if (project != null) { libraryPlaces.goToProject(project); } }); final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(newWorkspaceProjectHandler.getDescription(), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); newWorkspaceProjectHandler.getCommand(newResourcePresenter).execute(); })); view.addOtherProject(menuResourceHandlerWidget); } }
AddProjectButtonPresenter { void addNewProjectHandler(final NewWorkspaceProjectHandler newWorkspaceProjectHandler) { newWorkspaceProjectHandler.setOpenEditorOnCreation(false); newWorkspaceProjectHandler.setCreationSuccessCallback(project -> { if (project != null) { libraryPlaces.goToProject(project); } }); final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(newWorkspaceProjectHandler.getDescription(), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); newWorkspaceProjectHandler.getCommand(newResourcePresenter).execute(); })); view.addOtherProject(menuResourceHandlerWidget); } @Inject  AddProjectButtonPresenter(final View view,
                                     final ManagedInstance<AddProjectPopUpPresenter> addProjectPopUpPresenters,
                                     final ManagedInstance<MenuResourceHandlerWidget> menuResourceHandlerWidgets,
                                     final ManagedInstance<NewWorkspaceProjectHandler> newProjectHandlers,
                                     final NewResourcePresenter newResourcePresenter,
                                     final ProjectController projectController,
                                     final TranslationService translationService,
                                     final LibraryPlaces libraryPlaces); }
AddProjectButtonPresenter { void addNewProjectHandler(final NewWorkspaceProjectHandler newWorkspaceProjectHandler) { newWorkspaceProjectHandler.setOpenEditorOnCreation(false); newWorkspaceProjectHandler.setCreationSuccessCallback(project -> { if (project != null) { libraryPlaces.goToProject(project); } }); final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(newWorkspaceProjectHandler.getDescription(), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); newWorkspaceProjectHandler.getCommand(newResourcePresenter).execute(); })); view.addOtherProject(menuResourceHandlerWidget); } @Inject  AddProjectButtonPresenter(final View view,
                                     final ManagedInstance<AddProjectPopUpPresenter> addProjectPopUpPresenters,
                                     final ManagedInstance<MenuResourceHandlerWidget> menuResourceHandlerWidgets,
                                     final ManagedInstance<NewWorkspaceProjectHandler> newProjectHandlers,
                                     final NewResourcePresenter newResourcePresenter,
                                     final ProjectController projectController,
                                     final TranslationService translationService,
                                     final LibraryPlaces libraryPlaces); @PostConstruct void init(); void addProject(); void enableTrySamples(); void enableImportProject(); boolean userCanCreateProjects(); View getView(); }
AddProjectButtonPresenter { void addNewProjectHandler(final NewWorkspaceProjectHandler newWorkspaceProjectHandler) { newWorkspaceProjectHandler.setOpenEditorOnCreation(false); newWorkspaceProjectHandler.setCreationSuccessCallback(project -> { if (project != null) { libraryPlaces.goToProject(project); } }); final MenuResourceHandlerWidget menuResourceHandlerWidget = menuResourceHandlerWidgets.get(); menuResourceHandlerWidget.init(newWorkspaceProjectHandler.getDescription(), () -> libraryPlaces.closeAllPlacesOrNothing(() -> { libraryPlaces.goToLibrary(); newWorkspaceProjectHandler.getCommand(newResourcePresenter).execute(); })); view.addOtherProject(menuResourceHandlerWidget); } @Inject  AddProjectButtonPresenter(final View view,
                                     final ManagedInstance<AddProjectPopUpPresenter> addProjectPopUpPresenters,
                                     final ManagedInstance<MenuResourceHandlerWidget> menuResourceHandlerWidgets,
                                     final ManagedInstance<NewWorkspaceProjectHandler> newProjectHandlers,
                                     final NewResourcePresenter newResourcePresenter,
                                     final ProjectController projectController,
                                     final TranslationService translationService,
                                     final LibraryPlaces libraryPlaces); @PostConstruct void init(); void addProject(); void enableTrySamples(); void enableImportProject(); boolean userCanCreateProjects(); View getView();  }