mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[devkit] IJPL-221022 Make sure the "Project" file templates scheme is used in IntelliJ project
(cherry picked from commit 3640b623cc2e5a1643169337e3a90ecc06069ce2) GitOrigin-RevId: 1a218043f0419e919f307b2fda22a186c0698935
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2640276c19
commit
b3e45c3c3d
@@ -718,6 +718,8 @@
|
||||
<registryKey key="devkit.compose.hot.reload.enabled" defaultValue="false" description="Enable 'Compose Hot Reload' agent for run configurations"/>
|
||||
<registryKey key="devkit.compose.hot.reload.agent.version" defaultValue="" description="'Compose Hot Reload' agent version override"/>
|
||||
<runConfigurationExtension implementation="org.jetbrains.idea.devkit.composeHotReload.ComposeHotReloadCommandLinePatcher" />
|
||||
|
||||
<postStartupActivity implementation="org.jetbrains.idea.devkit.templates.UpdateFileTemplatesSchemeToProjectActivity"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="DevKit.lang">
|
||||
|
||||
@@ -831,4 +831,5 @@ plugins.python.description=Python language
|
||||
plugins.go.description=Go language
|
||||
plugins.php.description=PHP language
|
||||
plugins.ruby.description=Ruby language
|
||||
plugins.rust.description=Rust language
|
||||
plugins.rust.description=Rust language
|
||||
command.name.update.file.templates.scheme=Set File Templates Scheme to Project
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.devkit.templates
|
||||
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager
|
||||
import com.intellij.ide.util.runOnceForProject
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.command.writeCommandAction
|
||||
import com.intellij.openapi.extensions.ExtensionNotApplicableException
|
||||
import com.intellij.openapi.project.IntelliJProjectUtil
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.ProjectActivity
|
||||
import org.jetbrains.idea.devkit.DevKitBundle
|
||||
|
||||
internal class UpdateFileTemplatesSchemeToProjectActivity : ProjectActivity {
|
||||
init {
|
||||
val application = ApplicationManager.getApplication()
|
||||
if (application.isHeadlessEnvironment
|
||||
|| application.isUnitTestMode
|
||||
|| application.isCommandLine) {
|
||||
throw ExtensionNotApplicableException.create()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun execute(project: Project) {
|
||||
if (!IntelliJProjectUtil.isIntelliJPlatformProject(project)) return
|
||||
|
||||
runOnceForProject(project, "update.intellij.repository.file.templates.scheme") {
|
||||
writeCommandAction(project, DevKitBundle.message("command.name.update.file.templates.scheme")) {
|
||||
val manager = FileTemplateManager.getInstance(project)
|
||||
manager.setCurrentScheme(manager.getProjectScheme())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user