-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Hide tabs without restart #12958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Hide tabs without restart #12958
Conversation
TaskExecutor taskExecutor | ||
) { | ||
super(aiService, aiPreferences, externalApplicationsPreferences, dialogService); | ||
super(aiService, aiPreferences, externalApplicationsPreferences, dialogService, adaptVisibleTabs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor call in the superclass has been modified to include 'adaptVisibleTabs', but the JavaDoc for the constructor has not been updated to reflect this change.
|
||
public AiPrivacyNoticeGuardedComponent(AiPreferences aiPreferences, ExternalApplicationsPreferences externalApplicationsPreferences, DialogService dialogService) { | ||
public AiPrivacyNoticeGuardedComponent(AiPreferences aiPreferences, ExternalApplicationsPreferences externalApplicationsPreferences, DialogService dialogService, AdaptVisibleTabs adaptVisibleTabs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JavaDoc for the constructor should be updated to include the new parameter 'AdaptVisibleTabs adaptVisibleTabs' as per the special instructions.
) { | ||
super(aiPreferences, externalApplicationsPreferences, dialogService); | ||
super(aiPreferences, externalApplicationsPreferences, dialogService, adaptVisibleTabs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor call now includes an additional parameter 'adaptVisibleTabs', but there is no JavaDoc update reflecting this change. JavaDoc should be updated to include this new parameter.
) { | ||
super(aiPreferences, externalApplicationsPreferences, dialogService); | ||
super(aiPreferences, externalApplicationsPreferences, dialogService, adaptVisibleTabs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor call to the superclass now includes a new parameter 'adaptVisibleTabs', but the JavaDoc for the constructor has not been updated to reflect this change.
@@ -18,6 +18,7 @@ public class AiSummaryTab extends EntryEditorTab { | |||
private final AiService aiService; | |||
private final DialogService dialogService; | |||
private final StateManager stateManager; | |||
private final AdaptVisibleTabs adaptVisibleTabs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field 'adaptVisibleTabs' is introduced but not documented in the JavaDoc of the constructor. This violates the requirement to update JavaDoc when method arguments change.
@@ -87,7 +87,7 @@ | |||
* <p> | |||
* The editors for fields are created via {@link org.jabref.gui.fieldeditors.FieldEditors}. | |||
*/ | |||
public class EntryEditor extends BorderPane implements PreviewControls { | |||
public class EntryEditor extends BorderPane implements PreviewControls, AdaptVisibleTabs { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class now implements AdaptVisibleTabs, but the JavaDoc for the class does not reflect this change. The JavaDoc should be updated to include information about the new interface implementation.
// Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. | ||
new UndoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager), | ||
new RedoAction(this::getCurrentLibraryTab, undoManager, dialogService, stateManager)); | ||
Injector.setModelOrService(EntryEditor.class, entryEditor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Injector.setModelOrService call is duplicated in the patch. This could lead to unnecessary redundancy and potential maintenance issues.
TaskExecutor taskExecutor, | ||
CustomLocalDragboard localDragboard | ||
) { | ||
this.stateManager = Objects.requireNonNull(stateManager); | ||
this.dialogService = Objects.requireNonNull(dialogService); | ||
this.aiService = Objects.requireNonNull(aiService); | ||
this.preferences = Objects.requireNonNull(preferences); | ||
this.adaptVisibleTabs = adaptVisibleTabs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of Objects.requireNonNull should be replaced with @nonnull annotation to ensure the adaptVisibleTabs parameter is not null, aligning with the project's guidelines.
@@ -50,6 +53,7 @@ public SidePaneContentFactory(LibraryTabContainer tabContainer, | |||
this.dialogService = dialogService; | |||
this.aiService = aiService; | |||
this.stateManager = stateManager; | |||
this.adaptVisibleTabs = adaptVisibleTabs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment of adaptVisibleTabs in the constructor lacks a null check, which violates the fail-fast principle by not immediately handling invalid states.
The build of this PR is available at https://builds.jabref.org/pull/12958/merge. |
I believe to correct future approach would be to observe an observable list of visible tabs, A Pane in the ai package would implement an interface of the EntryEditor interface and that could be added to or removed from the list. |
Follow-up? Still not clear how to access this list from "somewhere". I was about to add an event bus for the general (cause sender and receiver are decoupled), but did not dare 😅 |
Yes follow up eventually. When we rewrite the entry editor. List would sit in the StateManager. |
Yeah, looks a bit weird now. I would have expected an observabelist of tabs in the state manager |
That would have been much more effort for me 😅. I did not use any dependency injection; instead explicitly passing the dependency down. Proposal: Either someone improves the code significantly the next two weeks or we merge and do follow-up PRs. Currently, restarting only because of hiding is bad UX IMHO. |
Im ok with follow-up. We need to push forward here. Will also increase pressure on us to finally work on the issues with the entry editor. |
Maybe put a fixme or todo in the code as a bad conscience reminder |
This strategy might also solve #12865 |
Follow-up to #12919
Hides tabs without reload.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)