mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
OPENIDE #186 Add ability hide welcome screen via settings
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.ProjectActivity
|
||||
import com.intellij.openapi.startup.StartupManager
|
||||
import com.intellij.openapi.util.registry.RegistryManager
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
@@ -59,6 +60,12 @@ class OpenIdeWelcomeScreenProjectActivity : ProjectActivity {
|
||||
private fun showWelcomeScreen(project: Project, isFirstOpen: Boolean) {
|
||||
if (!isFirstOpen) return
|
||||
OpenIdeProjectLocalState.getInstance(project).isFirstOpen = false
|
||||
|
||||
val isShowWelcomeScreen = RegistryManager.getInstance()
|
||||
.get(WelcomeScreenHelper.SHOW_WELCOME_SCREEN_KEY)
|
||||
.asBoolean()
|
||||
if (!isShowWelcomeScreen) return
|
||||
|
||||
WelcomeScreenHelper(project).showWelcomeScreen()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.options.ShowSettingsUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.project.guessProjectDir
|
||||
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.installAndEnable
|
||||
import com.intellij.openapi.util.registry.RegistryManager
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.ui.EditorNotifications
|
||||
import com.intellij.ui.jcef.JBCefApp
|
||||
@@ -59,6 +60,9 @@ class WelcomeScreenHelper(val project: Project) {
|
||||
}
|
||||
val htmlTemplate = HtmlEditorTemplate(TEMPLATE_NAME).apply {
|
||||
addParam(THEME, if (StartupUiUtil.isDarkTheme) "theme-dark" else "")
|
||||
|
||||
val isHideWelcomeScreen = !RegistryManager.getInstance().get(SHOW_WELCOME_SCREEN_KEY).asBoolean()
|
||||
addParam(CHECKBOX, if (isHideWelcomeScreen) "hide-welcome-screen" else "")
|
||||
}
|
||||
|
||||
return createEditorModel(htmlTemplate.createTextFromInternal(project))
|
||||
@@ -89,6 +93,20 @@ class WelcomeScreenHelper(val project: Project) {
|
||||
installPlugin(DOCKER_PLUGIN_ID, project)
|
||||
}
|
||||
}
|
||||
|
||||
addJsQuery(JsQuery.SHOW_WELCOME_SCREEN) {
|
||||
invokeLater {
|
||||
val registryValue = RegistryManager.getInstance().get(SHOW_WELCOME_SCREEN_KEY)
|
||||
registryValue.setValue(true)
|
||||
}
|
||||
}
|
||||
|
||||
addJsQuery(JsQuery.HIDE_WELCOME_SCREEN) {
|
||||
invokeLater {
|
||||
val registryValue = RegistryManager.getInstance().get(SHOW_WELCOME_SCREEN_KEY)
|
||||
registryValue.setValue(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun installPlugin(idString: String, project: Project) {
|
||||
@@ -104,14 +122,18 @@ class WelcomeScreenHelper(val project: Project) {
|
||||
OPEN_MARKETPLACE(SUGGESTION_QUERY_NAME, "OPEN_MARKETPLACE"),
|
||||
INSTALL_PYTHON_PLUGIN(SUGGESTION_QUERY_NAME, "INSTALL_PYTHON_PLUGIN"),
|
||||
INSTALL_DOCKER_PLUGIN(SUGGESTION_QUERY_NAME, "INSTALL_DOCKER_PLUGIN"),
|
||||
SHOW_WELCOME_SCREEN(SUGGESTION_QUERY_NAME, "SHOW_WELCOME_SCREEN"),
|
||||
HIDE_WELCOME_SCREEN(SUGGESTION_QUERY_NAME, "HIDE_WELCOME_SCREEN")
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TEMPLATE_NAME = "openIdeWelcomeScreen.html"
|
||||
private const val THEME = "THEME"
|
||||
private const val CHECKBOX = "CHECKBOX"
|
||||
private const val SUGGESTION_QUERY_NAME = "suggestionQuery"
|
||||
private const val PYTHON_PLUGIN_ID = "PythonCore"
|
||||
private const val DOCKER_PLUGIN_ID = "ru.openide.docker"
|
||||
private val LOG = logger<WelcomeScreenHelper>()
|
||||
const val SHOW_WELCOME_SCREEN_KEY = "openide.registry.key.show.welcome.screen"
|
||||
}
|
||||
}
|
||||
@@ -1868,7 +1868,8 @@
|
||||
|
||||
<registryKey key="client.generator.inlay.action" defaultValue="false"
|
||||
description="Enable open in client generator action"/>
|
||||
<registryKey defaultValue="https://plugins.openide.ru" description="OpenIDE plugins url" key="openide.registry.key.plugins.host.url"/>
|
||||
<registryKey key="openide.registry.key.show.welcome.screen" defaultValue="true"
|
||||
description="Enables the Welcome Screen to be shown when opening a project for the first time"/>
|
||||
</extensions>
|
||||
|
||||
<!--suppress PluginXmlDynamicPlugin -->
|
||||
|
||||
Reference in New Issue
Block a user