當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。