diff --git a/README.md b/README.md index 9f4b084..019bbee 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Lando Plugin for JetBrains IDEs -![Build](https://github.com/AaronFeledy/lando-intellij-plugin/workflows/Build/badge.svg) +![Build](https://github.com/4lando/intellij-plugin/workflows/Build/badge.svg) [![Version](https://img.shields.io/jetbrains/plugin/v/PLUGIN_ID.svg)](https://plugins.jetbrains.com/plugin/PLUGIN_ID) [![Downloads](https://img.shields.io/jetbrains/plugin/d/PLUGIN_ID.svg)](https://plugins.jetbrains.com/plugin/PLUGIN_ID) diff --git a/gradle.properties b/gradle.properties index 179e073..f1fa0c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ # IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html -pluginGroup = com.github.aaronfeledy.landointellijplugin +pluginGroup = dev._4lando.intellij pluginName = Lando Local Development Environment -pluginRepositoryUrl = https://github.com/AaronFeledy/lando-intellij-plugin +pluginRepositoryUrl = https://github.com/4lando/intellij-plugin # SemVer format -> https://semver.org pluginVersion = 0.0.1 diff --git a/settings.gradle.kts b/settings.gradle.kts index 4531e62..fca9454 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,4 +2,4 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" } -rootProject.name = "Lando Local Development Environment" +rootProject.name = "lando-intellij" diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/listeners/LandoStatusListener.kt b/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/listeners/LandoStatusListener.kt deleted file mode 100644 index b49b0d9..0000000 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/listeners/LandoStatusListener.kt +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.aaronfeledy.landointellijplugin.listeners - -interface LandoStatusListener { - fun statusChanged() -} diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/widget/LandoStatusWidget.kt b/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/widget/LandoStatusWidget.kt deleted file mode 100644 index f45f276..0000000 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/widget/LandoStatusWidget.kt +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.aaronfeledy.landointellijplugin.ui.widget - -import com.github.aaronfeledy.landointellijplugin.LandoBundle -import com.github.aaronfeledy.landointellijplugin.services.LandoAppService -import com.github.aaronfeledy.landointellijplugin.services.LandoProjectService -import com.intellij.openapi.project.Project -import com.intellij.openapi.wm.StatusBar -import com.intellij.openapi.wm.StatusBarWidget -import com.intellij.util.Consumer -import icons.LandoIcons -import java.awt.event.MouseEvent -import javax.swing.Icon - - -open class LandoStatusWidget(private val project: Project) : StatusBarWidget, StatusBarWidget.IconPresentation { - - companion object { - const val ID: String = "LandoStatusWidget" - } - - override fun ID(): String = ID - - override fun getPresentation(): StatusBarWidget.WidgetPresentation = this - - override fun install(statusBar: StatusBar) {} - - override fun dispose() {} - - override fun getTooltipText(): String { - return if (LandoAppService.getInstance().started) { - LandoBundle.message("widget.lando.status.tooltip.started") - } else { - LandoBundle.message("widget.lando.status.tooltip.stopped") - } - } - - override fun getClickConsumer(): Consumer { - return Consumer { - TODO("Not yet implemented") - } - } - - override fun getIcon(): Icon { - return if (checkLandoFileAndStatus()) LandoIcons.Status.Started else LandoIcons.Status.Stopped - } - - private fun checkLandoFileAndStatus(): Boolean { - LandoProjectService.getInstance(project).let { thisProject -> - if (thisProject.usesLando()){ - LandoAppService.getInstance().let { landoApp -> - if (landoApp.started) { - return true - } - } - } - } - return false - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoBundle.kt b/src/main/kotlin/dev/_4lando/intellij/LandoBundle.kt similarity index 92% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoBundle.kt rename to src/main/kotlin/dev/_4lando/intellij/LandoBundle.kt index 6aff2d3..de4faa2 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoBundle.kt +++ b/src/main/kotlin/dev/_4lando/intellij/LandoBundle.kt @@ -1,4 +1,4 @@ -package com.github.aaronfeledy.landointellijplugin +package dev._4lando.intellij import com.intellij.DynamicBundle import org.jetbrains.annotations.NonNls diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoData.kt b/src/main/kotlin/dev/_4lando/intellij/LandoData.kt similarity index 95% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoData.kt rename to src/main/kotlin/dev/_4lando/intellij/LandoData.kt index efd382b..ba9becf 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoData.kt +++ b/src/main/kotlin/dev/_4lando/intellij/LandoData.kt @@ -1,4 +1,4 @@ -package com.github.aaronfeledy.landointellijplugin +package dev._4lando.intellij /** * Data class representing the service data for a Lando application. diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoExec.kt b/src/main/kotlin/dev/_4lando/intellij/LandoExec.kt similarity index 95% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoExec.kt rename to src/main/kotlin/dev/_4lando/intellij/LandoExec.kt index bb13da3..9e1f44d 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/LandoExec.kt +++ b/src/main/kotlin/dev/_4lando/intellij/LandoExec.kt @@ -1,10 +1,10 @@ -package com.github.aaronfeledy.landointellijplugin +package dev._4lando.intellij -import com.github.aaronfeledy.landointellijplugin.services.LandoProjectService import com.intellij.execution.process.ProcessHandler import com.intellij.execution.ui.ConsoleViewContentType -import com.github.aaronfeledy.landointellijplugin.ui.console.JeditermConsoleView import com.intellij.openapi.project.Project +import dev._4lando.intellij.services.LandoProjectService +import dev._4lando.intellij.ui.console.JeditermConsoleView import java.io.File import java.io.OutputStream diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/actions/LandoActionGroup.kt b/src/main/kotlin/dev/_4lando/intellij/actions/LandoActionGroup.kt similarity index 89% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/actions/LandoActionGroup.kt rename to src/main/kotlin/dev/_4lando/intellij/actions/LandoActionGroup.kt index cc2c43d..79f2ada 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/actions/LandoActionGroup.kt +++ b/src/main/kotlin/dev/_4lando/intellij/actions/LandoActionGroup.kt @@ -1,21 +1,21 @@ -package com.github.aaronfeledy.landointellijplugin.actions - -import com.intellij.openapi.actionSystem.ActionGroup -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.DefaultActionGroup - -/** - * Determines the Lando menu group Action times. LandoActionGroup] is based on [ActionGroup] because menu - * children are determined on rules other than just positional constraints. - * - * @see ActionGroup - */ -class LandoActionGroup : DefaultActionGroup() { - /** - * Returns an array of menu actions for the group. - * - * @param e Event received when the associated group-id menu is chosen. - * @return AnAction[] An instance of [AnAction], in this case containing a single instance of the - * [LandoStartAction] class. - */ +package dev._4lando.intellij.actions + +import com.intellij.openapi.actionSystem.ActionGroup +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.DefaultActionGroup + +/** + * Determines the Lando menu group Action times. LandoActionGroup] is based on [ActionGroup] because menu + * children are determined on rules other than just positional constraints. + * + * @see ActionGroup + */ +class LandoActionGroup : DefaultActionGroup() { + /** + * Returns an array of menu actions for the group. + * + * @param e Event received when the associated group-id menu is chosen. + * @return AnAction[] An instance of [AnAction], in this case containing a single instance of the + * [LandoStartAction] class. + */ } \ No newline at end of file diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/actions/LandoStartAction.kt b/src/main/kotlin/dev/_4lando/intellij/actions/LandoStartAction.kt similarity index 94% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/actions/LandoStartAction.kt rename to src/main/kotlin/dev/_4lando/intellij/actions/LandoStartAction.kt index 957a979..ccdbc6c 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/actions/LandoStartAction.kt +++ b/src/main/kotlin/dev/_4lando/intellij/actions/LandoStartAction.kt @@ -1,12 +1,12 @@ -package com.github.aaronfeledy.landointellijplugin.actions +package dev._4lando.intellij.actions -import com.github.aaronfeledy.landointellijplugin.LandoExec import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages +import dev._4lando.intellij.LandoExec import java.io.BufferedReader import java.io.File import java.io.InputStreamReader diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/config/LandofileFileType.kt b/src/main/kotlin/dev/_4lando/intellij/config/LandofileFileType.kt similarity index 93% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/config/LandofileFileType.kt rename to src/main/kotlin/dev/_4lando/intellij/config/LandofileFileType.kt index bbe7f76..6ca9703 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/config/LandofileFileType.kt +++ b/src/main/kotlin/dev/_4lando/intellij/config/LandofileFileType.kt @@ -1,12 +1,12 @@ -package com.github.aaronfeledy.landointellijplugin.config +package dev._4lando.intellij.config -import com.github.aaronfeledy.landointellijplugin.LandoBundle import com.intellij.openapi.fileTypes.LanguageFileType import com.intellij.openapi.fileTypes.ex.FileTypeIdentifiableByVirtualFile import com.intellij.openapi.vfs.VirtualFile +import dev._4lando.intellij.LandoBundle import icons.LandoIcons -import org.jetbrains.yaml.YAMLLanguage import javax.swing.Icon +import org.jetbrains.yaml.YAMLLanguage /** * This class represents the file type for Landofile (.lando.yml) configuration files. diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/config/LandofileJsonSchemaProviderFactory.kt b/src/main/kotlin/dev/_4lando/intellij/config/LandofileJsonSchemaProviderFactory.kt similarity index 89% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/config/LandofileJsonSchemaProviderFactory.kt rename to src/main/kotlin/dev/_4lando/intellij/config/LandofileJsonSchemaProviderFactory.kt index 177c3c2..2ccf952 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/config/LandofileJsonSchemaProviderFactory.kt +++ b/src/main/kotlin/dev/_4lando/intellij/config/LandofileJsonSchemaProviderFactory.kt @@ -1,12 +1,12 @@ -package com.github.aaronfeledy.landointellijplugin.config +package dev._4lando.intellij.config -import com.github.aaronfeledy.landointellijplugin.LandoBundle import com.intellij.lang.javascript.EmbeddedJsonSchemaFileProvider import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider import com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory +import dev._4lando.intellij.LandoBundle /** * This class is responsible for providing the JSON schema for Lando files. @@ -18,7 +18,7 @@ class LandofileJsonSchemaProviderFactory : JsonSchemaProviderFactory, DumbAware companion object { const val SCHEMA_FILE_NAME: String = "landofile-spec.json" const val SCHEMA_FILE_DIR: String = "/" - const val SCHEMA_FILE_URL: String = "https://raw.githubusercontent.com/AaronFeledy/lando-intellij-plugin/src/main/resources/landofile-spec.json" + const val SCHEMA_FILE_URL: String = "https://raw.githubusercontent.com/4lando/intellij-plugin/src/main/resources/landofile-spec.json" } override fun getProviders(project: Project): List { diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/listeners/LandoProjectManagerListener.kt b/src/main/kotlin/dev/_4lando/intellij/listeners/LandoProjectManagerListener.kt similarity index 66% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/listeners/LandoProjectManagerListener.kt rename to src/main/kotlin/dev/_4lando/intellij/listeners/LandoProjectManagerListener.kt index 2fc4041..d55b602 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/listeners/LandoProjectManagerListener.kt +++ b/src/main/kotlin/dev/_4lando/intellij/listeners/LandoProjectManagerListener.kt @@ -1,8 +1,8 @@ -package com.github.aaronfeledy.landointellijplugin.listeners +package dev._4lando.intellij.listeners -import com.github.aaronfeledy.landointellijplugin.services.LandoProjectService import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManagerListener +import dev._4lando.intellij.services.LandoProjectService class LandoProjectManagerListener : ProjectManagerListener { override fun projectOpened(project: Project) { diff --git a/src/main/kotlin/dev/_4lando/intellij/listeners/LandoStatusListener.kt b/src/main/kotlin/dev/_4lando/intellij/listeners/LandoStatusListener.kt new file mode 100644 index 0000000..b3d680f --- /dev/null +++ b/src/main/kotlin/dev/_4lando/intellij/listeners/LandoStatusListener.kt @@ -0,0 +1,5 @@ +package dev._4lando.intellij.listeners + +interface LandoStatusListener { + fun statusChanged() +} diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/services/LandoProjectService.kt b/src/main/kotlin/dev/_4lando/intellij/services/LandoProjectService.kt similarity index 95% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/services/LandoProjectService.kt rename to src/main/kotlin/dev/_4lando/intellij/services/LandoProjectService.kt index 024a3bf..08ba3ba 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/services/LandoProjectService.kt +++ b/src/main/kotlin/dev/_4lando/intellij/services/LandoProjectService.kt @@ -1,20 +1,20 @@ -package com.github.aaronfeledy.landointellijplugin.services +package dev._4lando.intellij.services -import com.github.aaronfeledy.landointellijplugin.LandoExec -import com.github.aaronfeledy.landointellijplugin.ServiceData -import com.github.aaronfeledy.landointellijplugin.listeners.LandoProjectManagerListener import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.intellij.execution.process.ProcessHandler import com.intellij.openapi.Disposable +import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.Service import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.guessProjectDir import com.intellij.openapi.vfs.VirtualFile import com.intellij.util.ConcurrencyUtil import com.intellij.util.messages.Topic +import dev._4lando.intellij.LandoExec +import dev._4lando.intellij.ServiceData +import dev._4lando.intellij.listeners.LandoProjectManagerListener import java.util.* import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.TimeUnit diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/services/LandoStatusService.kt b/src/main/kotlin/dev/_4lando/intellij/services/LandoStatusService.kt similarity index 94% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/services/LandoStatusService.kt rename to src/main/kotlin/dev/_4lando/intellij/services/LandoStatusService.kt index b9ce1a6..b22d117 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/services/LandoStatusService.kt +++ b/src/main/kotlin/dev/_4lando/intellij/services/LandoStatusService.kt @@ -1,8 +1,5 @@ -package com.github.aaronfeledy.landointellijplugin.services +package dev._4lando.intellij.services -import com.github.aaronfeledy.landointellijplugin.LandoExec -import com.github.aaronfeledy.landointellijplugin.listeners.LandoStatusListener -import com.github.aaronfeledy.landointellijplugin.ui.console.JeditermConsoleView import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.intellij.openapi.Disposable @@ -12,8 +9,11 @@ import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.ProjectManager import com.intellij.util.messages.Topic import com.pty4j.PtyProcessBuilder -import kotlinx.coroutines.sync.Mutex +import dev._4lando.intellij.LandoExec +import dev._4lando.intellij.listeners.LandoStatusListener +import dev._4lando.intellij.ui.console.JeditermConsoleView import java.util.* +import kotlinx.coroutines.sync.Mutex @Service() class LandoStatusService() : Disposable { diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/LandoToolWindowFactory.kt b/src/main/kotlin/dev/_4lando/intellij/ui/LandoToolWindowFactory.kt similarity index 80% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/LandoToolWindowFactory.kt rename to src/main/kotlin/dev/_4lando/intellij/ui/LandoToolWindowFactory.kt index 535645b..208ca06 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/LandoToolWindowFactory.kt +++ b/src/main/kotlin/dev/_4lando/intellij/ui/LandoToolWindowFactory.kt @@ -1,13 +1,13 @@ -package com.github.aaronfeledy.landointellijplugin.ui +package dev._4lando.intellij.ui -import com.github.aaronfeledy.landointellijplugin.LandoBundle -import com.github.aaronfeledy.landointellijplugin.services.LandoStatusService -import com.github.aaronfeledy.landointellijplugin.ui.console.JeditermConsoleView import com.intellij.openapi.project.Project import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowFactory import com.intellij.openapi.wm.impl.content.ToolWindowContentUi import com.intellij.ui.content.ContentFactory +import dev._4lando.intellij.LandoBundle +import dev._4lando.intellij.services.LandoStatusService +import dev._4lando.intellij.ui.console.JeditermConsoleView class LandoToolWindowFactory : ToolWindowFactory { diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/console/JeditermConsoleView.kt b/src/main/kotlin/dev/_4lando/intellij/ui/console/JeditermConsoleView.kt similarity index 99% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/console/JeditermConsoleView.kt rename to src/main/kotlin/dev/_4lando/intellij/ui/console/JeditermConsoleView.kt index 0768c9b..58218f8 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/console/JeditermConsoleView.kt +++ b/src/main/kotlin/dev/_4lando/intellij/ui/console/JeditermConsoleView.kt @@ -1,4 +1,4 @@ -package com.github.aaronfeledy.landointellijplugin.ui.console +package dev._4lando.intellij.ui.console import com.intellij.execution.filters.Filter import com.intellij.execution.filters.HyperlinkInfo @@ -17,13 +17,13 @@ import com.intellij.terminal.JBTerminalWidget import com.jediterm.terminal.* import com.jediterm.terminal.emulator.JediEmulator import com.jediterm.terminal.model.JediTerminal -import org.apache.commons.io.input.buffer.CircularByteBuffer import java.io.InputStream import java.io.InputStreamReader import java.io.Reader import java.nio.charset.Charset import javax.swing.JComponent import kotlin.math.min +import org.apache.commons.io.input.buffer.CircularByteBuffer private const val BUFFER_SIZE = 100000 diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/console/LandoTtyConnector.kt b/src/main/kotlin/dev/_4lando/intellij/ui/console/LandoTtyConnector.kt similarity index 92% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/console/LandoTtyConnector.kt rename to src/main/kotlin/dev/_4lando/intellij/ui/console/LandoTtyConnector.kt index 409213b..b530997 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/console/LandoTtyConnector.kt +++ b/src/main/kotlin/dev/_4lando/intellij/ui/console/LandoTtyConnector.kt @@ -1,11 +1,12 @@ -package com.github.aaronfeledy.landointellijplugin.ui.console +package dev._4lando.intellij.ui.console import com.jediterm.terminal.TtyConnector import java.nio.charset.Charset import java.nio.charset.StandardCharsets class LandoTtyConnector(private val process: Process, - private val consoleView: JeditermConsoleView) : TtyConnector { + private val consoleView: JeditermConsoleView +) : TtyConnector { var charset: Charset = StandardCharsets.UTF_8 var localEcho: Boolean = false diff --git a/src/main/kotlin/dev/_4lando/intellij/ui/widget/LandoStatusWidget.kt b/src/main/kotlin/dev/_4lando/intellij/ui/widget/LandoStatusWidget.kt new file mode 100644 index 0000000..4ff7c8b --- /dev/null +++ b/src/main/kotlin/dev/_4lando/intellij/ui/widget/LandoStatusWidget.kt @@ -0,0 +1,72 @@ +package dev._4lando.intellij.ui.widget + +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.Messages +import com.intellij.openapi.wm.StatusBar +import com.intellij.openapi.wm.StatusBarWidget +import com.intellij.util.Consumer +import dev._4lando.intellij.LandoBundle +import dev._4lando.intellij.services.LandoProjectService +import dev._4lando.intellij.services.LandoStatusService +import icons.LandoIcons +import java.awt.event.MouseEvent +import javax.swing.Icon + + +/** + * This class represents a widget for the status of Lando in the IntelliJ status bar. + * It implements [StatusBarWidget] from the IntelliJ Platform SDK which provides a mechanism + * to create a widget that can be added to the IntelliJ status bar. + * + * @property project The current IntelliJ project. This is used to access project-specific services and components. + */ +open class LandoStatusWidget(private val project: Project) : StatusBarWidget, StatusBarWidget.IconPresentation { + + companion object { + const val ID: String = "LandoStatusWidget" + } + + override fun ID(): String = ID + + override fun getPresentation(): StatusBarWidget.WidgetPresentation = this + + override fun install(statusBar: StatusBar) {} + + override fun dispose() {} + + override fun getTooltipText(): String { + return if (LandoProjectService.getInstance(project).started) { + LandoBundle.message("widget.lando.status.tooltip.started") + } else { + LandoBundle.message("widget.lando.status.tooltip.stopped") + } + } + + override fun getClickConsumer(): Consumer { + return Consumer { + val statusService = LandoStatusService.getInstance() + if (statusService.fetchLandoAppStatus()) { + // Display the status in a dialog or panel + val statusMessage = statusService.appsCache.entries.joinToString("\n") { "${it.key}: ${it.value}" } + Messages.showMessageDialog(project, statusMessage, "Lando App Status", Messages.getInformationIcon()) + } else { + Messages.showMessageDialog(project, "Failed to fetch Lando app status.", "Error", Messages.getErrorIcon()) + } + } + } + + override fun getIcon(): Icon { + return if (checkLandoFileAndStatus()) LandoIcons.Status.Started else LandoIcons.Status.Stopped + } + + private fun checkLandoFileAndStatus(): Boolean { + LandoProjectService.getInstance(project).let { landoService -> + if (landoService.projectUsesLando()){ + if (landoService.started) { + return true + } + } + } + return false + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/widget/LandoStatusWidgetFactory.kt b/src/main/kotlin/dev/_4lando/intellij/ui/widget/LandoStatusWidgetFactory.kt similarity index 85% rename from src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/widget/LandoStatusWidgetFactory.kt rename to src/main/kotlin/dev/_4lando/intellij/ui/widget/LandoStatusWidgetFactory.kt index 9e07bf6..7a2e42c 100644 --- a/src/main/kotlin/com/github/aaronfeledy/landointellijplugin/ui/widget/LandoStatusWidgetFactory.kt +++ b/src/main/kotlin/dev/_4lando/intellij/ui/widget/LandoStatusWidgetFactory.kt @@ -1,7 +1,5 @@ -package com.github.aaronfeledy.landointellijplugin.ui.widget +package dev._4lando.intellij.ui.widget -import com.github.aaronfeledy.landointellijplugin.listeners.LandoAppServiceListener -import com.github.aaronfeledy.landointellijplugin.services.LandoAppService import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManager @@ -9,6 +7,8 @@ import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget import com.intellij.openapi.wm.StatusBarWidgetFactory import com.intellij.openapi.wm.WindowManager +import dev._4lando.intellij.listeners.LandoAppServiceListener +import dev._4lando.intellij.services.LandoAppService const val ID: String = LandoStatusWidget.ID diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 56be1c1..95b8358 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,6 +1,6 @@ - - com.github.aaronfeledy.landointellijplugin + + dev._4lando.intellij Lando Aaron Feledy @@ -12,34 +12,34 @@ + implementationClass="dev._4lando.intellij.config.LandofileFileType"/> + implementation="dev._4lando.intellij.ui.widget.LandoStatusWidgetFactory"/> - + - - - diff --git a/src/test/kotlin/com/github/aaronfeledy/landointellijplugin/MyPluginTest.kt b/src/test/kotlin/dev/_4lando/intellij/MyPluginTest.kt similarity index 75% rename from src/test/kotlin/com/github/aaronfeledy/landointellijplugin/MyPluginTest.kt rename to src/test/kotlin/dev/_4lando/intellij/MyPluginTest.kt index 1f6a562..a0d7153 100644 --- a/src/test/kotlin/com/github/aaronfeledy/landointellijplugin/MyPluginTest.kt +++ b/src/test/kotlin/dev/_4lando/intellij/MyPluginTest.kt @@ -1,9 +1,9 @@ -package com.github.aaronfeledy.landointellijplugin +package dev._4lando.intellij -import com.github.aaronfeledy.landointellijplugin.services.LandoProjectService import com.intellij.openapi.components.service import com.intellij.testFramework.TestDataPath import com.intellij.testFramework.fixtures.BasePlatformTestCase +import dev._4lando.intellij.services.LandoProjectService @TestDataPath("\$CONTENT_ROOT/src/test/testData") class MyPluginTest : BasePlatformTestCase() {