File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/main/kotlin/org/domaframework/doma/intellij Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,23 @@ import com.intellij.openapi.wm.IdeFocusManager
2323object ActiveProjectHelper {
2424 private var activeProject: Project ? = null
2525
26+ /* *
27+ * Sets the current active project.
28+ *
29+ * @param value the project to set as active, or null to clear
30+ */
2631 fun setCurrentActiveProject (value : Project ? ) {
2732 activeProject = value
2833 }
2934
35+ /* *
36+ * Returns the current active project.
37+ *
38+ * If called from the EDT, tries to get the project with UI focus.
39+ * Otherwise, returns the first open project or the last set active project.
40+ *
41+ * @return the current active [Project], or null if none is available
42+ */
3043 fun getCurrentActiveProject (): Project ? {
3144 // If EDT, get from focus
3245 if (ApplicationManager .getApplication().isDispatchThread) {
@@ -42,6 +55,11 @@ object ActiveProjectHelper {
4255 return activeProject
4356 }
4457
58+ /* *
59+ * Returns the project that currently has UI focus, if any.
60+ *
61+ * @return the [Project] with UI focus, or null if none
62+ */
4563 private fun getActiveUIProject (): Project ? {
4664 val openProjects: Array <out Project > = ProjectManager .getInstance().openProjects
4765 for (project in openProjects) {
Original file line number Diff line number Diff line change @@ -29,6 +29,15 @@ class DomaToolsConfigurable : Configurable {
2929
3030 override fun getDisplayName (): String = " Doma Tools"
3131
32+ /* *
33+ * Creates and returns the settings panel component.
34+ *
35+ * Gets the current active project and initializes the settings panel.
36+ * If no project is active, the panel will be disabled.
37+ * Loads both format settings and custom function settings for the active project.
38+ *
39+ * @return The settings panel component, or null if creation fails
40+ */
3241 override fun createComponent (): JComponent ? {
3342 val project = ActiveProjectHelper .getCurrentActiveProject()
3443 val panel = mySettingsComponent?.panel ? : return null
You can’t perform that action at this time.
0 commit comments