@Test public void testMakeMenuBarWithoutUpdateProjectPermission() { doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject(); doReturn(promises.resolve(false)).when(projectController).canUpdateProject(any()); presenter.makeMenuBar(); verify(menuBuilder, never()).addSave(any(MenuItem.class)); verify(menuBuilder, never()).addCopy(any(Path.class), any(AssetUpdateValidator.class)); verify(menuBuilder, never()).addRename(any(Command.class)); verify(menuBuilder, never()).addDelete(any(Path.class), any(AssetUpdateValidator.class)); verify(menuBuilder).addNewTopLevelMenu(alertsButtonMenuItem); }
@Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); }
ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } }
ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject  ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
                                         final Caller<ProjectImportsService> importsService,
                                         final Others category); }
ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject  ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
                                         final Caller<ProjectImportsService> importsService,
                                         final Others category); @OnStartup void init(final ObservablePath path,
                     final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); }
ProjectImportsScreenPresenter extends KieEditor<ProjectImports> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { final ParameterizedCommand<Boolean> onSave = withComments -> { saveWithComments = withComments; saveAction(); }; this.fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), getRenameValidator()) .addRename(getSaveAndRename()) .addDelete(versionRecordManager.getPathToLatest(), getRenameValidator()); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } ProjectImportsScreenPresenter(); @Inject  ProjectImportsScreenPresenter(final ProjectImportsScreenView view,
                                         final Caller<ProjectImportsService> importsService,
                                         final Others category); @OnStartup void init(final ObservablePath path,
                     final PlaceRequest place); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartView IsWidget asWidget(); @OnClose @Override void onClose(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnMayClose boolean mayClose(); static final String EDITOR_ID; }