Skip to content

Gradle tab (tasks, dependencies, sync gradle project, download sources)#115

Merged
DaRealTurtyWurty merged 10 commits intoRailroad-Team:devfrom
DaRealTurtyWurty:gradle-tab
Dec 20, 2025
Merged

Gradle tab (tasks, dependencies, sync gradle project, download sources)#115
DaRealTurtyWurty merged 10 commits intoRailroad-Team:devfrom
DaRealTurtyWurty:gradle-tab

Conversation

@DaRealTurtyWurty
Copy link
Member

This pull request introduces several significant changes to the Gradle integration and localization features in the codebase. The most notable updates include refactoring the Gradle model and settings classes to use new data transfer objects, removing legacy Gradle task modeling code, and adding new localization support for UI components. These changes aim to improve maintainability, enable richer Gradle project representation, and enhance UI localization.

Gradle model and settings refactor:

  • Refactored GradleSettings from a record to a mutable class with Lombok annotations, and updated related usages to use getter/setter methods instead of direct field access. This improves flexibility and compatibility with frameworks expecting JavaBeans conventions. [1] [2] [3] [4]
  • Updated GradleBuildModel and GradleProjectModel to use new DTOs (FabricDataModel, RailroadProject, RailroadGradleTask, RailroadConfiguration) for richer project and task representation. [1] [2] [3]

Removal of legacy Gradle task modeling:

  • Removed obsolete classes and enums related to the old Gradle task modeling approach: GradleModelMapper, GradleTaskModel, GradleTaskArgument, and GradleTaskArgType. [1] [2] [3] [4]

Gradle manager and environment improvements:

  • Refactored GradleManager to cache and expose GradleSettings directly, and to build settings using the new approach. This simplifies environment initialization and future configuration updates. [1] [2] [3] [4] [5]

Localization enhancements:

  • Added a new LocalizedTab class to support localized JavaFX tabs, and extended LocalizedMenuItem to allow setting a graphic node alongside the localized text. [1] [2] [3]

Plugin configuration:

  • Added the implementation class reference for the Gradle plugin in META-INF/gradle-plugins/dev.railroadide.railroadgradleplugin.properties.

Introduces new Gradle UI classes for project and task context menus, task tree builder, and tasks pane. Refactors RRButton to use a support class for shared logic and adds LocalizedTab for localized JavaFX tabs. GradleSettings is converted from a record to a class with getters/setters, and related usages are updated. GradleModelMapper and GradleTaskModel are updated to associate tasks with their project, improving model mapping and equality checks. GradleManager now supports saving Gradle settings. Various improvements and new features for Gradle integration and UI localization.
Introduces a new 'Download Sources' button in the Gradle tool window, which triggers a bundled init script to download sources for all Gradle projects using the updated download-sources plugin (v1.0.1). Implements supporting logic in GradleManager and adds the required init script resource.
GradleTaskContextMenu now checks for an existing run configuration before creating a new one, preventing duplicate configurations for the same Gradle task. Added a helper to set the selected run configuration in RunConfigurationManager. GradleTasksPane updated to use the new logic.
Replaces GradleTasksPane and related classes with a generic GradleTreeViewPane and GradleTreeBuilder interface, enabling both task and dependency tree views. Adds support for displaying Gradle dependency configurations and their trees in the UI, updates model mapping to include dependency data, and refactors context menus and resource keys for consistency. Removes obsolete task tree classes and updates styles and resource references accordingly.
Deleted dev.railroadide.fabricExtractorPlugin.properties and dev.railroadide.javaVersionExtractorPlugin.properties from META-INF/gradle-plugins
Replaces custom Gradle model and task classes with DTOs from railroad-gradle-plugin. Removes obsolete mapping and argument classes, updates UI and service layers to use new types, and simplifies model loading logic. Also updates build.gradle to depend on the unified plugin and removes unused init scripts.

This is a WIP.
Refactored GradleManager to detect Gradle projects and extract Gradle version directly from gradle-wrapper.properties. Updated GradleFacetDetector to simplify facet data and rely on GradleManager for detection. Improved Gradle model loading by injecting an init script for plugin application in ToolingGradleModelService. Enhanced GradleTasksPane and GradleDependenciesPane to extract data from the cached model. Added error logging for model reload failures. Moved Gradle tab opening logic into a reusable method in IDESetup. Added the init-gradle-plugin.gradle script to resources.
Updated Gradle plugin usage to 'RailroadGradlePlugin:1.0.0' and refactored init scripts for improved plugin application. Enhanced dependency tree builder to group configurations by module and display module nodes. Improved model service to handle missing models gracefully. Minor code cleanups and bug fixes in JavaFacetDetector, GradleTasksPane, and JDK class.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request modernizes the Gradle integration by replacing legacy task modeling with a new DTO-based architecture using RailroadGradlePlugin. The changes consolidate Gradle model extraction into a single plugin, remove three separate init scripts, and introduce a comprehensive Gradle tools UI with task and dependency visualization.

  • Replaced legacy GradleTaskModel, GradleTaskArgument, and GradleModelMapper with DTOs from RailroadGradlePlugin (RailroadProject, RailroadGradleTask, RailroadConfiguration, etc.)
  • Refactored GradleSettings from an immutable record to a mutable Lombok-annotated class to support runtime modifications (e.g., toggling offline mode)
  • Added new Gradle UI components: GradleToolsPane with tasks/dependencies tabs, tree builders, and context menus for running tasks directly from the UI
  • Enhanced localization support with LocalizedTab and extended LocalizedMenuItem to accept graphic nodes
  • Refactored RRButton to support toggle buttons with proper CSS pseudo-class states

