diff --git a/src/main/kotlin/com/vaadin/plugin/copilot/CopilotPluginUtil.kt b/src/main/kotlin/com/vaadin/plugin/copilot/CopilotPluginUtil.kt index 8f3f6ca..a8afc24 100644 --- a/src/main/kotlin/com/vaadin/plugin/copilot/CopilotPluginUtil.kt +++ b/src/main/kotlin/com/vaadin/plugin/copilot/CopilotPluginUtil.kt @@ -19,10 +19,7 @@ import com.intellij.openapi.vfs.VfsUtil import com.intellij.psi.PsiDirectory import com.intellij.psi.PsiFileFactory import com.intellij.psi.PsiManager -import com.vaadin.plugin.copilot.handler.RedoHandler -import com.vaadin.plugin.copilot.handler.ShowInIdeHandler -import com.vaadin.plugin.copilot.handler.UndoHandler -import com.vaadin.plugin.copilot.handler.WriteFileHandler +import com.vaadin.plugin.copilot.handler.* import com.vaadin.plugin.copilot.service.CopilotServerService import java.io.BufferedWriter import java.io.File @@ -54,6 +51,7 @@ class CopilotPluginUtil { WRITE("write"), UNDO("undo"), REDO("redo"), + REFRESH("refresh"), SHOW_IN_IDE("showInIde") } @@ -145,6 +143,7 @@ class CopilotPluginUtil { HANDLERS.UNDO.command -> return UndoHandler(project, data) HANDLERS.REDO.command -> return RedoHandler(project, data) HANDLERS.SHOW_IN_IDE.command -> return ShowInIdeHandler(project, data) + HANDLERS.REFRESH.command -> return RefreshHandler(project) else -> { LOG.warn("Command $command not supported by plugin") } diff --git a/src/main/kotlin/com/vaadin/plugin/copilot/handler/RefreshHandler.kt b/src/main/kotlin/com/vaadin/plugin/copilot/handler/RefreshHandler.kt new file mode 100644 index 0000000..e17f289 --- /dev/null +++ b/src/main/kotlin/com/vaadin/plugin/copilot/handler/RefreshHandler.kt @@ -0,0 +1,12 @@ +package com.vaadin.plugin.copilot.handler + +import com.intellij.openapi.project.Project +import com.intellij.openapi.vfs.VirtualFileManager + +class RefreshHandler(project: Project) : AbstractHandler(project) { + + override fun run() { + VirtualFileManager.getInstance().asyncRefresh { } + } + +}