mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
introduce ExternalCompiler.isCompilableFile() method
This commit is contained in:
@@ -19,6 +19,7 @@ import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.EnvironmentUtil;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -41,6 +42,18 @@ public abstract class ExternalCompiler implements BackendCompiler {
|
||||
return COMPILABLE_TYPES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the compiler can compile the specified file.
|
||||
*
|
||||
* @param file the file to check.
|
||||
* @param context the context for the current compile operation.
|
||||
* @return true if can compile the file, false otherwise. If the method returns false, <code>file</code>
|
||||
* will not be included in the list of files passed to {@link #compile(CompileContext, com.intellij.util.Chunk < com.intellij.openapi.module.Module >,com.intellij.openapi.vfs.VirtualFile[], com.intellij.openapi.compiler.TranslatingCompiler.OutputSink)}.
|
||||
*/
|
||||
public boolean isCompilableFile(VirtualFile file, CompileContext context) {
|
||||
return getCompilableFileTypes().contains(file.getFileType());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Process launchProcess(@NotNull final ModuleChunk chunk, @NotNull final String outputDir, @NotNull final CompileContext compileContext) throws IOException {
|
||||
final String[] commands = createStartupCommand(chunk, compileContext, outputDir);
|
||||
|
||||
@@ -50,7 +50,11 @@ public class JavaCompiler implements TranslatingCompiler {
|
||||
}
|
||||
|
||||
public boolean isCompilableFile(VirtualFile file, CompileContext context) {
|
||||
return getBackEndCompiler().getCompilableFileTypes().contains(file.getFileType());
|
||||
final BackendCompiler backEndCompiler = getBackEndCompiler();
|
||||
if (backEndCompiler instanceof ExternalCompiler) {
|
||||
return ((ExternalCompiler)backEndCompiler).isCompilableFile(file, context);
|
||||
}
|
||||
return backEndCompiler.getCompilableFileTypes().contains(file.getFileType());
|
||||
}
|
||||
|
||||
public void compile(CompileContext context, Chunk<Module> moduleChunk, VirtualFile[] files, OutputSink sink) {
|
||||
|
||||
Reference in New Issue
Block a user