当前位置: 首页>>代码示例>>Java>>正文


Java FileSetCompileScope类代码示例

本文整理汇总了Java中com.intellij.compiler.impl.FileSetCompileScope的典型用法代码示例。如果您正苦于以下问题:Java FileSetCompileScope类的具体用法?Java FileSetCompileScope怎么用?Java FileSetCompileScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FileSetCompileScope类属于com.intellij.compiler.impl包,在下文中一共展示了FileSetCompileScope类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final PsiClass psiClass = getPsiClass(e);
  if (psiClass == null) return;

  final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
  final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
  if (module == null || virtualFile == null) return;

  final String className = ClassUtil.getJVMClassName(psiClass);

  final Project project = getEventProject(e);
  CompilerManager.getInstance(project).make(new FileSetCompileScope(Collections.singletonList(virtualFile), new Module[]{module}), new CompileStatusNotification() {
    @Override
    public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
      if (aborted || errors > 0) return;
      generateAndShowXml(module, className);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ShowSerializedXmlAction.java

示例2: doAction

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
protected void doAction(DataContext dataContext, Project project) {
  final Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
  final CompilerFilter filter = new CompilerFilter() {
    public boolean acceptCompiler(com.intellij.openapi.compiler.Compiler compiler) {
      // EclipseLink CanonicalModelProcessor reads input from output hence adding ResourcesCompiler
      return compiler instanceof AnnotationProcessingCompiler || compiler instanceof ResourceCompiler;
    }
  };
  if (module != null) {
    CompilerManager.getInstance(project).make(new ModuleCompileScope(module, false), filter, null);
  }
  else {
    final FileSetCompileScope scope = getCompilableFiles(project, PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext));
    if (scope != null) {
      CompilerManager.getInstance(project).make(scope, filter, null);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ProcessAnnotationsAction.java

示例3: actionPerformed

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final PsiClass psiClass = getPsiClass(e);
  if (psiClass == null) return;

  final VirtualFile virtualFile = psiClass.getContainingFile().getVirtualFile();
  final Module module = ModuleUtilCore.findModuleForPsiElement(psiClass);
  if (module == null || virtualFile == null) return;

  final String className = ClassUtil.getJVMClassName(psiClass);

  final Project project = getEventProject(e);
  CompilerManager.getInstance(project).make(new FileSetCompileScope(Arrays.asList(virtualFile), new Module[]{module}), new CompileStatusNotification() {
    @Override
    public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
      if (aborted || errors > 0) return;
      generateAndShowXml(module, className);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ShowSerializedXmlAction.java

示例4: expandCompileScopeIfNeeded

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
public static Collection<VirtualFile> expandCompileScopeIfNeeded(final Collection<VirtualFile> result, final CompileContext context) {
  final ProjectFileIndex index = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
  final THashSet<VirtualFile> set = new THashSet<VirtualFile>();
  final THashSet<Module> modules = new THashSet<Module>();
  for (VirtualFile file : result) {
    if (index.getSourceRootForFile(file) == null) {
      set.add(file);
      ContainerUtil.addIfNotNull(index.getModuleForFile(file), modules);
    }
  }
  if (!set.isEmpty()) {
    ((CompileContextEx)context).addScope(new FileSetCompileScope(set, modules.toArray(new Module[modules.size()])));
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:InspectionValidatorUtil.java

示例5: getCompilableFiles

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
@Nullable
private static FileSetCompileScope getCompilableFiles(Project project, VirtualFile[] files) {
  if (files == null || files.length == 0) {
    return null;
  }
  final PsiManager psiManager = PsiManager.getInstance(project);
  final FileTypeManager typeManager = FileTypeManager.getInstance();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  final CompilerManager compilerManager = CompilerManager.getInstance(project);
  final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
  final List<Module> affectedModules = new ArrayList<Module>();
  for (final VirtualFile file : files) {
    if (!fileIndex.isInSourceContent(file)) {
      continue;
    }
    if (!file.isInLocalFileSystem()) {
      continue;
    }
    if (file.isDirectory()) {
      final PsiDirectory directory = psiManager.findDirectory(file);
      if (directory == null || JavaDirectoryService.getInstance().getPackage(directory) == null) {
        continue;
      }
    }
    else {
      FileType fileType = file.getFileType();
      if (!(compilerManager.isCompilableFileType(fileType))) {
        continue;
      }
    }
    filesToCompile.add(file);
    ContainerUtil.addIfNotNull(fileIndex.getModuleForFile(file), affectedModules);
  }
  if (filesToCompile.isEmpty()) return null;
  return new FileSetCompileScope(filesToCompile, affectedModules.toArray(new Module[affectedModules.size()]));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:ProcessAnnotationsAction.java

示例6: addStubsToCompileScope

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
protected static void addStubsToCompileScope(List<String> outputPaths, CompileContext compileContext, Module module) {
  List<VirtualFile> stubFiles = new ArrayList<VirtualFile>();
  for (String outputPath : outputPaths) {
    final File stub = new File(outputPath);
    CompilerUtil.refreshIOFile(stub);
    final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(stub);
    ContainerUtil.addIfNotNull(file, stubFiles);
  }
  ((CompileContextEx)compileContext).addScope(new FileSetCompileScope(stubFiles, new Module[]{module}));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:GroovyCompilerBase.java

示例7: getCompilableFiles

import com.intellij.compiler.impl.FileSetCompileScope; //导入依赖的package包/类
@Nullable
private static FileSetCompileScope getCompilableFiles(Project project, VirtualFile[] files)
{
	if(files == null || files.length == 0)
	{
		return null;
	}
	final PsiManager psiManager = PsiManager.getInstance(project);
	final FileTypeManager typeManager = FileTypeManager.getInstance();
	final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
	final CompilerManager compilerManager = CompilerManager.getInstance(project);
	final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
	final List<Module> affectedModules = new ArrayList<Module>();
	for(final VirtualFile file : files)
	{
		if(!fileIndex.isInSourceContent(file))
		{
			continue;
		}
		if(!file.isInLocalFileSystem())
		{
			continue;
		}
		if(file.isDirectory())
		{
			final PsiDirectory directory = psiManager.findDirectory(file);
			if(directory == null || JavaDirectoryService.getInstance().getPackage(directory) == null)
			{
				continue;
			}
		}
		else
		{
			FileType fileType = file.getFileType();
			if(!(compilerManager.isCompilableFileType(fileType)))
			{
				continue;
			}
		}
		filesToCompile.add(file);
		ContainerUtil.addIfNotNull(fileIndex.getModuleForFile(file), affectedModules);
	}
	if(filesToCompile.isEmpty())
	{
		return null;
	}
	return new FileSetCompileScope(filesToCompile, affectedModules.toArray(new Module[affectedModules.size()]));
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:49,代码来源:ProcessAnnotationsAction.java


注:本文中的com.intellij.compiler.impl.FileSetCompileScope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。