Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
30,100 | boolean (@NotNull final GroovyFile scriptFile) { return GroovyScriptUtil.isSpecificScriptFile(scriptFile, GantScriptType.INSTANCE); } | isAppropriateScriptFile |
30,101 | PsiFile (@NotNull ReferenceType refType, @NotNull final String runtimeName, @NotNull final Project project, @NotNull GlobalSearchScope scope) { try { final String fileName = StringUtil.getShortName(runtimeName); PsiFile[] files = FilenameIndex.getFilesByName(project, fileName + "." + GantScriptType.DEFAULT_EXTENSION, scope); if (files.length == 0) files = FilenameIndex.getFilesByName(project, fileName + "." + GantScriptType.DEFAULT_EXTENSION, GlobalSearchScope.allScope(project)); if (files.length == 1) return files[0]; if (files.length == 0) { files = FilenameIndex.getFilesByName(project, fileName + ".groovy", scope); if (files.length == 0) files = FilenameIndex.getFilesByName(project, fileName + "." + GantScriptType.DEFAULT_EXTENSION, GlobalSearchScope.allScope(project)); PsiFile candidate = null; for (PsiFile file : files) { if (GroovyScriptUtil.isSpecificScriptFile(file, GantScriptType.INSTANCE)) { if (candidate != null) return null; candidate = file; } } return candidate; } } catch (ProcessCanceledException | IndexNotReadyException ignored) { } return null; } | getExtraScriptIfNotFound |
30,102 | GrArgumentLabel[] (GroovyFile file) { ArrayList<GrArgumentLabel> labels = new ArrayList<>(); for (PsiElement child : file.getChildren()) { if (child instanceof GrMethodCallExpression call) { GrNamedArgument[] arguments = call.getNamedArguments(); if (arguments.length == 1) { GrArgumentLabel label = arguments[0].getLabel(); if (label != null && isPlainIdentifier(label)) { labels.add(label); } } } } return labels.toArray(GrArgumentLabel.EMPTY_ARRAY); } | getScriptTargets |
30,103 | boolean (final GrArgumentLabel label) { final PsiElement elem = label.getNameElement(); final ASTNode node = elem.getNode(); if (node == null) return false; return node.getElementType() == GroovyTokenTypes.mIDENT; } | isPlainIdentifier |
30,104 | boolean (VirtualFile file) { if (file != null && file.isDirectory()) { final String path = file.getPath(); if (GroovyUtils.getFilesInDirectoryByPattern(path + "/lib", GANT_JAR_FILE_PATTERN).length > 0) { return true; } if (GroovyUtils.getFilesInDirectoryByPattern(path + "/embeddable", GANT_JAR_FILE_PATTERN).length > 0) { return true; } if (file.findFileByRelativePath("bin/gant") != null) { return true; } } return false; } | isGantSdkHome |
30,105 | boolean (Library library) { if (library == null) return false; return isGantLibrary(library.getFiles(OrderRootType.CLASSES)); } | isSDKLibrary |
30,106 | boolean (VirtualFile[] files) { for (VirtualFile file : files) { if (isGantJarFile(file.getName())) { return true; } } return false; } | isGantLibrary |
30,107 | boolean (final String name) { return name.matches(GANT_JAR_FILE_PATTERN); } | isGantJarFile |
30,108 | String (Library library) { return getGantLibraryHome(library.getFiles(OrderRootType.CLASSES)); } | getGantLibraryHome |
30,109 | String (VirtualFile[] files) { for (VirtualFile file : files) { if (isGantJarFile(file.getName())) { final VirtualFile parent = LibrariesUtil.getLocalFile(file).getParent(); if (parent != null) { final VirtualFile gantHome = parent.getParent(); if (gantHome != null) { return PathUtil.getLocalPath(gantHome); } } } } return ""; } | getGantLibraryHome |
30,110 | String (@Nullable Module module, @NotNull Project project) { if (module != null) { final String fromClasspath = getSdkHomeFromClasspath(module); if (fromClasspath != null) { return fromClasspath; } } final VirtualFile sdkHome = GantSettings.getInstance(project).getSdkHome(); return sdkHome != null ? sdkHome.getPath() : ""; } | getSDKInstallPath |
30,111 | String (@NotNull Module module) { Library[] libraries = LibrariesUtil.getLibrariesByCondition(module, library1 -> isSDKLibrary(library1)); if (libraries.length != 0) { final String home = getGantLibraryHome(libraries[0]); if (StringUtil.isNotEmpty(home)) { return home; } } return null; } | getSdkHomeFromClasspath |
30,112 | boolean (@NotNull Module module) { return GantSettings.getInstance(module.getProject()).getSdkHome() != null || getSdkHomeFromClasspath(module) != null; } | isSDKConfiguredToRun |
30,113 | boolean (final VirtualFile[] libraryFiles) { return GantUtils.isGantLibrary(libraryFiles); } | managesLibrary |
30,114 | String (final VirtualFile[] libraryFiles) { String version = GantUtils.getGantVersionOrNull(GantUtils.getGantLibraryHome(libraryFiles)); return version == null ? GroovyBundle.message("undefined.library.version") : version; } | getLibraryVersion |
30,115 | Icon (GroovyLibraryProperties properties) { return JetgroovyIcons.Groovy.Gant_sdk; } | getIcon |
30,116 | boolean (@NotNull VirtualFile file) { return GantUtils.isGantSdkHome(file); } | isSDKHome |
30,117 | String () { return GroovyBundle.message("framework.gant"); } | getLibraryCategoryName |
30,118 | void (String path, LibraryEditor libraryEditor) { File srcRoot = new File(path + "/src/main"); if (srcRoot.exists()) { libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(srcRoot), OrderRootType.SOURCES); } // Add Gant jars File lib = new File(path + "/lib"); File[] jars = lib.exists() ? lib.listFiles() : new File[0]; if (jars != null) { for (File file : jars) { if (file.getName().endsWith(".jar")) { libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES); } } } } | fillLibrary |
30,119 | boolean (@NotNull GroovyFile script) { String name = script.getName(); return name.endsWith(GantScriptType.DEFAULT_EXTENSION); } | isSpecificScriptFile |
30,120 | Icon () { return JetgroovyIcons.Groovy.Gant_16x16; } | getScriptIcon |
30,121 | GroovyScriptRunner () { return new GantRunner(); } | getRunner |
30,122 | boolean (@NotNull GroovyScriptRunConfiguration existing, @NotNull Location place) { final String params = existing.getProgramParameters(); final String targetName = getTargetName(place); if (targetName == null) { return StringUtil.isEmpty(params); } return params != null && (params.startsWith(targetName + " ") || params.equals(targetName)); } | isConfigurationByLocation |
30,123 | String (Location location) { PsiElement parent = location.getPsiElement(); while (!(parent.getParent() instanceof PsiFile) && parent.getParent() != null) { parent = parent.getParent(); } if (parent instanceof GrMethodCallExpression && PsiUtil.isMethodCall((GrMethodCallExpression)parent, "target")) { final GrNamedArgument[] args = ((GrMethodCallExpression)parent).getNamedArguments(); if (args.length == 1) { final GrArgumentLabel label = args[0].getLabel(); if (label != null) { return label.getName(); } } return null; } return null; } | getTargetName |
30,124 | void (@NotNull GroovyFile file, @NotNull GroovyScriptRunConfiguration configuration, Location location) { String target = getTargetName(location); if (target != null) { configuration.setProgramParameters(target); configuration.setName(configuration.getName() + "." + target); } RunManagerEx.disableTasks(file.getProject(), configuration, CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID); } | tuneConfiguration |
30,125 | List<VirtualFile> (@NotNull GroovyFile file) { final Module module = ModuleUtilCore.findModuleForPsiElement(file); if (module != null) { final String sdkHome = GantUtils.getSdkHomeFromClasspath(module); if (sdkHome != null) { return Collections.emptyList(); } } final GantSettings gantSettings = GantSettings.getInstance(file.getProject()); final VirtualFile home = gantSettings.getSdkHome(); if (home == null) { return Collections.emptyList(); } return gantSettings.getClassRoots(); } | additionalScopeFiles |
30,126 | GlobalSearchScope (@NotNull GroovyFile file, @NotNull GlobalSearchScope baseScope) { return baseScope.uniteWith(new NonClasspathDirectoriesScope(additionalScopeFiles(file))); } | patchResolveScope |
30,127 | boolean () { return true; } | shouldRefreshAfterFinish |
30,128 | boolean (@NotNull Module module) { return GantUtils.isSDKConfiguredToRun(module); } | isValidModule |
30,129 | String (final String gantHome) { String confPath = FileUtil.toSystemDependentName(gantHome + "/conf/gant-starter.conf"); if (new File(confPath).exists()) { return confPath; } return getConfPath(gantHome); } | getGantConfPath |
30,130 | void (JavaParameters params, Module module, String gantHome) { final File[] groovyJars = GroovyConfigUtils.getGroovyAllJars(gantHome + "/lib/"); if (groovyJars.length > 0) { params.getClassPath().add(groovyJars[0].getAbsolutePath()); } if (module == null) { return; } final String groovyHome = LibrariesUtil.getGroovyHomePath(module); if (groovyHome != null) { File[] libJars = GroovyUtils.getFilesInDirectoryByPattern(groovyHome + "/lib/", ".*\\.jar"); if (libJars.length > 0) { params.getClassPath().addAllFiles(libJars); } } List<VirtualFile> classpath = params.getClassPath().getRootDirs(); String[] characteristicClasses = ContainerUtil.ar( LibrariesUtil.SOME_GROOVY_CLASS, "org.apache.tools.ant.BuildException", "org.apache.tools.ant.launch.AntMain", "org.apache.commons.cli.ParseException"); for (String someClass : characteristicClasses) { if (!LibraryUtil.isClassAvailableInLibrary(classpath, someClass)) { VirtualFile jar = LibrariesUtil.findJarWithClass(module, someClass); if (jar != null) { params.getClassPath().add(jar); } } } } | addGroovyAndAntJars |
30,131 | String (@NotNull PsiDirectory directory, @NotNull String newName) { return GroovyBundle.message("new.gant.script.dialog.title"); } | getActionName |
30,132 | boolean (DataContext dataContext) { return super.isAvailable(dataContext) && GantUtils.isSDKConfiguredToRun(Objects.requireNonNull(PlatformCoreDataKeys.MODULE.getData(dataContext))); } | isAvailable |
30,133 | String () { return "reference.settingsdialog.project.gant"; } | getHelpTopic |
30,134 | boolean (VirtualFile file) { return GantUtils.isGantSdkHome(file); } | isSdkHome |
30,135 | GantSettings () { return GantSettings.getInstance(myProject); } | getFrameworkSettings |
30,136 | Set<LightMethodBuilder> (PsiElement place) { final PsiFile file = place.getContainingFile(); if (!(file instanceof GroovyFile)) { return Collections.emptySet(); } return CachedValuesManager.getManager(file.getProject()).getCachedValue(file, GANT_METHODS, () -> { Map<String, Class<?>> antObjects = getAntObjects((GroovyFile)file); final Set<LightMethodBuilder> methods = new HashSet<>(); final Project project = file.getProject(); final PsiType mapType = TypesUtil.createType(GroovyCommonClassNames.JAVA_UTIL_LINKED_HASH_MAP, file); final PsiType stringType = TypesUtil.createType(CommonClassNames.JAVA_LANG_STRING, file); final PsiType closureType = TypesUtil.createType(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, file); for (String name : antObjects.keySet()) { methods.addAll(AntBuilderMethod.methods(file, name, antObjects.get(name), mapType, stringType, closureType)); } return CachedValueProvider.Result .create(methods, PsiModificationTracker.MODIFICATION_COUNT, ProjectRootManager.getInstance(project)); }, false); } | getAntTasks |
30,137 | Builder (List<Path> files) { return build().files(files).allowLock(false).noPreload().parent(ClassLoader.getPlatformClassLoader()); } | getBuilder |
30,138 | void (@NotNull PsiType qualifierType, @Nullable PsiClass aClass, @NotNull PsiScopeProcessor processor, @NotNull PsiElement place, @NotNull ResolveState state) { if (aClass != null && ClassUtil.getSuperClassesWithCache(aClass).containsKey("groovy.util.AntBuilder")) { processAntTasks(processor, place, state); return; } if (!(place instanceof GrReferenceExpression) || ((GrReferenceExpression)place).isQualified()) { return; } GrClosableBlock closure = PsiTreeUtil.getContextOfType(place, GrClosableBlock.class, true); boolean antTasksProcessed = false; while (closure != null) { final PsiElement parent = closure.getParent(); if (parent instanceof GrMethodCall) { final PsiMethod method = ((GrMethodCall)parent).resolveMethod(); if (method instanceof AntBuilderMethod) { antTasksProcessed = true; if (!processAntTasks(processor, place, state)) { return; } if (!((AntBuilderMethod)method).processNestedElements(processor)) { return; } break; } } closure = PsiTreeUtil.getContextOfType(closure, GrClosableBlock.class, true); } // ------- gant-specific PsiFile file = place.getContainingFile(); if (file == null || !GroovyScriptUtil.isSpecificScriptFile(file, GantScriptType.INSTANCE)) { return; } if (aClass instanceof GroovyScriptClass) { for (GrArgumentLabel label : GantUtils.getScriptTargets((GroovyFile)file)) { final String targetName = label.getName(); if (targetName != null) { final PsiNamedElement variable = new LightVariableBuilder(targetName, GroovyCommonClassNames.GROOVY_LANG_CLOSURE, label). setBaseIcon(JetgroovyIcons.Groovy.Gant_target); if (!ResolveUtil.processElement(processor, variable, state)) { return; } } } } if (!antTasksProcessed) { processAntTasks(processor, place, state); } } | processDynamicElements |
30,139 | boolean (PsiScopeProcessor processor, PsiElement place, ResolveState state) { if (!ResolveUtilKt.shouldProcessMethods(processor)) return true; for (LightMethodBuilder task : AntTasksProvider.getAntTasks(place)) { if (!ResolveUtil.processElement(processor, task, state)) { return false; } } return true; } | processAntTasks |
30,140 | PsiElement () { if (myAntClass != null) { final PsiClass psiClass = JavaPsiFacade.getInstance(getProject()).findClass(myAntClass.getName(), myFile.getResolveScope()); if (psiClass != null) { return psiClass; } } return this; } | getNavigationElement |
30,141 | boolean (PsiScopeProcessor processor) { if (!ResolveUtilKt.shouldProcessMethods(processor)) return true; final AntIntrospector introspector = AntDomExtender.getIntrospector(myAntClass); if (introspector == null) { return true; } final String expectedName = ResolveUtil.getNameHint(processor); final PsiType mapType = TypesUtil.createType(GroovyCommonClassNames.JAVA_UTIL_LINKED_HASH_MAP, myFile); final PsiType stringType = TypesUtil.createType(CommonClassNames.JAVA_LANG_STRING, myFile); final PsiType closureType = TypesUtil.createType(GroovyCommonClassNames.GROOVY_LANG_CLOSURE, myFile); for (String name : Collections.list(introspector.getNestedElements())) { if (expectedName != null && !expectedName.equals(name)) { continue; } Class<?> antClass = introspector.getElementType(name); for (LightMethodBuilder method : methods(myFile, name, antClass, mapType, stringType, closureType)) { if (!processor.execute(method, ResolveState.initial())) { return false; } } } return true; } | processNestedElements |
30,142 | List<LightMethodBuilder> (@NotNull PsiFile file, @NotNull String name, @Nullable Class<?> antClass, @NotNull PsiType mapType, @NotNull PsiType stringType, @NotNull PsiType closureType) { // (Map, String, Closure) // (Map, String) AntBuilderMethod method = new AntBuilderMethod(file, name, antClass); method.addParameter(new GrLightParameter("args", mapType, method)); method.addParameter(new GrLightParameter("singleArg", stringType, method)); method.addParameter(new GrLightParameter("body", closureType, method).setOptional(true)); // (Map, Closure) // (Map) AntBuilderMethod method2 = new AntBuilderMethod(file, name, antClass); method2.addParameter(new GrLightParameter("args", mapType, method2)); method2.addParameter(new GrLightParameter("body", closureType, method2).setOptional(true)); // (String, Closure) // (String) AntBuilderMethod method3 = new AntBuilderMethod(file, name, antClass); method3.addParameter(new GrLightParameter("singleArg", stringType, method3)); method3.addParameter(new GrLightParameter("body", closureType, method3).setOptional(true)); // (Closure) // () AntBuilderMethod method4 = new AntBuilderMethod(file, name, antClass); method4.addParameter(new GrLightParameter("body", closureType, method4).setOptional(true)); return Arrays.asList(method, method2, method3, method4); } | methods |
30,143 | String () { return "Spock"; } | getName |
30,144 | String () { return null; } | getLibraryPath |
30,145 | ExternalLibraryDescriptor () { return SPOCK_DESCRIPTOR; } | getFrameworkLibraryDescriptor |
30,146 | String () { return SpockUtils.SPEC_CLASS_NAME; } | getDefaultSuperClass |
30,147 | FileTemplateDescriptor () { return new FileTemplateDescriptor("Spock_SetUp_Method.groovy"); } | getSetUpMethodFileTemplateDescriptor |
30,148 | FileTemplateDescriptor () { return new FileTemplateDescriptor("Spock cleanup Method.groovy"); } | getTearDownMethodFileTemplateDescriptor |
30,149 | FileTemplateDescriptor () { return new FileTemplateDescriptor("Spock Test Method.groovy"); } | getTestMethodFileTemplateDescriptor |
30,150 | boolean (PsiElement element, boolean checkAbstract) { return SpockUtils.isTestMethod(element); } | isTestMethod |
30,151 | String () { return SpockUtils.SPEC_CLASS_NAME; } | getMarkerClassFQName |
30,152 | boolean (PsiClass clazz, boolean canBePotential) { return clazz.getLanguage() == GroovyLanguage.INSTANCE && isInheritor(clazz, SpockUtils.SPEC_CLASS_NAME); } | isTestClass |
30,153 | PsiMethod (@NotNull PsiClass clazz, String methodName) { if (!isTestClass(clazz, false)) return null; for (PsiMethod method : clazz.findMethodsByName(methodName, false)) { if (method.getParameterList().isEmpty()) return method; } return null; } | findSpecificMethod |
30,154 | PsiMethod (@NotNull PsiClass clazz) { return findSpecificMethod(clazz, SpockConstants.SETUP_METHOD_NAME); } | findSetUpMethod |
30,155 | PsiMethod (@NotNull PsiClass clazz) { return findSpecificMethod(clazz, SpockConstants.CLEANUP_METHOD_NAME); } | findTearDownMethod |
30,156 | boolean (Project project, GlobalSearchScope scope) { PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(SpockUtils.SPEC_CLASS_NAME, scope); return aClass != null && AnnotationUtil.isAnnotated(aClass, JUnitUtil.CUSTOM_TESTABLE_ANNOTATION, 0); } | shouldRunSingleClassAsJUnit5 |
30,157 | void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { PsiElement position = parameters.getPosition(); if (!DGMUtil.isInDGMFile(position)) return; Map<String, String> map = ((PropertiesFile)position.getContainingFile()).getNamesMap(); for (String key : DGMUtil.KEYS) { if (!map.containsKey(key)) { result.addElement(LookupElementBuilder.create(key)); } } } | addCompletions |
30,158 | void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull final CompletionResultSet result) { PsiElement position = parameters.getPosition(); if (!DGMUtil.isInDGMFile(position)) return; AllClassesGetter.processJavaClasses(parameters, result.getPrefixMatcher(), true, aClass -> result.addElement(GroovyCompletionUtil.createClassLookupItem(aClass))); } | addCompletions |
30,159 | void (@NotNull PsiReferenceRegistrar registrar) { registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHARACTERS), new PsiReferenceProvider() { @Override public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { if (!DGMUtil.isInDGMFile(element)) return PsiReference.EMPTY_ARRAY; IProperty parent = (IProperty)element.getParent(); if (!"extensionClasses".equals(parent.getName())) { return PsiReference.EMPTY_ARRAY; } ArrayList<PsiReference> result = new ArrayList<>(); String text = element.getText(); int i = 0; while ((i = skipWhiteSpace(i, text)) < text.length()) { int end = findWhiteSpaceOrComma(i, text); if (end <= text.length()) { JavaClassReferenceSet set = new JavaClassReferenceSet(text.substring(i, end), element, i, true, myProvider); ContainerUtil.addAll(result, set.getAllReferences()); } i = end; i = skipWhiteSpace(i, text); if (i == text.length()) break; if (text.charAt(i) == ',') i++; i = skipWhiteSpace(i, text); } return result.toArray(PsiReference.EMPTY_ARRAY); } }); } | registerReferenceProviders |
30,160 | int (int i, String text) { while (i < text.length() && Character.isWhitespace(text.charAt(i))) { i++; } return i; } | skipWhiteSpace |
30,161 | int (int i, String text) { while (i < text.length() && !Character.isWhitespace(text.charAt(i)) && text.charAt(i) != ',') { i++; } return i; } | findWhiteSpaceOrComma |
30,162 | IntentionAction (GrReferenceExpression expression, PsiType[] types) { return new DynamicMethodFix(expression, types); } | createDynamicMethodFix |
30,163 | IntentionAction (GrReferenceExpression expression) { return new DynamicPropertyFromRefFix(expression); } | createDynamicPropertyFix |
30,164 | IntentionAction (GrReferenceElement element) { return new GroovyAddImportAction(element); } | createGroovyAddImportAction |
30,165 | IntentionAction (GrNewExpression parent) { return CreateClassFix.createClassFromNewAction(parent); } | createClassFromNewAction |
30,166 | IntentionAction (GrReferenceElement element, GrCreateClassKind anInterface) { return CreateClassFix.createClassFixAction(element, anInterface); } | createClassFixAction |
30,167 | IntentionAction (GrReferenceExpression expr) { final String referenceName = expr.getReferenceName(); return referenceName == null ? null : new CreateFieldFromUsageFix(expr, referenceName); } | createCreateFieldFromUsageFix |
30,168 | IntentionAction (GrReferenceExpression expr, PsiClass aClass) { return new CreateGetterFromUsageFix(expr); } | createCreateGetterFromUsageFix |
30,169 | IntentionAction (GrReferenceExpression expr) { return new CreateSetterFromUsageFix(expr); } | createCreateSetterFromUsageFix |
30,170 | IntentionAction (GrReferenceExpression expr) { return new CreateMethodFromUsageFix(expr); } | createCreateMethodFromUsageFix |
30,171 | IntentionAction (GrReferenceExpression expr, GrVariableDeclarationOwner owner) { return new CreateLocalVariableFromUsageFix(expr, owner); } | createCreateLocalVariableFromUsageFix |
30,172 | IntentionAction (GrReferenceExpression expr) { return new CreateParameterFromUsageFix(expr); } | createCreateParameterFromUsageFix |
30,173 | IntentionAction (GrMethodCall parent) { return new GroovyStaticImportMethodFix(parent); } | createGroovyStaticImportMethodFix |
30,174 | GroovyFix () { return new RenameFix(); } | createRenameFix |
30,175 | LocalQuickFix () { return new ReplaceWithImportFix(); } | createReplaceWithImportFix |
30,176 | LocalQuickFix (String actual) { return new GrMoveToDirFix(actual); } | createGrMoveToDirFix |
30,177 | LocalQuickFix (GrTypeDefinition element, GrNamedArgument argument) { return new CreateFieldFromConstructorLabelFix(element, argument); } | createCreateFieldFromConstructorLabelFix |
30,178 | LocalQuickFix (GrArgumentLabel label, PsiClass element) { return new DynamicPropertyFromLabelFix(label, element); } | createDynamicPropertyFix |
30,179 | GroovyFix (String methodName, GrTypeDefinition aClass) { return new AddMethodFix(methodName, aClass); } | createAddMethodFix |
30,180 | GroovyFix (GrTypeDefinition aClass, String comparable) { return new AddClassToExtendsFix(aClass, comparable); } | createAddClassToExtendsFix |
30,181 | IntentionAction (boolean onTheFly) { return new GroovyOptimizeImportsFix(onTheFly); } | createOptimizeImportsFix |
30,182 | IntentionAction (GrParameter parameter) { return new RemoveUnusedGrParameterFix(parameter); } | createRemoveUnusedGrParameterFix |
30,183 | IntentionAction (String reason) { return new InvestigateFix(reason); } | createInvestigateFix |
30,184 | LocalQuickFix (int size) { return new GrReplaceMultiAssignmentFix(size); } | createMultipleAssignmentFix |
30,185 | LocalQuickFix (int size) { return new SpreadArgumentFix(size); } | createSpreadArgumentFix |
30,186 | LocalQuickFix () { return new MapConstructorAttributesFix(); } | createMapConstructorFix |
30,187 | LocalQuickFix () { return new GrReplaceWithQualifiedExpressionFix(); } | createQualifyExpressionFix |
30,188 | LocalQuickFix (List<? extends PsiElement> expressions, GrSwitchElement switchElement) { return new GrAddMissingCaseSectionsFix(expressions, switchElement); } | createAddMissingCasesFix |
30,189 | IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { String originalText = file.getText(); final Runnable optimize = new GroovyImportOptimizer().processFile(file); optimize.run(); String newText = file.getText(); return new IntentionPreviewInfo.CustomDiff(GroovyFileType.GROOVY_FILE_TYPE, originalText, newText); } | generatePreview |
30,190 | String () { return GroovyBundle.message("optimize.all.imports"); } | getText |
30,191 | String () { return GroovyBundle.message("optimize.imports"); } | getFamilyName |
30,192 | boolean () { return false; } | startInWriteAction |
30,193 | boolean (@NotNull Project project, Editor editor, PsiFile file) { return file instanceof GroovyFile && (!onTheFly || timeToOptimizeImports((GroovyFile)file, editor)); } | isAvailable |
30,194 | boolean (GroovyFile myFile, Editor editor) { if (!CodeInsightWorkspaceSettings.getInstance(myFile.getProject()).isOptimizeImportsOnTheFly()) { return false; } if (onTheFly && editor != null) { // if we stand inside import statements, do not optimize final VirtualFile vfile = myFile.getVirtualFile(); if (vfile != null && ProjectRootManager.getInstance(myFile.getProject()).getFileIndex().isInSource(vfile)) { final GrImportStatement[] imports = myFile.getImportStatements(); if (imports.length > 0) { final int offset = editor.getCaretModel().getOffset(); if (imports[0].getTextRange().getStartOffset() <= offset && offset <= imports[imports.length - 1].getTextRange().getEndOffset()) { return false; } } } } DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(myFile.getProject()); if (!codeAnalyzer.isHighlightingAvailable(myFile)) return false; if (!codeAnalyzer.isErrorAnalyzingFinished(myFile)) return false; Document myDocument = PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile); boolean errors = containsErrorsPreventingOptimize(myFile, myDocument); // computed in GroovyPostHighlightingPass.doCollectInformation() boolean isInContent = true; return !errors && DaemonListeners.canChangeFileSilently(myFile, isInContent, ThreeState.UNSURE); } | timeToOptimizeImports |
30,195 | boolean (GroovyFile myFile, Document myDocument) { // ignore unresolved imports errors final TextRange ignoreRange; final GrImportStatement[] imports = myFile.getImportStatements(); if (imports.length != 0) { final int start = imports[0].getTextRange().getStartOffset(); final int end = imports[imports.length - 1].getTextRange().getEndOffset(); ignoreRange = new TextRange(start, end); } else { ignoreRange = TextRange.EMPTY_RANGE; } return !DaemonCodeAnalyzerEx .processHighlights(myDocument, myFile.getProject(), HighlightSeverity.ERROR, 0, myDocument.getTextLength(), error -> { int infoStart = error.getActualStartOffset(); int infoEnd = error.getActualEndOffset(); return ignoreRange.containsRange(infoStart, infoEnd) && error.type.equals(HighlightInfoType.WRONG_REF); }); } | containsErrorsPreventingOptimize |
30,196 | void (@NotNull final Runnable runnable, @NotNull final PsiFile file, @NotNull final Editor editor) { final long stamp = editor.getDocument().getModificationStamp(); Project project = file.getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed() || editor.isDisposed() || editor.getDocument().getModificationStamp() != stamp) return; //no need to optimize imports on the fly during undo/redo if (UndoManager.getInstance(project).isUndoOrRedoInProgress()) return; PsiDocumentManager.getInstance(project).commitAllDocuments(); String beforeText = file.getText(); final long oldStamp = editor.getDocument().getModificationStamp(); DocumentUtil.writeInRunUndoTransparentAction(runnable); if (oldStamp != editor.getDocument().getModificationStamp()) { String afterText = file.getText(); if (Comparing.strEqual(beforeText, afterText)) { String path = file.getViewProvider().getVirtualFile().getPath(); LOG.error("Import optimizer hasn't optimized any imports", new Attachment(path, afterText)); } } }); } | invokeOnTheFlyImportOptimizer |
30,197 | PsiElementVisitor (@NotNull DependenciesBuilder.DependencyProcessor processor, @NotNull DependencyVisitorFactory.VisitorOptions options) { GroovyElementVisitor visitor = new MyVisitor(processor, options); return new PsiElementVisitor() { @Override public void visitFile(@NotNull PsiFile file) { if (file instanceof GroovyFile) { ((GroovyFile)file).accept(visitor); } } }; } | getVisitor |
30,198 | void (@NotNull PsiFile file) { if (file instanceof GroovyFile) { ((GroovyFile)file).accept(visitor); } } | visitFile |
30,199 | void (@NotNull GroovyPsiElement element) { super.visitElement(element); for (PsiReference ref : element.getReferences()) { PsiElement resolved = ref.resolve(); if (resolved != null) { myProcessor.process(ref.getElement(), resolved); } } } | visitElement |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.