mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IDEA-336134 Rework implementation of ProjectTemplateExportable through ExportableComponent
GitOrigin-RevId: dda70a261e39833aec8e93fe71ddc75502d37593
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9763d26433
commit
92179ae0ad
@@ -40,7 +40,6 @@
|
||||
|
||||
<projectTemplatesFactory implementation="com.intellij.platform.templates.ArchivedTemplatesFactory"/>
|
||||
<applicationService serviceImplementation="com.intellij.platform.templates.ProjectTemplateExportable"/>
|
||||
<exportable serviceInterface="com.intellij.platform.templates.ProjectTemplateExportable"/>
|
||||
<projectTemplateFileProcessor implementation="com.intellij.platform.templates.SystemFileProcessor"/>
|
||||
|
||||
<!-- this depends on TemplateLanguageConfigurable which isn't registered in LangExtensions, so it should go here as well -->
|
||||
|
||||
@@ -2,21 +2,40 @@
|
||||
package com.intellij.platform.templates;
|
||||
|
||||
import com.intellij.lang.LangBundle;
|
||||
import com.intellij.openapi.components.ExportableComponent;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.SettingsCategory;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public final class ProjectTemplateExportable implements ExportableComponent {
|
||||
|
||||
@State(name = "ProjectTemplates",
|
||||
storages = @Storage(value = "ProjectTemplates.xml", exportable = true),//no non-default state, so won't ever be created
|
||||
additionalExportDirectory = "projectTemplates",
|
||||
presentableName = ProjectTemplateExportable.NameGetter.class,
|
||||
category = SettingsCategory.CODE)
|
||||
public final class ProjectTemplateExportable implements PersistentStateComponent<ProjectTemplateExportable.ProjectTemplateExportableState> {
|
||||
@Override
|
||||
public File @NotNull [] getExportFiles() {
|
||||
return new File[]{new File(ArchivedTemplatesFactory.getCustomTemplatesPath())};
|
||||
public @Nullable ProjectTemplateExportable.ProjectTemplateExportableState getState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getPresentableName() {
|
||||
return LangBundle.message("project.template.presentable.name");
|
||||
public void loadState(@NotNull ProjectTemplateExportableState state) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
public static class ProjectTemplateExportableState {
|
||||
}
|
||||
|
||||
public static class NameGetter extends State.NameGetter {
|
||||
|
||||
@Nls
|
||||
@Override
|
||||
public String get() {
|
||||
return LangBundle.message("project.template.presentable.name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user