Skip to content

Conversation

@DropSnorz
Copy link
Owner

@DropSnorz DropSnorz commented Sep 22, 2025

Relates to #365

@coderabbitai
Copy link

coderabbitai bot commented Sep 22, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The PR removes central dialog stack management, moves dialog lifecycle to instance-scoped controllers, adds a new InstallStepDialogController and FXML for a multi-step installation flow, updates the view registry to preload the install view, and simplifies ExploreController to delegate installs to the new dialog controller.

Changes

Cohort / File(s) Summary
Dialog manager update
owlplug-client/src/main/java/com/owlplug/core/components/DialogManager.java
Removed internal Stack<Dialog> state, related push/pop and on-close handling, removed getDialog() method and java.util.Stack import.
Abstract dialog lifecycle
owlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/AbstractDialogController.java
Added a private Dialog field; show() now lazily initializes and wires onDialogOpened/onDialogClosed to instance dialog; close() and setOverlayClose() operate on the stored dialog.
View registry preload
owlplug-client/src/main/java/com/owlplug/core/components/LazyViewRegistry.java
Added public static final String INSTALL_STEP_VIEW = "INSTALL_STEP_VIEW" and registered "/fxml/dialogs/InstallStepView.fxml" in preload().
New install dialog UI
owlplug-client/src/main/resources/fxml/dialogs/InstallStepView.fxml
Added FXML layout for the multi-step install dialog: BorderPane with progress, Accordion of Prepare/Select/Verify panes, toggle buttons for plugin formats, directory display, override checkbox, and Close/Continue buttons.
New install dialog controller
owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java
New controller orchestrating prepare/select/verify steps, directory chooser handling, default-directory computation, validation/override logic, scheduling BundleInstallTask via ExploreTaskFactory, and closing the dialog. Includes InstallationParameters inner class and public install(PackageBundle) API.
ExploreController integration
owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java
Injected InstallStepDialogController, reordered autowired fields, simplified installPackage/installBundle to emit telemetry and delegate installation to installStepDialogController.install(bundle), removed previous inline installation logic.

Sequence Diagram

sequenceDiagram
    actor User
    participant ExploreController
    participant InstallStepDialogController
    participant DirectoryChooser
    participant ExploreTaskFactory
    participant AbstractDialogController

    User->>ExploreController: request install(bundle)
    ExploreController->>InstallStepDialogController: install(bundle)
    InstallStepDialogController->>InstallStepDialogController: prepareInstallation()
    InstallStepDialogController->>InstallStepDialogController: selectInstallationDirectory()
    alt user opens chooser
        InstallStepDialogController->>DirectoryChooser: show()
        DirectoryChooser->>InstallStepDialogController: selected path
    end
    InstallStepDialogController->>InstallStepDialogController: verifyInstallationDirectory()
    InstallStepDialogController->>ExploreTaskFactory: schedule BundleInstallTask
    rect rgb(220,235,255)
        Note right of AbstractDialogController: Dialog lifecycle handled per controller instance
        InstallStepDialogController->>AbstractDialogController: close()
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The description "Relates to #365" is extremely vague and provides no meaningful information about what the PR actually accomplishes. While it references an issue (which contextually connects it to the changeset), it fails to describe any aspect of the changes such as the new multi-step installation dialog, controller architecture, or workflow refactoring. The description is too minimal to convey what problem is being solved or what functionality is being added, falling short of meaningful documentation. Expand the description to briefly explain the key changes being made, such as: implementing a new multi-step installation dialog (InstallStepDialogController), refactoring the installation workflow to use this new structured sequence, simplifying DialogManager by removing stack management, and updating related components. This would provide reviewers with sufficient context to understand the PR's scope and purpose without requiring them to dig through the code.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Plugin bundle installation sequence" directly relates to the main change in the changeset. The primary modification across these files is the introduction of a new multi-step installation workflow, centered on the new InstallStepDialogController that manages a structured sequence of installation steps (prepare, select directory, verify). The title is concise, clear, and specific enough to convey the core concept without excessive detail or noise. It accurately reflects the central theme of implementing a sequential installation process for plugin bundles.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DropSnorz DropSnorz force-pushed the fix/plugin-install-popup branch 4 times, most recently from f40d900 to 67d1ea4 Compare October 12, 2025 17:55
@DropSnorz DropSnorz force-pushed the fix/plugin-install-popup branch from 67d1ea4 to da5d017 Compare October 20, 2025 15:12
@DropSnorz DropSnorz marked this pull request as ready for review October 20, 2025 15:15
@DropSnorz
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (3)
owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java (2)

