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


Java GroovyFile.isScript方法代码示例

本文整理汇总了Java中org.jetbrains.plugins.groovy.lang.psi.GroovyFile.isScript方法的典型用法代码示例。如果您正苦于以下问题:Java GroovyFile.isScript方法的具体用法?Java GroovyFile.isScript怎么用?Java GroovyFile.isScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.plugins.groovy.lang.psi.GroovyFile的用法示例。


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

示例1: getIcon

import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; //导入方法依赖的package包/类
@Nullable
@Override
public Icon getIcon(@NotNull VirtualFile virtualFile, @Iconable.IconFlags int flags, @Nullable Project project) {
  if (project == null || virtualFile.getFileType() != GroovyFileType.GROOVY_FILE_TYPE) return null;
  final PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
  if (!(psiFile instanceof GroovyFile)) return null;
  final GroovyFile file = (GroovyFile)psiFile;
  final Icon icon;
  if (file.isScript()) {
    icon = GroovyScriptTypeDetector.getIcon(file);
  }
  else if (GrFileIndexUtil.isGroovySourceFile(file)) {
    final GrTypeDefinition[] typeDefinitions = file.getTypeDefinitions();
    icon = typeDefinitions.length > 0
           ? typeDefinitions[0].getIcon(flags)
           : JetgroovyIcons.Groovy.Groovy_16x16;
  }
  else {
    icon = JetgroovyIcons.Groovy.Groovy_outsideSources;
  }
  return ElementBase.createLayeredIcon(psiFile, icon, ElementBase.transformFlags(psiFile, flags));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GroovyFileIconProvider.java

示例2: getScriptClassesByFQName

import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; //导入方法依赖的package包/类
public List<PsiClass> getScriptClassesByFQName(final String name, final GlobalSearchScope scope, final boolean srcOnly) {
  GlobalSearchScope actualScope = srcOnly ? new GrSourceFilterScope(scope) : scope;
  final Collection<GroovyFile> files = StubIndex.getElements(GrFullScriptNameIndex.KEY, name.hashCode(), myProject, actualScope,
                                                             GroovyFile.class);
  if (files.isEmpty()) {
    return Collections.emptyList();
  }

  final ArrayList<PsiClass> result = new ArrayList<PsiClass>();
  for (GroovyFile file : files) {
    if (file.isScript()) {
      final PsiClass scriptClass = file.getScriptClass();
      if (scriptClass != null && name.equals(scriptClass.getQualifiedName())) {
        result.add(scriptClass);
      }
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GroovyShortNamesCache.java

示例3: appendImplicitlyImportedPackages

import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; //导入方法依赖的package包/类
@Override
public List<String> appendImplicitlyImportedPackages(@NotNull GroovyFile file) {
  if (file.isScript() && GroovyScriptUtil.getScriptType(file) instanceof GradleScriptType) {
    return Arrays.asList(IMPLICIT_GRADLE_PACKAGES);
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GradleDefaultImportContributor.java

示例4: GrFileStub

import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; //导入方法依赖的package包/类
public GrFileStub(GroovyFile file) {
  super(file);
  myName = StringRef.fromString(file.getViewProvider().getVirtualFile().getNameWithoutExtension());
  isScript = file.isScript();
  final GrPackageDefinition definition = file.getPackageDefinition();
  if (definition != null) {
    myAnnotations = GrStubUtils.getAnnotationNames(definition);
  } else {
    myAnnotations = ArrayUtil.EMPTY_STRING_ARRAY;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GrFileStub.java

示例5: isRenameFileOnClassRenaming

import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; //导入方法依赖的package包/类
private boolean isRenameFileOnClassRenaming() {
  final PsiFile file = getContainingFile();
  if (!(file instanceof GroovyFile)) return false;
  final GroovyFile groovyFile = (GroovyFile)file;
  if (groovyFile.isScript()) return false;
  final String name = getName();
  final VirtualFile vFile = groovyFile.getVirtualFile();
  return vFile != null && name != null && name.equals(vFile.getNameWithoutExtension());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GrTypeDefinitionImpl.java

示例6: getAntObjects

import org.jetbrains.plugins.groovy.lang.psi.GroovyFile; //导入方法依赖的package包/类
private static Map<String, Class> getAntObjects(final GroovyFile groovyFile) {
  final Project project = groovyFile.getProject();

  final Module module = ModuleUtil.findModuleForPsiElement(groovyFile);
  Set<VirtualFile> jars = new HashSet<VirtualFile>();
  if (module != null) {
    ContainerUtil.addAll(jars, OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots());
  }

  if (groovyFile.isScript() && GroovyScriptUtil.getScriptType(groovyFile) instanceof GantScriptType) {
    jars.addAll(GantScriptType.additionalScopeFiles(groovyFile));
  }

  final ArrayList<URL> urls = new ArrayList<URL>();
  for (VirtualFile jar : jars) {
    VirtualFile localFile = PathUtil.getLocalFile(jar);
    if (localFile.getFileSystem() instanceof LocalFileSystem) {
      urls.add(VfsUtilCore.convertToURL(localFile.getUrl()));
    }
  }

  AntClassLoader loader;
  synchronized (ourLock) {
    final Map<List<URL>, AntClassLoader> map = CachedValuesManager.getManager(project).getParameterizedCachedValue(project, KEY,
                                                                                                                   PROVIDER, false, project);

    loader = map.get(urls);
    if (loader == null) {
      map.put(urls, loader = new AntClassLoader(urls));
    }
  }

  return loader.getAntObjects();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:AntTasksProvider.java


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