@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(Path.class), any(AssetUpdateValidator.class)); verify(fileMenuBuilder).addDelete(any(Path.class), any(AssetUpdateValidator.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) { fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(this::saveAction)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addDelete(versionRecordManager.getCurrentPath(), assetUpdateValidator); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); }
GuvnorDefaultEditorPresenter extends KieEditor<String> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(this::saveAction)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addDelete(versionRecordManager.getCurrentPath(), assetUpdateValidator); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } }
GuvnorDefaultEditorPresenter extends KieEditor<String> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(this::saveAction)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addDelete(versionRecordManager.getCurrentPath(), assetUpdateValidator); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } @Inject  GuvnorDefaultEditorPresenter(final GuvnorDefaultEditorView baseView); }
GuvnorDefaultEditorPresenter extends KieEditor<String> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(this::saveAction)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addDelete(versionRecordManager.getCurrentPath(), assetUpdateValidator); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } @Inject  GuvnorDefaultEditorPresenter(final GuvnorDefaultEditorView baseView); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnClose @Override void onClose(); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartView IsWidget getWidget(); }
GuvnorDefaultEditorPresenter extends KieEditor<String> { @Override protected Promise<Void> makeMenuBar() { if (workbenchContext.getActiveWorkspaceProject().isPresent()) { final WorkspaceProject activeProject = workbenchContext.getActiveWorkspaceProject().get(); return projectController.canUpdateProject(activeProject).then(canUpdateProject -> { if (canUpdateProject) { fileMenuBuilder .addSave(versionRecordManager.newSaveMenuItem(this::saveAction)) .addCopy(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addRename(versionRecordManager.getCurrentPath(), assetUpdateValidator) .addDelete(versionRecordManager.getCurrentPath(), assetUpdateValidator); } addDownloadMenuItem(fileMenuBuilder); fileMenuBuilder .addNewTopLevelMenu(versionRecordManager.buildMenu()) .addNewTopLevelMenu(alertsButtonMenuItemBuilder.build()); return promises.resolve(); }); } return promises.resolve(); } @Inject  GuvnorDefaultEditorPresenter(final GuvnorDefaultEditorView baseView); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @OnClose @Override void onClose(); @WorkbenchPartTitle String getTitleText(); @WorkbenchPartTitleDecoration IsWidget getTitle(); @WorkbenchPartView IsWidget getWidget(); static final String EDITOR_ID; }