mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-6337 TypeScript file template is missing
internal templates should not be disabled (cherry picked from commit 8ea8fa4)
This commit is contained in:
committed by
Konstantin Ulitin
parent
04bd75efdd
commit
5528709981
@@ -24,10 +24,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
public final class BundledFileTemplate extends FileTemplateBase {
|
||||
|
||||
private final DefaultTemplate myDefaultTemplate;
|
||||
private final boolean myInternal;
|
||||
private boolean myEnabled = true; // when user 'deletes' bundled plugin, it simply becomes disabled
|
||||
|
||||
public BundledFileTemplate(@NotNull DefaultTemplate defaultTemplate) {
|
||||
public BundledFileTemplate(@NotNull DefaultTemplate defaultTemplate, boolean internal) {
|
||||
myDefaultTemplate = defaultTemplate;
|
||||
myInternal = internal;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -72,7 +74,7 @@ public final class BundledFileTemplate extends FileTemplateBase {
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return myEnabled;
|
||||
return myInternal || myEnabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
|
||||
@@ -45,13 +45,19 @@ class FTManager {
|
||||
public static final String CONTENT_ENCODING = CharsetToolkit.UTF8;
|
||||
|
||||
private final String myName;
|
||||
private final boolean myInternal;
|
||||
private final String myTemplatesDir;
|
||||
private final Map<String, FileTemplateBase> myTemplates = new HashMap<String, FileTemplateBase>();
|
||||
private volatile List<FileTemplateBase> mySortedTemplates;
|
||||
private final List<DefaultTemplate> myDefaultTemplates = new ArrayList<DefaultTemplate>();
|
||||
|
||||
FTManager(@NotNull @NonNls String name, @NotNull @NonNls String defaultTemplatesDirName) {
|
||||
this(name, defaultTemplatesDirName, false);
|
||||
}
|
||||
|
||||
FTManager(@NotNull @NonNls String name, @NotNull @NonNls String defaultTemplatesDirName, boolean internal) {
|
||||
myName = name;
|
||||
myInternal = internal;
|
||||
myTemplatesDir = TEMPLATES_DIR + (defaultTemplatesDirName.equals(".") ? "" : File.separator + defaultTemplatesDirName);
|
||||
}
|
||||
|
||||
@@ -176,7 +182,7 @@ class FTManager {
|
||||
}
|
||||
|
||||
private BundledFileTemplate createAndStoreBundledTemplate(DefaultTemplate template) {
|
||||
final BundledFileTemplate bundled = new BundledFileTemplate(template);
|
||||
final BundledFileTemplate bundled = new BundledFileTemplate(template, myInternal);
|
||||
final String qName = bundled.getQualifiedName();
|
||||
final FileTemplateBase previous = myTemplates.put(qName, bundled);
|
||||
mySortedTemplates = null;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class FileTemplatesLoader {
|
||||
public FileTemplatesLoader(@NotNull FileTypeManagerEx typeManager) {
|
||||
myTypeManager = typeManager;
|
||||
myDefaultTemplatesManager = new FTManager(FileTemplateManager.DEFAULT_TEMPLATES_CATEGORY, ROOT_DIR);
|
||||
myInternalTemplatesManager = new FTManager(FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY, INTERNAL_DIR);
|
||||
myInternalTemplatesManager = new FTManager(FileTemplateManager.INTERNAL_TEMPLATES_CATEGORY, INTERNAL_DIR, true);
|
||||
myPatternsManager = new FTManager(FileTemplateManager.INCLUDES_TEMPLATES_CATEGORY, INCLUDES_DIR);
|
||||
myCodeTemplatesManager = new FTManager(FileTemplateManager.CODE_TEMPLATES_CATEGORY, CODETEMPLATES_DIR);
|
||||
myJ2eeTemplatesManager = new FTManager(FileTemplateManager.J2EE_TEMPLATES_CATEGORY, J2EE_TEMPLATES_DIR);
|
||||
|
||||
Reference in New Issue
Block a user