131-142: Improve DirectoryChooser UX by setting an initial directory.

Preselect the current or base directory to reduce navigation.

-        DirectoryChooser directoryChooser = new DirectoryChooser();
+        DirectoryChooser directoryChooser = new DirectoryChooser();
+        File current = installParams.getInstallationDirectory();
+        if (current != null && (current.isDirectory() || (current.getParentFile() != null && current.getParentFile().isDirectory()))) {
+          directoryChooser.setInitialDirectory(current.isDirectory() ? current : current.getParentFile());
+        }

162-167: Disable format toggles not present in the bundle to prevent selecting irrelevant formats.

The suggested enhancement is valid. All referenced toggle button fields (vst2ToggleButton, vst3ToggleButton, auToggleButton, lv2ToggleButton) exist in the controller, and bundle.getFormats() correctly returns List<String> containing the normalized format identifiers ("vst2", "vst3", "au", "lv2"). The null check for bundle is appropriate. Implement the suggested refactor to improve user experience by disabling format options unavailable in the package bundle.

owlplug-client/src/main/resources/fxml/dialogs/InstallStepView.fxml (1)

26-26: Progress bar sizing and button semantics are appropriate UX improvements.

Icon paths are correct and resolve to existing assets. The progress bar width constraint (550.0 > dialog width 500.0) should be replaced with responsive sizing using maxWidth, and the buttons should specify default/cancel semantics for standard keyboard navigation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed4d33 and da5d017.

📒 Files selected for processing (6)
  • owlplug-client/src/main/java/com/owlplug/core/components/DialogManager.java (0 hunks)
  • owlplug-client/src/main/java/com/owlplug/core/components/LazyViewRegistry.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/AbstractDialogController.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java (1 hunks)
  • owlplug-client/src/main/resources/fxml/dialogs/InstallStepView.fxml (1 hunks)
💤 Files with no reviewable changes (1)
  • owlplug-client/src/main/java/com/owlplug/core/components/DialogManager.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
owlplug-client/src/main/java/com/owlplug/core/components/LazyViewRegistry.java (1)

46-46: INSTALL_STEP_VIEW registration verified—all resources are available.

The FXML file and icon assets referenced in the constant registration and preload call (lines 46 and 72) all exist and will resolve correctly at runtime. No issues found.

owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (1)

90-91: Singleton controller maintains mutable state; concurrency risk is valid but context-dependent.

The review comment's concern is factually grounded. InstallStepDialogController is a @Controller singleton that maintains mutable instance state (installParams, UI components, toggleGroup, dialog). The install() method is non-blocking and reuses the same dialog instance. If concurrent install() calls occur, state mutations will race and conflict.

The reset() method mitigates but doesn't prevent re-entry issues—it clears UI state but installParams is reassigned afterward in install(), leaving a window for interleaved mutations.

However, the practical risk depends on whether your application can actually trigger concurrent install calls. If installs are UI-thread-only, the risk is minimal. If background tasks or multiple threads can invoke install(), the vulnerability is real.

Recommendation: Verify whether concurrent installs are possible in your execution context. If yes, implement re-entry protection (e.g., flag guard) or switch to @Scope("prototype") to isolate state per install invocation.

@DropSnorz DropSnorz force-pushed the fix/plugin-install-popup branch from da5d017 to dbcd2eb Compare October 22, 2025 15:06
@DropSnorz
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java (3)

54-54: Remove unused Swing import.

javax.swing.text.html.ImageView is imported but never used. This is likely a leftover or mistaken import—JavaFX code uses javafx.scene.image.ImageView.

-import javax.swing.text.html.ImageView;

127-135: Consider using newValue parameter for clarity.

The listener uses obs.getValue() to check the selected toggle. Idiomatic JavaFX listener code uses the n (newValue) parameter directly, making the intent clearer.