Reviewed changes

Copilot reviewed 55 out of 57 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
GradleSettings.java Converted from record to mutable class with getters/setters
GradleBuildModel.java Updated to use RailroadProject and FabricDataModel DTOs
GradleManager.java Added downloadAllSources(), saveSettings(), and isGradleProject() methods; improved Gradle version parsing
ToolingGradleModelService.java Refactored model loading to use new init script and DTOs; removed legacy task argument extraction
GradleRunConfigurationData.java Updated to use RailroadGradleTask and RailroadGradleTaskArgument interfaces
GradleToolsPane.java New UI component providing sync, download sources, and offline mode buttons
GradleTasksPane.java / GradleDependenciesPane.java New tree-based views for tasks and dependencies
Gradle tree components New tree element classes (GradleTaskElement, GradleProjectElement, etc.) for UI rendering
LocalizedTab.java New class for localized JavaFX tabs
LocalizedMenuItem.java Extended to support graphic nodes alongside text
RRButton.java Refactored with internal RRButtonBase helper; added Toggle inner class for toggle buttons
Facet detectors Updated to accept Project instead of Path; refactored to use new Gradle model service
Init scripts Removed init-task-args.gradle, init-java-version.gradle, init-fabric-extractor.gradle; added init-gradle-plugin.gradle and init-download-sources.gradle
build.gradle Replaced separate plugin dependencies with unified RailroadGradlePlugin

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DaRealTurtyWurty DaRealTurtyWurty linked an issue Dec 19, 2025 that may be closed by this pull request
Signed-off-by: Ryan <43997792+DaRealTurtyWurty@users.noreply.github.com>
@DaRealTurtyWurty DaRealTurtyWurty merged commit 1360d6b into Railroad-Team:dev Dec 20, 2025
1 check passed
DaRealTurtyWurty added a commit that referenced this pull request Jan 16, 2026
…s) (#115)

* Add Gradle UI components and refactor Gradle model

Introduces new Gradle UI classes for project and task context menus, task tree builder, and tasks pane. Refactors RRButton to use a support class for shared logic and adds LocalizedTab for localized JavaFX tabs. GradleSettings is converted from a record to a class with getters/setters, and related usages are updated. GradleModelMapper and GradleTaskModel are updated to associate tasks with their project, improving model mapping and equality checks. GradleManager now supports saving Gradle settings. Various improvements and new features for Gradle integration and UI localization.

* Add Gradle sources download feature

Introduces a new 'Download Sources' button in the Gradle tool window, which triggers a bundled init script to download sources for all Gradle projects using the updated download-sources plugin (v1.0.1). Implements supporting logic in GradleManager and adds the required init script resource.

* Reuse existing Gradle run configurations if available

GradleTaskContextMenu now checks for an existing run configuration before creating a new one, preventing duplicate configurations for the same Gradle task. Added a helper to set the selected run configuration in RunConfigurationManager. GradleTasksPane updated to use the new logic.

* Refactor Gradle UI to support dependency tree view

Replaces GradleTasksPane and related classes with a generic GradleTreeViewPane and GradleTreeBuilder interface, enabling both task and dependency tree views. Adds support for displaying Gradle dependency configurations and their trees in the UI, updates model mapping to include dependency data, and refactors context menus and resource keys for consistency. Removes obsolete task tree classes and updates styles and resource references accordingly.

* Remove plugin properties files from META-INF

Deleted dev.railroadide.fabricExtractorPlugin.properties and dev.railroadide.javaVersionExtractorPlugin.properties from META-INF/gradle-plugins

* Refactor Gradle model to use plugin DTOs

Replaces custom Gradle model and task classes with DTOs from railroad-gradle-plugin. Removes obsolete mapping and argument classes, updates UI and service layers to use new types, and simplifies model loading logic. Also updates build.gradle to depend on the unified plugin and removes unused init scripts.

This is a WIP.

* Refactor Gradle integration and improve model loading

Refactored GradleManager to detect Gradle projects and extract Gradle version directly from gradle-wrapper.properties. Updated GradleFacetDetector to simplify facet data and rely on GradleManager for detection. Improved Gradle model loading by injecting an init script for plugin application in ToolingGradleModelService. Enhanced GradleTasksPane and GradleDependenciesPane to extract data from the cached model. Added error logging for model reload failures. Moved Gradle tab opening logic into a reusable method in IDESetup. Added the init-gradle-plugin.gradle script to resources.

* Refactor Gradle plugin integration and dependency tree

Updated Gradle plugin usage to 'RailroadGradlePlugin:1.0.0' and refactored init scripts for improved plugin application. Enhanced dependency tree builder to group configurations by module and display module nodes. Improved model service to handle missing models gracefully. Minor code cleanups and bug fixes in JavaFacetDetector, GradleTasksPane, and JDK class.

* Implement copilot suggestions and fix merge errors

---------

Signed-off-by: Ryan <43997792+DaRealTurtyWurty@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gradle Tab

1 participant