@Test public void testMakeMenuBar() { doReturn(Optional.of(mock(WorkspaceProject.class))).when(workbenchContext).getActiveWorkspaceProject(); doReturn(promises.resolve(true)).when(projectController).canUpdateProject(any()); presenter.makeMenuBar(); verify(fileMenuBuilder).addSave(any(MenuItem.class)); verify(fileMenuBuilder).addCopy(any(Path.class), any(AssetUpdateValidator.class)); verify(fileMenuBuilder).addRename(any(Command.class)); verify(fileMenuBuilder).addDelete(any(Command.class)); verify(fileMenuBuilder).addNewTopLevelMenu(alertsButtonMenuItem); verify(presenter).addDownloadMenuItem(fileMenuBuilder); }
@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(); }; fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(getSaveAndRename()) .addDelete(this::onDelete); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addValidate(getValidateCommand()) .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); }
GlobalsEditorPresenter extends KieEditor<GlobalsModel> { @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(); }; fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(getSaveAndRename()) .addDelete(this::onDelete); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addValidate(getValidateCommand()) .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } }
GlobalsEditorPresenter extends KieEditor<GlobalsModel> { @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(); }; fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(getSaveAndRename()) .addDelete(this::onDelete); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addValidate(getValidateCommand()) .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } GlobalsEditorPresenter(); @Inject  GlobalsEditorPresenter(final GlobalsEditorView baseView); }
GlobalsEditorPresenter extends KieEditor<GlobalsModel> { @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(); }; fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(getSaveAndRename()) .addDelete(this::onDelete); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addValidate(getValidateCommand()) .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } GlobalsEditorPresenter(); @Inject  GlobalsEditorPresenter(final GlobalsEditorView baseView); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @Override void onSourceTabSelected(); @WorkbenchPartView IsWidget getWidget(); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); }
GlobalsEditorPresenter extends KieEditor<GlobalsModel> { @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(); }; fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(onSave)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(getSaveAndRename()) .addDelete(this::onDelete); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addValidate(getValidateCommand()) .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } GlobalsEditorPresenter(); @Inject  GlobalsEditorPresenter(final GlobalsEditorView baseView); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @Override void onSourceTabSelected(); @WorkbenchPartView IsWidget getWidget(); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartTitle String getTitleText(); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); static final String EDITOR_ID; }