IDEA-138936 File templates are not imported via File/Import Settings

This commit is contained in:
Vladimir Krivosheev
2015-07-02 17:51:18 +02:00
parent ff4e0ec48d
commit 527708b0e7
4 changed files with 10 additions and 30 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,15 +15,12 @@
*/
package com.intellij.ide.fileTemplates.impl;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.*;
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.List;
import java.util.Locale;
@@ -33,13 +30,11 @@ import java.util.Locale;
* @author Rustam Vishnyakov
*/
@State(
name="ExportableFileTemplateSettings",
storages= {
@Storage(
file = StoragePathMacros.APP_CONFIG + "/" + ExportableFileTemplateSettings.EXPORTABLE_SETTINGS_FILE
)}
name = "ExportableFileTemplateSettings",
storages = @Storage(file = StoragePathMacros.APP_CONFIG + "/" + ExportableFileTemplateSettings.EXPORTABLE_SETTINGS_FILE),
additionalExportFile = StoragePathMacros.ROOT_CONFIG + "/" + FileTemplatesLoader.TEMPLATES_DIR
)
public class ExportableFileTemplateSettings extends FileTemplatesLoader implements PersistentStateComponent<Element>, ExportableComponent {
public class ExportableFileTemplateSettings extends FileTemplatesLoader implements PersistentStateComponent<Element> {
public final static String EXPORTABLE_SETTINGS_FILE = "file.template.settings.xml";
static final String ELEMENT_TEMPLATE = "template";
@@ -57,20 +52,6 @@ public class ExportableFileTemplateSettings extends FileTemplatesLoader implemen
return ServiceManager.getService(ExportableFileTemplateSettings.class);
}
@NotNull
@Override
public File[] getExportFiles() {
File exportableSettingsFile =
new File(PathManager.getOptionsPath() + File.separator + EXPORTABLE_SETTINGS_FILE);
return new File[] {getDefaultTemplatesManager().getConfigRoot(false), exportableSettingsFile};
}
@NotNull
@Override
public String getPresentableName() {
return IdeBundle.message("item.file.templates");
}
@Nullable
@Override
public Element getState() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ import java.util.*;
public class FileTemplatesLoader {
private static final Logger LOG = Logger.getInstance("#" + FileTemplatesLoader.class.getName());
private static final String TEMPLATES_DIR = "fileTemplates";
static final String TEMPLATES_DIR = "fileTemplates";
private static final String DEFAULT_TEMPLATES_ROOT = TEMPLATES_DIR;
public static final String DESCRIPTION_FILE_EXTENSION = "html";
private static final String DESCRIPTION_EXTENSION_SUFFIX = "." + DESCRIPTION_FILE_EXTENSION;
@@ -334,4 +334,5 @@ exportable.LafManager.presentable.name=Look and Feel
exportable.EditorColorsManagerImpl.presentable.name=Editor Colors
exportable.DiffManager.presentable.name=Diff
exportable.DiffSettings.presentable.name=Diff
exportable.ExternalDiffSettings.presentable.name=External Diff
exportable.ExternalDiffSettings.presentable.name=External Diff
exportable.ExportableFileTemplateSettings.presentable.name=File templates
@@ -27,9 +27,7 @@
<projectService serviceInterface="com.intellij.ide.fileTemplates.FileTemplateManager"
serviceImplementation="com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl"/>
<applicationService serviceInterface="com.intellij.ide.fileTemplates.impl.ExportableFileTemplateSettings"
serviceImplementation="com.intellij.ide.fileTemplates.impl.ExportableFileTemplateSettings"/>
<exportable serviceInterface="com.intellij.ide.fileTemplates.impl.ExportableFileTemplateSettings"/>
<applicationService serviceImplementation="com.intellij.ide.fileTemplates.impl.ExportableFileTemplateSettings"/>
<applicationService serviceInterface="com.intellij.ide.PsiCopyPasteManager"
serviceImplementation="com.intellij.ide.PsiCopyPasteManager"/>