-      if (vst2ToggleButton.equals(obs.getValue())) {
+      if (vst2ToggleButton.equals(n)) {
         baseDir = this.getPreferences().get(ApplicationDefaults.VST_DIRECTORY_KEY, "");
-      } else if (vst3ToggleButton.equals(obs.getValue())) {
+      } else if (vst3ToggleButton.equals(n)) {
         baseDir = this.getPreferences().get(ApplicationDefaults.VST3_DIRECTORY_KEY, "");
-      } else if (auToggleButton.equals(obs.getValue())) {
+      } else if (auToggleButton.equals(n)) {
         baseDir = this.getPreferences().get(ApplicationDefaults.AU_DIRECTORY_KEY, "");
-      } else if (lv2ToggleButton.equals(obs.getValue())) {
+      } else if (lv2ToggleButton.equals(n)) {
         baseDir = this.getPreferences().get(ApplicationDefaults.LV2_DIRECTORY_KEY, "");
       }

310-317: Restore button visibility when directory is valid.

When the directory is invalid, line 313 hides directoryChooserButton, but the else block doesn't restore visibility. If the directory becomes valid later (e.g., after user changes it), the button remains hidden until reset() is called.

     if (installationDirectory.exists() && !installationDirectory.isDirectory()) {
       directoryValidText.setText("Installation directory " + installationDirectory.getName() + " is not a directory.");
       directoryChooserButton.setVisible(false);
       result = false;
     } else {
       directoryValidText.setText("Installation directory " + installationDirectory.getName() + " is valid.");
+      directoryChooserButton.setVisible(true);
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da5d017 and dbcd2eb.

📒 Files selected for processing (6)
  • owlplug-client/src/main/java/com/owlplug/core/components/DialogManager.java (0 hunks)
  • owlplug-client/src/main/java/com/owlplug/core/components/LazyViewRegistry.java (2 hunks)
  • owlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/AbstractDialogController.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java (3 hunks)
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java (1 hunks)
  • owlplug-client/src/main/resources/fxml/dialogs/InstallStepView.fxml (1 hunks)
💤 Files with no reviewable changes (1)
  • owlplug-client/src/main/java/com/owlplug/core/components/DialogManager.java
🚧 Files skipped from review as they are similar to previous changes (4)
  • owlplug-client/src/main/resources/fxml/dialogs/InstallStepView.fxml
  • owlplug-client/src/main/java/com/owlplug/core/components/LazyViewRegistry.java
  • owlplug-client/src/main/java/com/owlplug/core/controllers/dialogs/AbstractDialogController.java
  • owlplug-client/src/main/java/com/owlplug/explore/controllers/ExploreController.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-22T15:07:42.818Z
Learnt from: DropSnorz
PR: DropSnorz/OwlPlug#371
File: owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java:236-243
Timestamp: 2025-10-22T15:07:42.818Z
Learning: In InstallStepDialogController.java, the directoryOverrideAllowed validation is intentionally performed in verifyInstallationDirectory() before task creation, not within BundleInstallTask. The task assumes all preconditions are met because it's only created after verification succeeds.

Applied to files:

  • owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (2)
owlplug-client/src/main/java/com/owlplug/explore/controllers/dialogs/InstallStepDialogController.java (2)

352-365: Verify getRemotePackage() cannot return null in path construction.

Lines 356 and 364 call installParams.getBundle().getRemotePackage() without null checks. If getRemotePackage() can return null, these will throw NPE during directory path construction, breaking the installation flow.

If getRemotePackage() can be null, add guards:

       if (shouldGroupByCreator) {
-        String creator = FileUtils.sanitizeFileName(installParams.getBundle().getRemotePackage().getCreator());
-        selectedDirectory = new File(selectedDirectory, creator);
+        if (installParams.getBundle().getRemotePackage() != null) {
+          String creator = FileUtils.sanitizeFileName(installParams.getBundle().getRemotePackage().getCreator());
+          selectedDirectory = new File(selectedDirectory, creator);
+        }
       }

       boolean shouldWrapSubDirectory = this.getPreferences().getBoolean(ApplicationDefaults.STORE_SUBDIRECTORY_ENABLED, true);
       if (shouldWrapSubDirectory) {
-        String subDirectory = FileUtils.sanitizeFileName(installParams.getBundle().getRemotePackage().getName());
-        selectedDirectory = new File(selectedDirectory, subDirectory);
+        if (installParams.getBundle().getRemotePackage() != null) {
+          String subDirectory = FileUtils.sanitizeFileName(installParams.getBundle().getRemotePackage().getName());
+          selectedDirectory = new File(selectedDirectory, subDirectory);
+        }
       }

407-448: LGTM!

The InstallationParameters inner class is a clean POJO with appropriate default values (directoryOverrideAllowed = false, installationConfirmed = true) that align with the validation flow.

@DropSnorz DropSnorz moved this to In Progress in OwlPlug 1.31 Oct 25, 2025
@DropSnorz DropSnorz self-assigned this Oct 25, 2025
@DropSnorz DropSnorz force-pushed the fix/plugin-install-popup branch from dbcd2eb to d269c20 Compare October 26, 2025 15:25
@DropSnorz DropSnorz merged commit 72422ab into master Oct 27, 2025
2 of 3 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in OwlPlug 1.31 Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants