mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
KTNB-628 Add "Create Gist" action to the toolbar of Kotlin Notebooks
GitOrigin-RevId: eedc263675c19eaf7f7dc8c98d14a9c9bf3395fb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3a8596a0e3
commit
d15d074bc9
@@ -111,6 +111,7 @@
|
||||
<add-to-group group-id="EditorTabPopupMenu"/>
|
||||
<add-to-group group-id="ConsoleEditorPopupMenu"/>
|
||||
</action>
|
||||
<action id="Github.Create.Gist.AlwaysEnabled" class="org.jetbrains.plugins.github.GithubCreateGistAlwaysEnabledAction"/>
|
||||
<group id="GitHub.MainMenu" popup="true">
|
||||
<reference ref="Github.Share"/>
|
||||
<reference ref="Github.Create.Pull.Request"/>
|
||||
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.github
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
|
||||
/**
|
||||
* A wrapper around [GithubCreateGistAction].
|
||||
* This action can be used in toolbars and context menus, and it won't be disabled or hidden when the user
|
||||
* does not have a GitHub account connected. If this behavior is desired, use this action. Otherwise, use
|
||||
* [GithubCreateGistAction].
|
||||
*
|
||||
* This action won't show up in search, otherwise it would be possible to have both this action and
|
||||
* [GithubCreateGistAction] in the search results.
|
||||
*/
|
||||
class GithubCreateGistAlwaysEnabledAction : GithubCreateGistAction() {
|
||||
override fun update(e: AnActionEvent) {
|
||||
// We're intentionally not calling super.update(e), as it would check for a connected GitHub account,
|
||||
// and we don't want that.
|
||||
|
||||
/** We're hiding this action from search so that we won't show it alongside [GithubCreateGistAction] */
|
||||
e.presentation.isEnabledAndVisible = !ActionPlaces.isMainMenuOrActionSearch(e.place)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user