@Test public void testOnRepositoryRemoved() { doReturn(promises.resolve(true)).when(projectController).canUpdateProject(any()); final Repository repository = mock(Repository.class); when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.of(new WorkspaceProject(mock(OrganizationalUnit.class), repository, mock(Branch.class), mock(Module.class)))); editor.setupMenuBar(); editor.onRepositoryRemoved(new RepositoryRemovedEvent(repository)); verify(editor, times(1)).enableMenus(eq(false)); verify(editor, times(4)).enableMenuItem(eq(false), any(MenuItems.class)); verify(saveMenuItem, times(1)).setEnabled(eq(false)); verify(versionManagerMenuItem, times(1)).setEnabled(eq(false)); }
void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) { Optional.ofNullable(workbenchContext) .flatMap(context -> context.getActiveWorkspaceProject()) .filter(proj -> event.getRepository() != null && proj.getRepository().equals(event.getRepository())) .ifPresent(repo -> enableMenus(false)); }
KieMultipleDocumentEditor implements KieMultipleDocumentEditorPresenter<D> { void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) { Optional.ofNullable(workbenchContext) .flatMap(context -> context.getActiveWorkspaceProject()) .filter(proj -> event.getRepository() != null && proj.getRepository().equals(event.getRepository())) .ifPresent(repo -> enableMenus(false)); } }
KieMultipleDocumentEditor implements KieMultipleDocumentEditorPresenter<D> { void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) { Optional.ofNullable(workbenchContext) .flatMap(context -> context.getActiveWorkspaceProject()) .filter(proj -> event.getRepository() != null && proj.getRepository().equals(event.getRepository())) .ifPresent(repo -> enableMenus(false)); } KieMultipleDocumentEditor();  KieMultipleDocumentEditor(final KieEditorView editorView); }
KieMultipleDocumentEditor implements KieMultipleDocumentEditorPresenter<D> { void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) { Optional.ofNullable(workbenchContext) .flatMap(context -> context.getActiveWorkspaceProject()) .filter(proj -> event.getRepository() != null && proj.getRepository().equals(event.getRepository())) .ifPresent(repo -> enableMenus(false)); } KieMultipleDocumentEditor();  KieMultipleDocumentEditor(final KieEditorView editorView); @Override void registerDocument(final D document); @Override void deregisterDocument(final D document); @Override void activateDocument(final D document,
                                 final Overview overview,
                                 final AsyncPackageDataModelOracle dmo,
                                 final Imports imports,
                                 final boolean isReadOnly); @Override D getActiveDocument(); @Override IsWidget getWidget(); @Override IsWidget getTitleWidget(final D document); @Override void getMenus(final Consumer<Menus> menusConsumer); @Override void onClose(); @Override void onSourceTabSelected(); @Override void updateSource(final String source); @Override void onEditTabSelected(); @Override void onEditTabUnselected(); @Override void onOverviewSelected(); @Override boolean mayClose(final Integer originalHashCode,
                            final Integer currentHashCode); @Override Promise<Void> makeMenuBar(); }
KieMultipleDocumentEditor implements KieMultipleDocumentEditorPresenter<D> { void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) { Optional.ofNullable(workbenchContext) .flatMap(context -> context.getActiveWorkspaceProject()) .filter(proj -> event.getRepository() != null && proj.getRepository().equals(event.getRepository())) .ifPresent(repo -> enableMenus(false)); } KieMultipleDocumentEditor();  KieMultipleDocumentEditor(final KieEditorView editorView); @Override void registerDocument(final D document); @Override void deregisterDocument(final D document); @Override void activateDocument(final D document,
                                 final Overview overview,
                                 final AsyncPackageDataModelOracle dmo,
                                 final Imports imports,
                                 final boolean isReadOnly); @Override D getActiveDocument(); @Override IsWidget getWidget(); @Override IsWidget getTitleWidget(final D document); @Override void getMenus(final Consumer<Menus> menusConsumer); @Override void onClose(); @Override void onSourceTabSelected(); @Override void updateSource(final String source); @Override void onEditTabSelected(); @Override void onEditTabUnselected(); @Override void onOverviewSelected(); @Override boolean mayClose(final Integer originalHashCode,
                            final Integer currentHashCode); @Override Promise<Void> makeMenuBar();  }