Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
29,600
void (PsiField field, StringBuilder buffer) { buffer.append(" = ").append(field.getName()).append(" != +0.0d ? Double.doubleToLongBits("); buffer.append(field.getName()); buffer.append(") : 0L\n"); }
addTempForDoubleInitialization
29,601
String (StringBuilder buffer) { for (PsiField hashCodeField : myHashCodeFields) { if (PsiTypes.doubleType().equals(hashCodeField.getType())) { final String name = getUniqueLocalVarName(TEMP_VARIABLE, myHashCodeFields); buffer.append("long ").append(name).append("\n"); return name; } } return null; }
addTempDeclaration
29,602
String (PsiField field, StringBuilder buffer) { if (PsiTypes.doubleType().equals(field.getType())) { final String name = getUniqueLocalVarName(TEMP_VARIABLE, myHashCodeFields); JavaCodeStyleSettings settings = JavaCodeStyleSettings.getInstance(myFile); if (settings.GENERATE_FINAL_LOCALS) { buffer.append("final "); } buffer.append("long ").append(name); addTempForDoubleInitialization(field, buffer); return name; } else { return null; } }
addTempForOneField
29,603
void (StringBuilder buffer, PsiField field, String tempName) { MessageFormat format = PRIMITIVE_HASHCODE_FORMAT.get(field.getType().getCanonicalText()); buffer.append(format.format(new Object[]{field.getName(), tempName})); }
addPrimitiveFieldHashCode
29,604
void (StringBuilder buffer, PsiField field) { final String name = field.getName(); if (myNonNullSet.contains(field)) { adjustHashCodeToArrays(buffer, field, name); } else { buffer.append("("); buffer.append(name); buffer.append(" != null ? "); adjustHashCodeToArrays(buffer, field, name); buffer.append(" : 0)"); } }
addFieldHashCode
29,605
void (StringBuilder buffer, final PsiField field, final String name) { if (field.getType() instanceof PsiArrayType && LanguageLevel.JDK_1_5.compareTo(PsiUtil.getLanguageLevel(field)) <= 0) { buffer.append("Arrays.hashCode("); buffer.append(name); buffer.append(")"); } else { buffer.append(name); buffer.append(".hashCode()"); } }
adjustHashCodeToArrays
29,606
void (StringBuilder buffer) { if (mySuperHasHashCode) { buffer.append("super.hashCode()"); } else { buffer.append("0"); } }
addSuperHashCode
29,607
PsiMethod (PsiClass aClass, MethodSignature signature) { return MethodSignatureUtil.findMethodBySignature(aClass, signature, false); }
findMethod
29,608
int (PsiField f1, PsiField f2) { if (f1.getType() instanceof PsiPrimitiveType && !(f2.getType() instanceof PsiPrimitiveType)) return -1; if (!(f1.getType() instanceof PsiPrimitiveType) && f2.getType() instanceof PsiPrimitiveType) return 1; final String name1 = f1.getName(); final String name2 = f2.getName(); return name1.compareTo(name2); }
compare
29,609
void () { PRIMITIVE_HASHCODE_FORMAT.put("byte", new MessageFormat("(int) {0}")); PRIMITIVE_HASHCODE_FORMAT.put("short", new MessageFormat("(int) {0}")); PRIMITIVE_HASHCODE_FORMAT.put("int", new MessageFormat("{0}")); PRIMITIVE_HASHCODE_FORMAT.put("long", new MessageFormat("(int) ({0} ^ ({0} >>> 32))")); PRIMITIVE_HASHCODE_FORMAT.put("boolean", new MessageFormat("({0} ? 1 : 0)")); PRIMITIVE_HASHCODE_FORMAT.put("float", new MessageFormat("({0} != +0.0f ? Float.floatToIntBits({0}) : 0)")); PRIMITIVE_HASHCODE_FORMAT.put("double", new MessageFormat("(int) ({1} ^ ({1} >>> 32))")); PRIMITIVE_HASHCODE_FORMAT.put("char", new MessageFormat("(int) {0}")); PRIMITIVE_HASHCODE_FORMAT.put("void", new MessageFormat("({0} ? 1 : 0)")); }
initPrimitiveHashcodeFormats
29,610
boolean (PsiType aType) { if (!(aType instanceof PsiArrayType)) return false; final PsiType componentType = ((PsiArrayType) aType).getComponentType(); return componentType instanceof PsiArrayType; }
isNestedArray
29,611
boolean (PsiType aType) { if (!(aType instanceof PsiArrayType)) return false; final PsiType componentType = ((PsiArrayType) aType).getComponentType(); final PsiClass psiClass = PsiUtil.resolveClassInType(componentType); if (psiClass == null) return false; final String qName = psiClass.getQualifiedName(); return CommonClassNames.JAVA_LANG_OBJECT.equals(qName); }
isArrayOfObjects
29,612
MethodSignature () { return MethodSignatureUtil.createMethodSignature("hashCode", PsiType.EMPTY_ARRAY, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY); }
getHashCodeSignature
29,613
MethodSignature (Project project, GlobalSearchScope scope) { final PsiClassType javaLangObject = PsiType.getJavaLangObject(PsiManager.getInstance(project), scope); return MethodSignatureUtil .createMethodSignature("equals", new PsiType[]{javaLangObject}, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY); }
getEqualsSignature
29,614
String () { return GroovyBundle.message("Equals"); }
getCommandName
29,615
ClassMember[] (PsiClass aClass) { return ClassMember.EMPTY_ARRAY; }
getAllOriginalMembers
29,616
void () { super.cleanup(); myEqualsFields = null; myHashCodeFields = null; myNonNullFields = null; }
cleanup
29,617
String () { return GroovyBundle.message("property.missing"); }
getCommandName
29,618
String () { return GroovyBundle.message("property.missing"); }
getCommandName
29,619
ClassMember[] (PsiClass aClass) { return ClassMember.EMPTY_ARRAY; }
getAllOriginalMembers
29,620
GrMethod (PsiClass aClass, FileTemplate template) { Properties properties = FileTemplateManager.getInstance(aClass.getProject()).getDefaultProperties(); properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, "java.lang.Object"); properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, "null"); properties.setProperty(FileTemplate.ATTRIBUTE_CALL_SUPER, ""); String fqn = aClass.getQualifiedName(); if (fqn != null) properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, fqn); String className = aClass.getName(); if (className != null) properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, className); properties.setProperty(FileTemplate.ATTRIBUTE_METHOD_NAME, "methodMissing"); String bodyText; try { bodyText = StringUtil.replace(template.getText(properties), ";", ""); } catch (IOException e) { return null; } return GroovyPsiElementFactory.getInstance(aClass.getProject()) .createMethodFromText("def methodMissing(String name, def args) {\n" + bodyText + "\n}"); }
genMethod
29,621
boolean (PsiParameter parameter) { return parameter.getType().equalsToText(CommonClassNames.JAVA_LANG_STRING) || parameter.getType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT); }
isNameParam
29,622
ClassMember[] (PsiClass aClass) { return ClassMember.EMPTY_ARRAY; }
getAllOriginalMembers
29,623
GrMethod (PsiClass aClass, FileTemplate template) { Properties properties = FileTemplateManager.getInstance(aClass.getProject()).getDefaultProperties(); properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, "java.lang.Object"); properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, "null"); properties.setProperty(FileTemplate.ATTRIBUTE_CALL_SUPER, ""); properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, aClass.getQualifiedName()); properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, aClass.getName()); properties.setProperty(FileTemplate.ATTRIBUTE_METHOD_NAME, "propertyMissing"); String bodyText; try { bodyText = StringUtil.replace(template.getText(properties), ";", ""); } catch (IOException e) { return null; } return GroovyPsiElementFactory.getInstance(aClass.getProject()) .createMethodFromText("def propertyMissing(String name) {\n" + bodyText + "\n}"); }
genGetter
29,624
GrMethod (PsiClass aClass, FileTemplate template) { Properties properties = FileTemplateManager.getInstance(aClass.getProject()).getDefaultProperties(); properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, "void"); properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, ""); properties.setProperty(FileTemplate.ATTRIBUTE_CALL_SUPER, ""); properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, aClass.getQualifiedName()); properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, aClass.getName()); properties.setProperty(FileTemplate.ATTRIBUTE_METHOD_NAME, "propertyMissing"); String bodyText; try { bodyText = StringUtil.replace(template.getText(properties), ";", ""); } catch (IOException e) { return null; } return GroovyPsiElementFactory.getInstance(aClass.getProject()) .createMethodFromText("def propertyMissing(String name, def arg) {\n" + bodyText + "\n}"); }
genSetter
29,625
boolean (PsiParameter parameter) { return parameter.getType().equalsToText(CommonClassNames.JAVA_LANG_STRING) || parameter.getType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT); }
isNameParam
29,626
void (@NotNull Runnable listener) { super.addChangeListener(listener); scriptPath.getChildComponent().getDocument().addDocumentListener( new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { listener.run(); } } ); }
addChangeListener
29,627
void (@NotNull DocumentEvent e) { listener.run(); }
textChanged
29,628
void (@NotNull GroovyScriptRunConfiguration configuration) { myScriptPathComponent.getComponent().setText(configuration.getScriptPath()); myCommonJavaParametersPanel.reset(configuration); myModulesComboBoxComponent.getComponent().setModules(configuration.getValidModules()); myModulesComboBoxComponent.getComponent().setSelectedModule(configuration.getConfigurationModule().getModule()); myJrePathEditor.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled()); myDebugCB.setSelected(configuration.isDebugEnabled()); myAddClasspathCB.setSelected(configuration.isAddClasspathToTheRunner()); }
resetEditorFrom
29,629
JComponent () { return myMainPanel; }
createEditor
29,630
JComponent () { return myAnchor; }
getAnchor
29,631
void (JComponent anchor) { myAnchor = anchor; myScriptPathComponent.setAnchor(anchor); myCommonJavaParametersPanel.setAnchor(anchor); myModulesComboBoxComponent.setAnchor(anchor); myJrePathEditor.setAnchor(anchor); }
setAnchor
29,632
String () { return GroovyBundle.message("script.runner.display.name"); }
getDisplayName
29,633
String () { return GroovyBundle.message("script.runner.description"); }
getConfigurationTypeDescription
29,634
Icon () { return JetgroovyIcons.Groovy.Groovy_16x16; }
getIcon
29,635
String () { return "GroovyScriptRunConfiguration"; }
getId
29,636
ConfigurationFactory () { return myConfigurationFactory; }
getConfigurationFactory
29,637
ConfigurationFactory[] () { return new ConfigurationFactory[]{myConfigurationFactory}; }
getConfigurationFactories
29,638
String () { return "reference.dialogs.rundebug.GroovyScriptRunConfiguration"; }
getHelpTopic
29,639
GroovyScriptRunConfigurationType () { return ConfigurationTypeUtil.findConfigurationType(GroovyScriptRunConfigurationType.class); }
getInstance
29,640
String () { return "Groovy"; }
getId
29,641
RunConfiguration (@NotNull Project project) { return new GroovyScriptRunConfiguration("Groovy Script", project, this); }
createTemplateConfiguration
29,642
String (PsiClass aClass, RunConfigurationModule module) { String qualifiedName = aClass.getQualifiedName(); Project project = module.getProject(); if (qualifiedName == null) { return module.getModuleName(); } PsiClass psiClass = JavaPsiFacade.getInstance(project).findClass(qualifiedName.replace('$', '.'), GlobalSearchScope.projectScope(project)); if (psiClass != null) { return psiClass.getName(); } else { int lastDot = qualifiedName.lastIndexOf('.'); if (lastDot == -1 || lastDot == qualifiedName.length() - 1) { return qualifiedName; } return qualifiedName.substring(lastDot + 1); } }
getConfigurationName
29,643
boolean (@NotNull Module module) { return LibrariesUtil.hasGroovySdk(module); }
isValidModule
29,644
void (final JavaParameters params, final VirtualFile scriptFile, Module module) { Charset charset = EncodingProjectManager.getInstance(module.getProject()).getEncoding(scriptFile, true); if (charset == null) { charset = EncodingManager.getInstance().getDefaultCharset(); if (!Comparing.equal(CharsetToolkit.getDefaultSystemCharset(), charset)) { params.getProgramParametersList().add("--encoding=" + charset.displayName()); } } else { params.getProgramParametersList().add("--encoding=" + charset.displayName()); } }
addScriptEncodingSettings
29,645
Icon () { return JetgroovyIcons.Groovy.GroovyFile; }
getScriptIcon
29,646
GroovyScriptRunner () { return new DefaultGroovyScriptRunner(); }
getRunner
29,647
boolean (@NotNull PsiFile file, GroovyScriptType scriptType) { if (!(file instanceof GroovyFile)) return false; if (!((GroovyFile)file).isScript()) return false; return isSpecificScriptFile((GroovyFile)file, scriptType); }
isSpecificScriptFile
29,648
boolean (@NotNull GroovyFile script, GroovyScriptType scriptType) { assert script.isScript(); if (scriptType == DEFAULT_TYPE) { return getScriptType(script) == DEFAULT_TYPE; } for (GroovyScriptTypeDetector detector : GroovyScriptTypeDetector.EP_NAME.getExtensions()) { if (detector.getScriptType() == scriptType) { if (detector.isSpecificScriptFile(script)) { return true; } } } return false; }
isSpecificScriptFile
29,649
GroovyRunnableScriptType (@NotNull GroovyFile script) { GroovyScriptType scriptType = GroovyScriptTypeDetector.getScriptType(script); return scriptType == null ? DEFAULT_TYPE : (GroovyRunnableScriptType)scriptType; }
getScriptType
29,650
boolean (@NotNull GroovyFile script) { return GroovyScriptTypeDetector.getScriptType(script) == null; }
isPlainGroovyScript
29,651
Module () { Module module = getConfigurationModule().getModule(); if (module != null) return module; return getFirstValidModule(); }
getModule
29,652
Module () { final GroovyScriptRunner scriptRunner = getScriptRunner(); Module[] modules = ModuleManager.getInstance(getProject()).getModules(); if (scriptRunner == null) { return modules[0]; } for (Module module : modules) { if (scriptRunner.isValidModule(module)) { return module; } } return null; }
getFirstValidModule
29,653
Collection<Module> () { Module[] modules = ModuleManager.getInstance(getProject()).getModules(); final GroovyScriptRunner scriptRunner = getScriptRunner(); if (scriptRunner == null) { return Arrays.asList(modules); } ArrayList<Module> res = new ArrayList<>(); for (Module module : modules) { if (scriptRunner.isValidModule(module)) { res.add(module); } } return res; }
getValidModules
29,654
GroovyScriptRunner () { final VirtualFile scriptFile = ScriptFileUtil.findScriptFileByPath(getScriptPath()); if (scriptFile == null) return null; final PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(scriptFile); if (!(psiFile instanceof GroovyFile groovyFile)) return null; if (groovyFile.isScript()) { return GroovyScriptUtil.getScriptType(groovyFile).getRunner(); } else { return new DefaultGroovyScriptRunner(); } }
getScriptRunner
29,655
void (@NotNull Element element) { super.readExternal(element); scriptPath = ExternalizablePath.localPathValue(JDOMExternalizer.readString(element, "path")); vmParams = JDOMExternalizer.readString(element, "vmparams"); scriptParams = JDOMExternalizer.readString(element, "params"); final String wrk = JDOMExternalizer.readString(element, "workDir"); if (!".".equals(wrk)) { workDir = ExternalizablePath.localPathValue(wrk); } isDebugEnabled = Boolean.parseBoolean(JDOMExternalizer.readString(element, "debug")); isAddClasspathToTheRunner = Boolean.parseBoolean(JDOMExternalizer.readString(element, "addClasspath")); envs.clear(); JDOMExternalizer.readMap(element, envs, null, "env"); myAlternativeJrePathEnabled = JDOMExternalizer.readBoolean(element, "alternativeJrePathEnabled"); myAlternativeJrePath = JDOMExternalizer.readString(element, "alternativeJrePath"); }
readExternal
29,656
RunProfileState (@NotNull Executor executor, @NotNull ExecutionEnvironment environment) { final VirtualFile scriptFile = ScriptFileUtil.findScriptFileByPath(getScriptPath()); if (scriptFile == null) return null; final GroovyScriptRunner scriptRunner = getScriptRunner(); if (scriptRunner == null) return null; return new JavaCommandLineState(environment) { @NotNull @Override protected OSProcessHandler startProcess() throws ExecutionException { final OSProcessHandler handler = super.startProcess(); handler.setShouldDestroyProcessRecursively(true); if (scriptRunner.shouldRefreshAfterFinish()) { handler.addProcessListener(new ProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { if (!ApplicationManager.getApplication().isDisposed()) { VirtualFileManager.getInstance().asyncRefresh(); } } }); } return handler; } @Override protected JavaParameters createJavaParameters() throws ExecutionException { final Module module = getModule(); final boolean tests = ProjectRootManager.getInstance(getProject()).getFileIndex().isInTestSourceContent(scriptFile); String jrePath = isAlternativeJrePathEnabled() ? getAlternativeJrePath() : null; JavaParameters params = new JavaParameters(); params.setUseClasspathJar(true); params.setDefaultCharset(getProject()); params.setJdk( module == null ? JavaParametersUtil.createProjectJdk(getProject(), jrePath) : JavaParametersUtil.createModuleJdk(module, !tests, jrePath) ); configureConfiguration(params, new CommonProgramRunConfigurationParametersDelegate(GroovyScriptRunConfiguration.this) { @Nullable @Override public String getProgramParameters() { return null; } }); scriptRunner.configureCommandLine(params, module, tests, scriptFile, GroovyScriptRunConfiguration.this); return params; } }; }
getState
29,657
void (@NotNull ProcessEvent event) { if (!ApplicationManager.getApplication().isDisposed()) { VirtualFileManager.getInstance().asyncRefresh(); } }
processTerminated
29,658
String () { return null; }
getProgramParameters
29,659
RefactoringElementListener (PsiElement element) { if (scriptPath == null || !scriptPath.equals(getPathByElement(element))) { return null; } final PsiClass classToRun = GroovyRunnerPsiUtil.getRunningClass(element); if (element instanceof GroovyFile) { return new RefactoringElementAdapter() { @Override protected void elementRenamedOrMoved(@NotNull PsiElement newElement) { if (newElement instanceof GroovyFile file) { setScriptPath(ScriptFileUtil.getScriptFilePath(file.getVirtualFile())); } } @Override public void undoElementMovedOrRenamed(@NotNull PsiElement newElement, @NotNull String oldQualifiedName) { elementRenamedOrMoved(newElement); } }; } else if (element instanceof PsiClass && element.getManager().areElementsEquivalent(element, classToRun)) { return new RefactoringElementAdapter() { @Override protected void elementRenamedOrMoved(@NotNull PsiElement newElement) { setName(((PsiClass)newElement).getName()); } @Override public void undoElementMovedOrRenamed(@NotNull PsiElement newElement, @NotNull String oldQualifiedName) { elementRenamedOrMoved(newElement); } }; } return null; }
getRefactoringElementListener
29,660
void (@NotNull PsiElement newElement) { if (newElement instanceof GroovyFile file) { setScriptPath(ScriptFileUtil.getScriptFilePath(file.getVirtualFile())); } }
elementRenamedOrMoved
29,661
void (@NotNull PsiElement newElement, @NotNull String oldQualifiedName) { elementRenamedOrMoved(newElement); }
undoElementMovedOrRenamed
29,662
void (@NotNull PsiElement newElement) { setName(((PsiClass)newElement).getName()); }
elementRenamedOrMoved
29,663
void (@NotNull PsiElement newElement, @NotNull String oldQualifiedName) { elementRenamedOrMoved(newElement); }
undoElementMovedOrRenamed
29,664
String (@NotNull PsiElement element) { PsiFile file = element.getContainingFile(); if (file == null) return null; VirtualFile vfile = file.getVirtualFile(); if (vfile == null) return null; return vfile.getPath(); }
getPathByElement
29,665
JavaParameters (@Nullable Module module) { JavaParameters params = new JavaParameters(); params.setCharset(null); if (module != null) { final Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) { params.setJdk(sdk); } } if (params.getJdk() == null) { params.setJdk(new SimpleJavaSdkType().createJdk("tmp", SystemProperties.getJavaHome())); } return params; }
createJavaParametersWithSdk
29,666
void (@Nullable String value) { vmParams = value; }
setVMParameters
29,667
String () { return vmParams; }
getVMParameters
29,668
boolean () { return myAlternativeJrePathEnabled; }
isAlternativeJrePathEnabled
29,669
void (boolean alternativeJrePathEnabled) { myAlternativeJrePathEnabled = alternativeJrePathEnabled; }
setAlternativeJrePathEnabled
29,670
String () { return myAlternativeJrePath; }
getAlternativeJrePath
29,671
void (@Nullable String alternativeJrePath) { myAlternativeJrePath = alternativeJrePath; }
setAlternativeJrePath
29,672
String () { return null; }
getRunClass
29,673
String () { return null; }
getPackage
29,674
void (@Nullable String value) { scriptParams = value; }
setProgramParameters
29,675
String () { return scriptParams; }
getProgramParameters
29,676
void (@Nullable String value) { workDir = value; }
setWorkingDirectory
29,677
String () { return workDir; }
getWorkingDirectory
29,678
void (@NotNull Map<String, String> envs) { this.envs.clear(); this.envs.putAll(envs); }
setEnvs
29,679
void (boolean passParentEnvs) { this.passParentEnv = passParentEnvs; }
setPassParentEnvs
29,680
boolean () { return passParentEnv; }
isPassParentEnvs
29,681
boolean () { return isDebugEnabled; }
isDebugEnabled
29,682
void (boolean debugEnabled) { isDebugEnabled = debugEnabled; }
setDebugEnabled
29,683
boolean () { return isAddClasspathToTheRunner; }
isAddClasspathToTheRunner
29,684
void (boolean addClasspathToTheRunner) { isAddClasspathToTheRunner = addClasspathToTheRunner; }
setAddClasspathToTheRunner
29,685
void (@Nullable String scriptPath) { this.scriptPath = scriptPath; }
setScriptPath
29,686
GlobalSearchScope () { GlobalSearchScope superScope = super.getSearchScope(); String path = getScriptPath(); if (path == null) return superScope; VirtualFile scriptFile = LocalFileSystem.getInstance().findFileByPath(path); if (scriptFile == null) return superScope; GlobalSearchScope fileScope = GlobalSearchScope.fileScope(getProject(), scriptFile); if (superScope == null) return fileScope; return new DelegatingGlobalSearchScope(fileScope.union(superScope)) { @Override public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) { if (file1.equals(scriptFile)) return 1; if (file2.equals(scriptFile)) return -1; return super.compare(file1, file2); } }; }
getSearchScope
29,687
int (@NotNull VirtualFile file1, @NotNull VirtualFile file2) { if (file1.equals(scriptFile)) return 1; if (file2.equals(scriptFile)) return -1; return super.compare(file1, file2); }
compare
29,688
boolean () { return false; }
shouldRefreshAfterFinish
29,689
String (final String groovyHomePath) { String confpath = FileUtil.toSystemDependentName(groovyHomePath + "/conf/groovy-starter.conf"); if (new File(confpath).exists()) { return confpath; } return null; }
getConfPath
29,690
String (String fileName) { try { final String jarPath = PathUtil.getJarPathForClass(GroovyLanguage.class); if (new File(jarPath).isFile()) { //jar; distribution mode return new File(jarPath, "../" + fileName).getCanonicalPath(); } //else, it's directory in out, development mode return new File(jarPath, "conf/" + fileName).getCanonicalPath(); } catch (IOException e) { throw new RuntimeException(e); } }
getPathInConf
29,691
void (JavaParameters params, @NotNull String groovyHome) { params.getVMParametersList().add("-Dgroovy.home=" + groovyHome); if (groovyHome.contains("grails")) { //a bit of a hack params.getVMParametersList().add("-Dgrails.home=" + groovyHome); } if (groovyHome.contains("griffon")) { //a bit of a hack params.getVMParametersList().add("-Dgriffon.home=" + groovyHome); } }
setGroovyHome
29,692
void (JavaParameters params) { Sdk jdk = params.getJdk(); if (jdk != null && jdk.getSdkType() instanceof JavaSdkType) { String toolsPath = ((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk); if (toolsPath != null) { params.getVMParametersList().add("-Dtools.jar=" + toolsPath); } } }
setToolsJar
29,693
VirtualFile (@NotNull Module module) { final VirtualFile[] files = OrderEnumerator.orderEntries(module).getAllLibrariesAndSdkClassesRoots(); for (VirtualFile root : files) { if (GroovyConfigUtils.GROOVY_JAR_PATTERN.matcher(root.getName()).matches() || GroovyConfigUtils.matchesGroovyAll(root.getName())) { return root; } } for (VirtualFile file : files) { if (file.getName().contains("groovy") && "jar".equals(file.getExtension())) { return file; } } return null; }
findGroovyJar
29,694
boolean (@NotNull String name, Project project) { return GroovyRefactoringUtil.KEYWORDS.contains(name); }
isKeyword
29,695
boolean (@NotNull String name, Project project) { return GroovyRefactoringUtil.isCorrectReferenceName(name, project); }
isIdentifier
29,696
void (@NotNull Consumer<LookupElement> consumer, @NotNull PrefixMatcher matcher) { GrCodeReferenceElement ref = myAnnotation.getClassReference(); PsiElement resolved = ref.resolve(); if (resolved instanceof PsiClass) { final PsiAnnotation annotationCollector = GrAnnotationCollector.findAnnotationCollector((PsiClass)resolved); if (annotationCollector != null) { final ArrayList<GrAnnotation> annotations = new ArrayList<>(); GrAnnotationCollector.collectAnnotations(annotations, myAnnotation, annotationCollector); Set<String> usedNames = new HashSet<>(); for (GrAnnotation annotation : annotations) { final PsiElement resolvedAliased = annotation.getClassReference().resolve(); if (resolvedAliased instanceof PsiClass && ((PsiClass)resolvedAliased).isAnnotationType()) { for (PsiMethod method : ((PsiClass)resolvedAliased).getMethods()) { if (usedNames.add(method.getName())) { for (LookupElement element : GroovyCompletionUtil .createLookupElements(new ElementResolveResult<>(method), false, matcher, null)) { consumer.consume(element); } } } } } } else if (((PsiClass)resolved).isAnnotationType()) { for (PsiMethod method : ((PsiClass)resolved).getMethods()) { for (LookupElement element : GroovyCompletionUtil .createLookupElements(new ElementResolveResult<>(method), false, matcher, null)) { consumer.consume(element); } } } } }
process
29,697
Set<String> (@NotNull GrReferenceExpression refExpr, @NotNull PrefixMatcher matcher, @Nullable GrExpression qualifier) { return new CompleteReferencesWithSameQualifier(refExpr, matcher, qualifier).getVariantsWithSameQualifierImpl(); }
getVariantsWithSameQualifier
29,698
Set<String> () { if (myQualifier != null && myQualifier.getType() != null) return Collections.emptySet(); final PsiElement scope = PsiTreeUtil.getParentOfType(myRefExpr, GrMember.class, PsiFile.class); Set<String> result = new LinkedHashSet<>(); if (scope != null) { addVariantsWithSameQualifier(scope, result); } return result; }
getVariantsWithSameQualifierImpl
29,699
void (@NotNull PsiElement element, @NotNull Set<String> result) { if (element instanceof GrReferenceExpression refExpr && element != myRefExpr && !PsiUtil.isLValue((GroovyPsiElement)element)) { final String refName = refExpr.getReferenceName(); if (refName != null && !result.contains(refName) && myMatcher.prefixMatches(refName)) { final GrExpression hisQualifier = refExpr.getQualifierExpression(); if (hisQualifier != null && myQualifier != null) { if (PsiEquivalenceUtil.areElementsEquivalent(hisQualifier, myQualifier)) { if (refExpr.resolve() == null) { result.add(refName); } } } else if (hisQualifier == null && myQualifier == null) { if (refExpr.resolve() == null) { result.add(refName); } } } } for (PsiElement child = element.getFirstChild(); child != null; child = child.getNextSibling()) { addVariantsWithSameQualifier(child, result); } }
addVariantsWithSameQualifier