-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: statusbar icon, release note link (#32)
* Moved context menu to status bar, same as in VS Code
- Loading branch information
1 parent
3b5a778
commit 4671d9a
Showing
6 changed files
with
85 additions
and
7 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/main/kotlin/com/vaadin/plugin/copilot/CopilotStatusBarPanel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.vaadin.plugin.copilot | ||
|
||
import com.intellij.openapi.actionSystem.ActionGroup | ||
import com.intellij.openapi.actionSystem.ActionManager | ||
import com.intellij.openapi.actionSystem.DataContext | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.ui.popup.JBPopupFactory | ||
import com.intellij.openapi.ui.popup.ListPopup | ||
import com.intellij.openapi.vfs.VirtualFile | ||
import com.intellij.openapi.wm.StatusBarWidget | ||
import com.intellij.openapi.wm.impl.status.EditorBasedStatusBarPopup | ||
import com.intellij.ui.IconManager | ||
|
||
class CopilotStatusBarPanel(project: Project) : EditorBasedStatusBarPopup(project, false) { | ||
|
||
override fun ID(): String { | ||
return "CopilotStatusBarPanel" | ||
} | ||
|
||
override fun createInstance(project: Project): StatusBarWidget { | ||
return CopilotStatusBarPanel(project) | ||
} | ||
|
||
override fun createPopup(context: DataContext): ListPopup? { | ||
val group = | ||
ActionManager.getInstance().getAction("CopilotStatusBarActions") as? ActionGroup ?: return null | ||
|
||
return JBPopupFactory.getInstance() | ||
.createActionGroupPopup( | ||
null, group, context, | ||
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false | ||
) | ||
} | ||
|
||
override fun getWidgetState(file: VirtualFile?): WidgetState { | ||
if (!CopilotPluginUtil.isVaadinProject(project)) { | ||
return WidgetState.HIDDEN | ||
} | ||
|
||
val state = WidgetState("Vaadin", null, true) | ||
state.icon = IconManager.getInstance().getIcon("/icons/vaadin.svg", javaClass) | ||
return state | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/com/vaadin/plugin/copilot/CopilotStatusBarWidgetFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.vaadin.plugin.copilot | ||
|
||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.wm.StatusBarWidget | ||
import com.intellij.openapi.wm.StatusBarWidgetFactory | ||
|
||
class CopilotStatusBarWidgetFactory : StatusBarWidgetFactory { | ||
|
||
override fun getId(): String { | ||
return "CopilotStatusBarWidgetFactory" | ||
} | ||
|
||
override fun getDisplayName(): String { | ||
return "Vaadin" | ||
} | ||
|
||
override fun createWidget(project: Project): StatusBarWidget { | ||
return CopilotStatusBarPanel(project) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.