mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
review follow-up: deprecate CompilerManager.addCompilableFileType();, introduce CompilableFileTypesProvider EP (IDEA-CR-62197)
GitOrigin-RevId: 529066d6c5ca6e796b71e23c71fe404f9c9e2de7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
06066891d2
commit
495a6855a4
@@ -9,7 +9,6 @@ import com.intellij.compiler.impl.javaCompiler.javac.JavacCompiler;
|
||||
import com.intellij.compiler.server.BuildManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.compiler.JavaCompilerBundle;
|
||||
import com.intellij.openapi.compiler.options.ExcludeEntryDescription;
|
||||
import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
|
||||
@@ -19,7 +18,6 @@ import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.ModuleListener;
|
||||
@@ -86,7 +84,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
private final ExcludedEntriesConfiguration myExcludesConfiguration;
|
||||
|
||||
private volatile Collection<BackendCompiler> myRegisteredCompilers = Collections.emptyList();
|
||||
private JavacCompiler JAVAC_EXTERNAL_BACKEND;
|
||||
private final JavacCompiler JAVAC_EXTERNAL_BACKEND;
|
||||
private final Perl5Matcher myPatternMatcher = new Perl5Matcher();
|
||||
|
||||
{
|
||||
@@ -107,6 +105,7 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
public CompilerConfigurationImpl(@NotNull Project project) {
|
||||
myProject = project;
|
||||
myExcludesConfiguration = createExcludedEntriesConfiguration(project);
|
||||
JAVAC_EXTERNAL_BACKEND = new JavacCompiler(myProject);
|
||||
MessageBusConnection connection = project.getMessageBus().connect();
|
||||
connection.subscribe(ProjectTopics.MODULES, new ModuleListener() {
|
||||
@Override
|
||||
@@ -128,8 +127,10 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
});
|
||||
|
||||
if (!project.isDefault()) {
|
||||
StartupManager.getInstance(project).runAfterOpened(() -> createCompilers());
|
||||
// initial state
|
||||
StartupManager.getInstance(project).runAfterOpened(() -> {myRegisteredCompilers = collectCompilers();});
|
||||
}
|
||||
BackendCompiler.EP_NAME.getPoint(project).addChangeListener(() -> {myRegisteredCompilers = collectCompilers();}, project);
|
||||
}
|
||||
|
||||
// Overridden in Upsource
|
||||
@@ -423,50 +424,17 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
}
|
||||
|
||||
public JavacCompiler getJavacCompiler() {
|
||||
createCompilers();
|
||||
return JAVAC_EXTERNAL_BACKEND;
|
||||
}
|
||||
|
||||
private void createCompilers() {
|
||||
if (JAVAC_EXTERNAL_BACKEND != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
JAVAC_EXTERNAL_BACKEND = new JavacCompiler(myProject);
|
||||
myRegisteredCompilers = collectCompilers(Collections.emptySet());
|
||||
|
||||
BackendCompiler.EP_NAME.getPoint(myProject).addChangeListener(() -> {
|
||||
Collection<BackendCompiler> currentCompilers = myRegisteredCompilers;
|
||||
myRegisteredCompilers = collectCompilers(
|
||||
currentCompilers.stream().flatMap(c -> c.getCompilableFileTypes().stream()).collect(Collectors.toSet())
|
||||
);
|
||||
}, myProject);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<BackendCompiler> collectCompilers(Set<FileType> typesBefore) {
|
||||
private List<BackendCompiler> collectCompilers() {
|
||||
final List<BackendCompiler> compilers = new ArrayList<>();
|
||||
compilers.add(JAVAC_EXTERNAL_BACKEND);
|
||||
if (EclipseCompiler.isInitialized() || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
compilers.add(new EclipseCompiler(myProject));
|
||||
}
|
||||
compilers.addAll(Arrays.asList(BackendCompiler.EP_NAME.getExtensions(myProject)));
|
||||
|
||||
final Set<FileType> typesToAdd = new HashSet<>();
|
||||
final Set<FileType> typesToRemove = new HashSet<>(typesBefore);
|
||||
for (BackendCompiler compiler : compilers) {
|
||||
Set<FileType> compilerTypes = compiler.getCompilableFileTypes();
|
||||
typesToAdd.addAll(compilerTypes);
|
||||
typesToRemove.removeAll(compilerTypes);
|
||||
}
|
||||
typesToAdd.removeAll(typesBefore);
|
||||
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
|
||||
for (FileType type : typesToRemove) {
|
||||
compilerManager.removeCompilableFileType(type);
|
||||
}
|
||||
for (FileType type : typesToAdd) {
|
||||
compilerManager.addCompilableFileType(type);
|
||||
}
|
||||
compilers.addAll(BackendCompiler.EP_NAME.getExtensions(myProject));
|
||||
|
||||
myDefaultJavaCompiler = JAVAC_EXTERNAL_BACKEND;
|
||||
for (BackendCompiler compiler : compilers) {
|
||||
@@ -480,8 +448,11 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
}
|
||||
|
||||
public Collection<BackendCompiler> getRegisteredJavaCompilers() {
|
||||
createCompilers();
|
||||
return Collections.unmodifiableCollection(myRegisteredCompilers);
|
||||
Collection<BackendCompiler> compilers = myRegisteredCompilers;
|
||||
if (compilers.isEmpty()) {
|
||||
compilers = collectCompilers();
|
||||
}
|
||||
return Collections.unmodifiableCollection(compilers);
|
||||
}
|
||||
|
||||
public String[] getResourceFilePatterns() {
|
||||
@@ -933,7 +904,9 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
}
|
||||
|
||||
public BackendCompiler getDefaultCompiler() {
|
||||
createCompilers();
|
||||
if (myRegisteredCompilers.isEmpty()) {
|
||||
collectCompilers(); // this will properly initialize myDefaultJavaCompiler
|
||||
}
|
||||
return myDefaultJavaCompiler;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.compiler;
|
||||
|
||||
import com.intellij.compiler.impl.*;
|
||||
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
|
||||
import com.intellij.compiler.server.BuildManager;
|
||||
import com.intellij.execution.process.ProcessIOExecutorService;
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
@@ -16,7 +17,6 @@ import com.intellij.openapi.extensions.ExtensionPointListener;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.extensions.ProjectExtensionPointName;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -58,6 +58,7 @@ import java.util.stream.Collectors;
|
||||
public class CompilerManagerImpl extends CompilerManager {
|
||||
private static final ProjectExtensionPointName<CompilerFactory> COMPILER_FACTORY_EP = new ProjectExtensionPointName<>("com.intellij.compilerFactory");
|
||||
private static final ProjectExtensionPointName<CompileTaskBean> COMPILER_TASK_EP = new ProjectExtensionPointName<>("com.intellij.compiler.task");
|
||||
private static final ProjectExtensionPointName<CompilableFileTypesProvider> COMPILABLE_TYPE_EP = new ProjectExtensionPointName<>("com.intellij.compilableFileTypesProvider");
|
||||
|
||||
private static final Logger LOG = Logger.getInstance(CompilerManagerImpl.class);
|
||||
|
||||
@@ -69,6 +70,7 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
private final List<CompileTask> myBeforeTasks = new ArrayList<>();
|
||||
private final List<CompileTask> myAfterTasks = new ArrayList<>();
|
||||
private final Set<FileType> myCompilableTypes = new HashSet<>();
|
||||
private volatile Set<FileType> myCachedCompilableTypes = new HashSet<>();
|
||||
private final CompilationStatusListener myEventPublisher;
|
||||
private final Semaphore myCompilationSemaphore = new Semaphore(1, true);
|
||||
private final Set<ModuleType<?>> myValidationDisabledModuleTypes = new HashSet<>();
|
||||
@@ -86,7 +88,10 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
myProject = project;
|
||||
myEventPublisher = project.getMessageBus().syncPublisher(CompilerTopics.COMPILATION_STATUS);
|
||||
// predefined compilers
|
||||
COMPILER_FACTORY_EP.getPoint(myProject).addExtensionPointListener(new ExtensionPointListener<CompilerFactory>() {
|
||||
for (ProjectExtensionPointName<?> ep : Arrays.asList(COMPILABLE_TYPE_EP, BackendCompiler.EP_NAME)) {
|
||||
ep.addChangeListener(project, () -> {myCachedCompilableTypes = null;}, project);
|
||||
}
|
||||
COMPILER_FACTORY_EP.getPoint(project).addExtensionPointListener(new ExtensionPointListener<CompilerFactory>() {
|
||||
@Override
|
||||
public void extensionAdded(@NotNull CompilerFactory factory, @NotNull PluginDescriptor pluginDescriptor) {
|
||||
Compiler[] compilers = factory.createCompilers(CompilerManagerImpl.this);
|
||||
@@ -111,9 +116,7 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
removeCompiler(compiler);
|
||||
}
|
||||
}
|
||||
}, true, myProject);
|
||||
|
||||
addCompilableFileType(StdFileTypes.JAVA);
|
||||
}, true, project);
|
||||
|
||||
final File projectGeneratedSrcRoot = CompilerPaths.getGeneratedDataDirectory(project);
|
||||
projectGeneratedSrcRoot.mkdirs();
|
||||
@@ -221,7 +224,21 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
|
||||
@Override
|
||||
public boolean isCompilableFileType(@NotNull FileType type) {
|
||||
return myCompilableTypes.contains(type);
|
||||
if (myCompilableTypes.contains(type)) {
|
||||
return true;
|
||||
}
|
||||
Set<FileType> types = myCachedCompilableTypes;
|
||||
if (types == null) {
|
||||
types = new HashSet<>();
|
||||
for (CompilableFileTypesProvider extension : COMPILABLE_TYPE_EP.getExtensions(myProject)) {
|
||||
types.addAll(extension.getCompilableFileTypes());
|
||||
}
|
||||
for (BackendCompiler compiler : BackendCompiler.EP_NAME.getExtensions(myProject)) {
|
||||
types.addAll(compiler.getCompilableFileTypes());
|
||||
}
|
||||
myCachedCompilableTypes = types;
|
||||
}
|
||||
return types.contains(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.compiler.impl.javaCompiler;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.ProjectExtensionPointName;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.jps.model.java.compiler.CompilerOptions;
|
||||
import java.util.Set;
|
||||
|
||||
public interface BackendCompiler {
|
||||
ExtensionPointName<BackendCompiler> EP_NAME = ExtensionPointName.create("com.intellij.java.compiler");
|
||||
ProjectExtensionPointName<BackendCompiler> EP_NAME = new ProjectExtensionPointName<>("com.intellij.java.compiler");
|
||||
|
||||
CompilerOptions EMPTY_OPTIONS = new CompilerOptions() { };
|
||||
|
||||
|
||||
+2
-2
@@ -16,9 +16,9 @@
|
||||
package com.intellij.compiler.impl.javaCompiler.eclipse;
|
||||
|
||||
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.compiler.JavaCompilerBundle;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -61,7 +61,7 @@ public class EclipseCompiler implements BackendCompiler {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<FileType> getCompilableFileTypes() {
|
||||
return Collections.singleton(StdFileTypes.JAVA);
|
||||
return Collections.singleton(JavaFileType.INSTANCE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
-2
@@ -16,9 +16,9 @@
|
||||
package com.intellij.compiler.impl.javaCompiler.javac;
|
||||
|
||||
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.compiler.JavaCompilerBundle;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -58,7 +58,7 @@ public class JavacCompiler implements BackendCompiler {
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<FileType> getCompilableFileTypes() {
|
||||
return Collections.singleton(StdFileTypes.JAVA);
|
||||
return Collections.singleton(JavaFileType.INSTANCE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.compiler;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface CompilableFileTypesProvider {
|
||||
@NotNull
|
||||
Set<FileType> getCompilableFileTypes();
|
||||
}
|
||||
@@ -84,24 +84,29 @@ public abstract class CompilerManager {
|
||||
* Registers the type as a compilable type so that Compile action will be enabled on files of this type.
|
||||
*
|
||||
* @param type the type for which the Compile action is enabled.
|
||||
* @deprecated use {@link CompilableFileTypesProvider} extension point to register compilable file types
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void addCompilableFileType(@NotNull FileType type);
|
||||
|
||||
/**
|
||||
* Unregisters the type as a compilable type so that Compile action will be disabled on files of this type.
|
||||
*
|
||||
* @param type the type for which the Compile action is disabled.
|
||||
* @deprecated use {@link CompilableFileTypesProvider} extension point to register compilable file types
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void removeCompilableFileType(@NotNull FileType type);
|
||||
|
||||
/**
|
||||
* Checks if files of the specified type can be compiled by one of registered compilers.
|
||||
* If the compiler can process files of certain type, it should register this file type within
|
||||
* the CompilerManager as a compilable file type.
|
||||
* Preferably register compilable file types with the CompilableFileTypesProvider extension point
|
||||
*
|
||||
* @param type the type to check.
|
||||
* @return true if the file type is compilable, false otherwise.
|
||||
* @see com.intellij.openapi.compiler.CompilerManager#addCompilableFileType(FileType)
|
||||
* @see com.intellij.openapi.compiler.CompilableFileTypesProvider#getCompilableFileTypes()
|
||||
*/
|
||||
public abstract boolean isCompilableFileType(@NotNull FileType type);
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@
|
||||
|
||||
<extensionPoint qualifiedName="com.intellij.compiler" area="IDEA_PROJECT" interface="com.intellij.openapi.compiler.Compiler" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="com.intellij.compilerFactory" area="IDEA_PROJECT" interface="com.intellij.openapi.compiler.CompilerFactory" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="com.intellij.compilableFileTypesProvider" area="IDEA_PROJECT" interface="com.intellij.openapi.compiler.CompilableFileTypesProvider" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="com.intellij.compiler.task" area="IDEA_PROJECT" beanClass="com.intellij.compiler.CompileTaskBean" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="com.intellij.compilerSettingsFactory" area="IDEA_PROJECT" interface="com.intellij.compiler.CompilerSettingsFactory"/>
|
||||
<extensionPoint qualifiedName="com.intellij.compileServer.plugin" beanClass="com.intellij.compiler.server.CompileServerPlugin" dynamic="true"/>
|
||||
|
||||
@@ -1218,7 +1218,7 @@
|
||||
<outOfSourcesChecker implementation="org.jetbrains.plugins.groovy.projectRoots.GroovyOutOfSourcesChecker"/>
|
||||
|
||||
<externalSystemConfigurationHandler implementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilerGradleConfigurationHandler"/>
|
||||
<postStartupActivity implementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilerLoader"/>
|
||||
<compilableFileTypesProvider implementation="org.jetbrains.plugins.groovy.compiler.GroovyCompilableFileTypesProvider"/>
|
||||
|
||||
<pathMacroContributor implementation="org.jetbrains.plugins.groovy.mvc.MvcPathMacros"/>
|
||||
<notificationWhitelist groupIds="Groovy DSL errors;Grape;Mvc notifications;"/>
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
package org.jetbrains.plugins.groovy.compiler;
|
||||
|
||||
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -59,7 +59,7 @@ public class GreclipseIdeaCompiler implements BackendCompiler {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<FileType> getCompilableFileTypes() {
|
||||
return ContainerUtil.newTroveSet(StdFileTypes.JAVA, GroovyFileType.GROOVY_FILE_TYPE);
|
||||
return ContainerUtil.newTroveSet(JavaFileType.INSTANCE, GroovyFileType.GROOVY_FILE_TYPE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.compiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompilableFileTypesProvider;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class GroovyCompilableFileTypesProvider implements CompilableFileTypesProvider {
|
||||
@Override
|
||||
public @NotNull Set<FileType> getCompilableFileTypes() {
|
||||
return Collections.singleton(GroovyFileType.GROOVY_FILE_TYPE);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.compiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.GroovyFileType;
|
||||
|
||||
public class GroovyCompilerLoader implements StartupActivity.DumbAware {
|
||||
|
||||
@Override
|
||||
public void runActivity(@NotNull Project project) {
|
||||
CompilerManager.getInstance(project).addCompilableFileType(GroovyFileType.GROOVY_FILE_TYPE);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
<compiler implementation="com.intellij.uiDesigner.make.Form2SourceCompiler"/>
|
||||
<compileServer.plugin classpath="jps/ui-designer-jps-plugin.jar"/>
|
||||
<postStartupActivity implementation="com.intellij.uiDesigner.make.FormTypeRegistrar" />
|
||||
<compilableFileTypesProvider implementation="com.intellij.uiDesigner.make.FormTypeRegistrar" />
|
||||
|
||||
<psi.referenceContributor language="TEXT" implementation="com.intellij.uiDesigner.binding.FormReferenceContributor"/>
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.uiDesigner.make;
|
||||
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupActivity;
|
||||
import com.intellij.openapi.compiler.CompilableFileTypesProvider;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.uiDesigner.GuiFormFileType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FormTypeRegistrar implements StartupActivity.DumbAware {
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
public class FormTypeRegistrar implements CompilableFileTypesProvider {
|
||||
@Override
|
||||
public void runActivity(@NotNull Project project) {
|
||||
CompilerManager.getInstance(project).addCompilableFileType(StdFileTypes.GUI_DESIGNER_FORM);
|
||||
public @NotNull Set<FileType> getCompilableFileTypes() {
|
||||
return Collections.singleton(GuiFormFileType.INSTANCE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user