Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
28,200
String () { return JavaByteCodeViewerBundle.message("show.bytecode.restore.popup.action.description"); }
getRestorePopupDescription
28,201
ByteCodeViewerComponent () { return new ByteCodeViewerComponent(myProject); }
createComponent
28,202
String (PsiElement element) { PsiClass aClass = getContainingClass(element); if (aClass == null) return null; return SymbolPresentationUtil.getSymbolPresentableText(aClass); }
getTitle
28,203
void (PsiElement element, ByteCodeViewerComponent component, Content content) { updateByteCode(element, -1, component, content, getByteCode(element)); }
updateByteCode
28,204
void (PsiElement element, int lineNumber, ByteCodeViewerComponent component, Content content, String byteCode) { if (!StringUtil.isEmpty(byteCode)) { component.setText(byteCode, element, lineNumber); } else { PsiElement presentableElement = getContainingClass(element); if (presentableElement == null) { presentableElement = element.getContainingFile(); if (presentableElement == null && element instanceof PsiNamedElement) { presentableElement = element; } if (presentableElement == null) { component.setText(JavaByteCodeViewerBundle.message("no.bytecode.found")); return; } } component.setText( JavaByteCodeViewerBundle.message("no.bytecode.found.for", SymbolPresentationUtil.getSymbolPresentableText(presentableElement))); } content.setDisplayName(getTitle(element)); }
updateByteCode
28,205
void (@NotNull PsiElement element, PsiElement originalElement, ByteCodeViewerComponent component) { Content content = myToolWindow.getContentManager().getSelectedContent(); if (content != null) { updateByteCode(element, component, content); } }
doUpdateComponent
28,206
void (Editor editor, PsiFile psiFile) { Content content = myToolWindow.getContentManager().getSelectedContent(); if (content == null) { return; } ByteCodeViewerComponent component = (ByteCodeViewerComponent)content.getComponent(); PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset()); if (element != null) { updateByteCode(element, component, content); } }
doUpdateComponent
28,207
void (@NotNull PsiElement element) { doUpdateComponent(element, -1, getByteCode(element)); }
doUpdateComponent
28,208
String (@NotNull PsiElement psiElement) { PsiClass containingClass = getContainingClass(psiElement); if (containingClass != null) { try { byte[] bytes = loadClassFileBytes(containingClass); if (bytes != null) { StringWriter writer = new StringWriter(); try (PrintWriter printWriter = new PrintWriter(writer)) { new ClassReader(bytes).accept(new TraceClassVisitor(null, new Textifier(), printWriter), 0); } return writer.toString(); } } catch (IOException e) { LOG.error(e); } } return null; }
getByteCode
28,209
String (PsiClass aClass) { if (!(aClass instanceof PsiAnonymousClass)) { return ClassUtil.getJVMClassName(aClass); } PsiClass containingClass = PsiTreeUtil.getParentOfType(aClass, PsiClass.class); if (containingClass != null) { return getJVMClassName(containingClass) + JavaAnonymousClassesHelper.getName((PsiAnonymousClass)aClass); } return null; }
getJVMClassName
28,210
PsiClass (@NotNull PsiElement psiElement) { for (ClassSearcher searcher : CLASS_SEARCHER_EP.getExtensionList()) { PsiClass aClass = searcher.findClass(psiElement); if (aClass != null) { return aClass; } } PsiClass containingClass = PsiTreeUtil.getParentOfType(psiElement, PsiClass.class, false); while (containingClass instanceof PsiTypeParameter) { containingClass = PsiTreeUtil.getParentOfType(containingClass, PsiClass.class); } if (containingClass == null) { PsiFile containingFile = psiElement.getContainingFile(); if (containingFile instanceof PsiClassOwner) { TextRange textRange = psiElement.getTextRange(); PsiClass result = null; Queue<PsiClass> queue = new ArrayDeque<>(Arrays.asList(((PsiClassOwner)containingFile).getClasses())); while (!queue.isEmpty()) { PsiClass c = queue.remove(); PsiElement navigationElement = c.getNavigationElement(); TextRange classRange = navigationElement != null ? navigationElement.getTextRange() : null; if (classRange != null && classRange.contains(textRange)) { result = c; queue.clear(); queue.addAll(Arrays.asList(c.getInnerClasses())); } } return result; } return null; } return containingClass; }
getContainingClass
28,211
void (final String bytecode) { setText(bytecode, 0); }
setText
28,212
void (@NonNls final String bytecode, PsiElement element, int lineNumber) { int offset = -1; VirtualFile file = PsiUtilCore.getVirtualFile(element); if (file != null) { final Document document = FileDocumentManager.getInstance().getDocument(file); if (document != null) { if (lineNumber == -1) { lineNumber = document.getLineNumber(element.getTextOffset()); } // Use 1-based line numbers from here: lineNumber++; LineNumbersMapping mapping = file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY); if (mapping != null) { for (int l = lineNumber; l <= document.getLineCount(); l++) { int bytecodeLine = mapping.sourceToBytecode(l); if (bytecodeLine != -1) { offset = findLineNumber(bytecode, bytecodeLine); assert offset != -1 : "there is bytecode line in mapping but it is missing in bytecode"; break; } } } else { for (int l = lineNumber; l <= document.getLineCount(); l++) { offset = findLineNumber(bytecode, l); if (offset != -1) { break; } } } } } setText(bytecode, Math.max(0, offset)); }
setText
28,213
int (@NonNls String bytecode, int l) { int idx = bytecode.indexOf("\n LINENUMBER " + l + " "); if (idx != -1) { // shift by one to skip '\n' return idx + 1; } else { return -1; } }
findLineNumber
28,214
void (final String bytecode, final int offset) { DocumentUtil.writeInRunUndoTransparentAction(() -> { Document fragmentDoc = myEditor.getDocument(); fragmentDoc.setReadOnly(false); try { fragmentDoc.replaceString(0, fragmentDoc.getTextLength(), bytecode); } finally { fragmentDoc.setReadOnly(true); } myEditor.getCaretModel().moveToOffset(offset); myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); }); }
setText
28,215
String () { return myEditor.getDocument().getText(); }
getText
28,216
JComponent () { return myEditor.getContentComponent(); }
getEditorComponent
28,217
void () { EditorFactory.getInstance().releaseEditor(myEditor); }
dispose
28,218
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
28,219
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(false); e.getPresentation().setIcon(AllIcons.Actions.Preview); final Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { final PsiElement psiElement = getPsiElement(e.getDataContext(), project, e.getData(CommonDataKeys.EDITOR)); if (psiElement != null) { if (psiElement.getContainingFile() instanceof PsiClassOwner) { e.getPresentation().setEnabled(true); } } } }
update
28,220
void (@NotNull AnActionEvent e) { final DataContext dataContext = e.getDataContext(); final Project project = e.getProject(); if (project == null) return; final Editor editor = e.getData(CommonDataKeys.EDITOR); final PsiElement psiElement = getPsiElement(dataContext, project, editor); if (psiElement == null) return; // Some PSI elements could be multiline. Try to be precise about the line we were invoked at. int lineNumber = editor != null ? editor.getCaretModel().getLogicalPosition().line : -1; if (ByteCodeViewerManager.getContainingClass(psiElement) == null) { Messages.showWarningDialog(project, JavaByteCodeViewerBundle.message("bytecode.class.in.selection.message"), JavaByteCodeViewerBundle.message("bytecode.not.found.message")); return; } final String psiElementTitle = ByteCodeViewerManager.getInstance(project).getTitle(psiElement); final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(psiElement); if (virtualFile == null) return; final RelativePoint bestPopupLocation = JBPopupFactory.getInstance().guessBestPopupLocation(dataContext); final SmartPsiElementPointer element = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement); ProgressManager.getInstance().run(new Task.Backgroundable(project, JavaByteCodeViewerBundle.message("looking.for.bytecode.progress")) { private String myByteCode; private @Nls String myErrorTitle; @Override public void run(@NotNull ProgressIndicator indicator) { if (ReadAction.compute(() -> ProjectRootManager.getInstance(project).getFileIndex().isInContent(virtualFile)) && isMarkedForCompilation(project, virtualFile)) { myErrorTitle = JavaByteCodeViewerBundle.message("class.file.may.be.out.of.date"); } myByteCode = ReadAction.compute(() -> { PsiElement targetElement = element.getElement(); return targetElement != null ? ByteCodeViewerManager.getByteCode(targetElement) : null; }); } @Override public void onSuccess() { if (project.isDisposed()) return; final PsiElement targetElement = element.getElement(); if (targetElement == null) return; final ByteCodeViewerManager codeViewerManager = ByteCodeViewerManager.getInstance(project); if (codeViewerManager.hasActiveDockedDocWindow()) { codeViewerManager.doUpdateComponent(targetElement, lineNumber, myByteCode); } else { if (myByteCode == null) { Messages.showErrorDialog(project, JavaByteCodeViewerBundle.message("bytecode.parser.failure.message", psiElementTitle), JavaByteCodeViewerBundle.message("bytecode.not.found.title")); return; } final ByteCodeViewerComponent component = new ByteCodeViewerComponent(project); component.setText(myByteCode, targetElement, lineNumber); Processor<JBPopup> pinCallback = popup -> { codeViewerManager.recreateToolWindow(targetElement, targetElement); popup.cancel(); return false; }; if (myErrorTitle != null) { JLabel errorLabel = new JLabel(myErrorTitle); Color color = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.NOTIFICATION_BACKGROUND); if (color != null) { errorLabel.setBorder(new JBEmptyBorder(2)); errorLabel.setBackground(color); errorLabel.setOpaque(true); } component.add(errorLabel, BorderLayout.NORTH); } final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(component, component.getEditorComponent()) .setProject(project) .setDimensionServiceKey(project, ShowByteCodeAction.class.getName(), false) .setResizable(true) .setMovable(true) .setRequestFocus(LookupManager.getActiveLookup(editor) == null) .setTitle(JavaByteCodeViewerBundle.message("popup.title.element.bytecode", psiElementTitle)) .setCouldPin(pinCallback) .createPopup(); Disposer.register(popup, component); if (editor != null) { popup.showInBestPositionFor(editor); } else { popup.show(bestPopupLocation); } } } }); }
actionPerformed
28,221
void (@NotNull ProgressIndicator indicator) { if (ReadAction.compute(() -> ProjectRootManager.getInstance(project).getFileIndex().isInContent(virtualFile)) && isMarkedForCompilation(project, virtualFile)) { myErrorTitle = JavaByteCodeViewerBundle.message("class.file.may.be.out.of.date"); } myByteCode = ReadAction.compute(() -> { PsiElement targetElement = element.getElement(); return targetElement != null ? ByteCodeViewerManager.getByteCode(targetElement) : null; }); }
run
28,222
void () { if (project.isDisposed()) return; final PsiElement targetElement = element.getElement(); if (targetElement == null) return; final ByteCodeViewerManager codeViewerManager = ByteCodeViewerManager.getInstance(project); if (codeViewerManager.hasActiveDockedDocWindow()) { codeViewerManager.doUpdateComponent(targetElement, lineNumber, myByteCode); } else { if (myByteCode == null) { Messages.showErrorDialog(project, JavaByteCodeViewerBundle.message("bytecode.parser.failure.message", psiElementTitle), JavaByteCodeViewerBundle.message("bytecode.not.found.title")); return; } final ByteCodeViewerComponent component = new ByteCodeViewerComponent(project); component.setText(myByteCode, targetElement, lineNumber); Processor<JBPopup> pinCallback = popup -> { codeViewerManager.recreateToolWindow(targetElement, targetElement); popup.cancel(); return false; }; if (myErrorTitle != null) { JLabel errorLabel = new JLabel(myErrorTitle); Color color = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.NOTIFICATION_BACKGROUND); if (color != null) { errorLabel.setBorder(new JBEmptyBorder(2)); errorLabel.setBackground(color); errorLabel.setOpaque(true); } component.add(errorLabel, BorderLayout.NORTH); } final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(component, component.getEditorComponent()) .setProject(project) .setDimensionServiceKey(project, ShowByteCodeAction.class.getName(), false) .setResizable(true) .setMovable(true) .setRequestFocus(LookupManager.getActiveLookup(editor) == null) .setTitle(JavaByteCodeViewerBundle.message("popup.title.element.bytecode", psiElementTitle)) .setCouldPin(pinCallback) .createPopup(); Disposer.register(popup, component); if (editor != null) { popup.showInBestPositionFor(editor); } else { popup.show(bestPopupLocation); } } }
onSuccess
28,223
boolean (Project project, VirtualFile virtualFile) { final CompilerManager compilerManager = CompilerManager.getInstance(project); return !compilerManager.isUpToDate(compilerManager.createFilesCompileScope(new VirtualFile[]{virtualFile})); }
isMarkedForCompilation
28,224
PsiElement (DataContext dataContext, Project project, @Nullable Editor editor) { PsiElement psiElement; if (editor == null) { psiElement = dataContext.getData(CommonDataKeys.PSI_ELEMENT); } else { final PsiFile file = PsiUtilBase.getPsiFileInEditor(editor, project); final Editor injectedEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file); psiElement = findElementInFile(PsiUtilBase.getPsiFileInEditor(injectedEditor, project), injectedEditor); if (file != null && psiElement == null) { psiElement = findElementInFile(file, editor); } } return psiElement; }
getPsiElement
28,225
PsiElement (@Nullable PsiFile psiFile, @NotNull Editor editor) { return psiFile != null ? psiFile.findElementAt(editor.getCaretModel().getOffset()) : null; }
findElementInFile
28,226
Statement (final Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { getTestCase().setUp(); try { EdtTestUtil.runInEdtAndWait(() -> base.evaluate()); } finally { getTestCase().tearDown(); } } }; }
apply
28,227
LightGroovyTestCase () { return testCase; }
getTestCase
28,228
LightProjectDescriptor () { return projectDescriptor; }
getProjectDescriptor
28,229
void (LightProjectDescriptor projectDescriptor) { this.projectDescriptor = projectDescriptor; }
setProjectDescriptor
28,230
String () { return TestUtils.getTestDataPath() + "goto/"; }
getBasePath
28,231
void (Condition<PsiElement> verifier) { doTest(verifier, getTestName(false) + ".groovy"); }
doTest
28,232
void (Condition<PsiElement> verifier, String... files) { for (String file : files) { myFixture.configureByFile(file); } final TargetElementUtil targetUtil = TargetElementUtil.getInstance(); final PsiElement target = TargetElementUtil.findTargetElement(myFixture.getEditor(), targetUtil.getReferenceSearchFlags()); assertTrue(verifier.value(target)); }
doTest
28,233
void () { doTest(element -> element instanceof GrMethod && ((GrMethod)element).isConstructor() && ((GrMethod)element).getParameters().length == 0); }
testNewExpression
28,234
void () { doTest(element -> element instanceof PsiClass); }
testNewExpressionWithNamedArgs
28,235
void () { doTest(element -> element instanceof GrMethod && ((GrMethod)element).isConstructor() && ((GrMethod)element).getParameters().length == 1); }
testNewExpressionWithMapParameter
28,236
void () { doTest(element -> element instanceof GrMethod && ((GrMethod)element).isConstructor() && ((GrMethod)element).getParameters().length == 2); }
testNewExpressionWithAnonymousClass
28,237
void () { doTest(element -> element instanceof GrParameter && ((GrParameter)element).getName().equals("x")); }
testGroovyDocParameter1
28,238
void () { doTest(element -> element instanceof GrParameter && ((GrParameter)element).getName().equals("x")); }
testGroovyDocParameter2
28,239
void () { doTest(element -> element instanceof PsiMethod && "p2.MyClass".equals(((PsiMethod)element).getContainingClass().getQualifiedName()), "p/MyClass.groovy", "p2/MyClass.groovy"); }
testConstructorWithSuperClassSameName
28,240
void () { doTestForSelectWord(1); }
testSelectWordBeforeMethod
28,241
void () { doTestSelectWordUpTo(5); }
testSWInGString
28,242
void () { doTestForSelectWord(2, """ print ""\" asddf as<caret>df $b sfsasdf fdsas ""\" """, """ print ""\" asddf <selection>as<caret>df $b sfsasdf</selection> fdsas ""\" """); }
test_select_word_in_GString_select_line_before_injection
28,243
void () { doTestForSelectWord(2, """ print ""\" asddf asdf $b sfs<caret>asdf fdsas ""\" """, """ print ""\" asddf <selection>asdf $b sfs<caret>asdf</selection> fdsas ""\" """); }
test_select_word_in_GString_select_line_after_injection
28,244
void () { doTestForSelectWord(2, """ print ""\" asddf asdf $b sfsasdf fd<caret>sas fsss""\" """, """ print ""\" asddf asdf $b sfsasdf <selection>fd<caret>sas fsss</selection>""\" """); }
test_select_word_in_GString_select_line_before_end
28,245
void () { doTestSelectWordUpTo(4); }
testSWInGStringMultiline
28,246
void () { doTestSelectWordUpTo(2); }
testSWInGStringBegin
28,247
void () { doTestSelectWordUpTo(2); }
testSWInGStringEnd
28,248
void () { doTestForSelectWord(3); }
testSWInParameterList
28,249
void () { doTestForSelectWord(2); }
testSWInArgLabel1
28,250
void () { doTestForSelectWord(2); }
testSWInArgLabel2
28,251
void () { doTestForSelectWord(2); }
testSWInArgLabel3
28,252
void () { doTestForSelectWord(1, "String s = \"abc\\nd<caret>ef\"", "String s = \"abc\\n<selection>d<caret>ef</selection>\""); }
testSWEscapesInString
28,253
void () { doTestForSelectWord(2, "foo([a<caret>], b)", "foo(<selection>[a<caret>]</selection>, b)"); }
testSWListLiteralArgument
28,254
void () { doTestForSelectWord(2, "a.fo<caret>o(b)", "a.<selection>foo(b)</selection>"); }
testSWMethodParametersBeforeQualifier
28,255
void () { doTestForSelectWord(5); }
testSWInCodeBlock
28,256
void () { doTestForSelectWord(3, """ def foo() { if (a){ } else <caret>{ } } """, """ def foo() { if (a){ } <selection> else <caret>{ } </selection>} """); }
testElseBranch
28,257
void () { doTestForSelectWord(8, """ this.allOptions = [:]; confTag.option.each{ opt -> def value = opt.'@value'; if (value == null) { value = opt.value ? opt.value[0].'@defaultName' : null; } this.allOptions[opt.'@name'] = value; } def moduleNode = confTag.mod<caret>ule[0] ; if (moduleNode != null && !"wholeProject".equals(this.allOptions['TEST_SEARCH_SCOPE'])) { this.moduleRef = JpsElementFactory.instance.createModuleReference(moduleNode.'@name'); } else { this.moduleRef = null; } this.macroExpander = macroExpander; """, """ this.allOptions = [:]; confTag.option.each{ opt -> def value = opt.'@value'; if (value == null) { value = opt.value ? opt.value[0].'@defaultName' : null; } this.allOptions[opt.'@name'] = value; } <selection> def moduleNode = confTag.mod<caret>ule[0] ; if (moduleNode != null && !"wholeProject".equals(this.allOptions['TEST_SEARCH_SCOPE'])) { this.moduleRef = JpsElementFactory.instance.createModuleReference(moduleNode.'@name'); } else { this.moduleRef = null; } </selection> this.macroExpander = macroExpander; """); }
testBlocksOfCode
28,258
void () { String text = """ class A { /** long<caret> */ void longName() {} void example() {} } """; myFixture.configureByText("a.groovy", text); performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION); assert myFixture.getEditor().getDocument().getText().contains("** longName\n"); performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION); myFixture.checkResult(text); }
test_hippie_completion_in_groovydoc
28,259
void () { myFixture.configureByText("a.groovy", """ foo = [ helloWorld: 1, "hello-world": { hw<caret> f } ]"""); performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION); assert myFixture.getEditor().getDocument().getText().contains(" hello-world\n"); performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION); assert myFixture.getEditor().getDocument().getText().contains(" helloWorld\n"); myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getEditor().getDocument().getText().indexOf(" f") + 2); performEditorAction(IdeActions.ACTION_HIPPIE_COMPLETION); assert myFixture.getEditor().getDocument().getText().contains(" foo\n"); }
test_hippie_completion_with_hyphenated_match
28,260
void () { doTestForSelectWord(4, """ class A { /** * abc */ def fo<caret>o() {} def bar(){} } """, """ class A { <selection> /** * abc */ def fo<caret>o() {} </selection> def bar(){} } """); }
testSWforMemberWithDoc
28,261
void () { doTestForSelectWord(2, """ print ''' abc cde xyz <caret>ahc ''' """, """ print ''' <selection> abc cde xyz <caret>ahc </selection> ''' """); doTestForSelectWord(3, """ print ''' abc cde xyz <caret>ahc ''' """, """ print '''<selection> abc cde xyz <caret>ahc </selection>''' """); }
testMultiLineStingSelection
28,262
void (int count, String input, String expected) { myFixture.configureByText("a.groovy", input); selectWord(count); myFixture.checkResult(expected); }
doTestForSelectWord
28,263
void (int count) { myFixture.configureByFile(getTestName(false) + ".groovy"); selectWord(count); myFixture.checkResultByFile(getTestName(false) + "_after.groovy"); }
doTestForSelectWord
28,264
void (int count) { final String testName = getTestName(false); myFixture.configureByFile(testName + "_0.groovy"); myFixture.getEditor().getSettings().setCamelWords(true); for (int i = 0; i < count; i++) { performEditorAction(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET); myFixture.checkResultByFile(testName + "_" + (i + 1) + ".groovy"); } }
doTestSelectWordUpTo
28,265
void (int count) { myFixture.getEditor().getSettings().setCamelWords(true); for (int i = 0; i < count; i++) { performEditorAction(IdeActions.ACTION_EDITOR_SELECT_WORD_AT_CARET); } }
selectWord
28,266
void (final String actionId) { myFixture.performEditorAction(actionId); }
performEditorAction
28,267
String () { return basePath; }
getBasePath
28,268
void (@NotNull Module module, @NotNull ModifiableRootModel model) { for (TestLibrary library : myLibraries) { library.addTo(module, model); } }
addTo
28,269
void () { myFixture.configureByText("Demo.groovy", """ class Demo { static void main(String[] args) { def doubleQuotes = "http://double:8080/app" def singleQuotes = 'http://single:8080/app' def multilineSingle = ''' https://multiline-single:8080/app ''' def multilineDouble = ""\" http://multiline-double:8080/app ""\" } } """); InjectionTestFixtureKt.assertInjectedReference(myFixture, WebReference.class, "http://double:8080/app"); InjectionTestFixtureKt.assertInjectedReference(myFixture, WebReference.class, "http://single:8080/app"); InjectionTestFixtureKt.assertInjectedReference(myFixture, WebReference.class, "https://multiline-single:8080/app"); InjectionTestFixtureKt.assertInjectedReference(myFixture, WebReference.class, "http://multiline-double:8080/app"); }
test_web_reference_in_strings
28,270
void (String[] args) { def doubleQuotes = "http://double:8080/app" def singleQuotes = 'http://single:8080/app' def multilineSingle = ''' https://multiline-single:8080/app ''' def multilineDouble = ""\" http://multiline-double:8080/app ""\" }
main
28,271
LightProjectDescriptor () { return GroovyProjectDescriptors.GROOVY_LATEST; }
getProjectDescriptor
28,272
void (@NotNull Module module, @NotNull ModifiableRootModel model) { final LibraryTable.ModifiableModel tableModel = model.getModuleLibraryTable().getModifiableModel(); Library library = tableModel.createLibrary(myCoordinates[0]); final Library.ModifiableModel libraryModel = library.getModifiableModel(); for (String coordinates : myCoordinates) { Collection<OrderRoot> roots = loadRoots(module.getProject(), coordinates); for (OrderRoot root : roots) { libraryModel.addRoot(root.getFile(), root.getType()); } } WriteAction.runAndWait(() -> { libraryModel.commit(); tableModel.commit(); }); model.findLibraryOrderEntry(library).setScope(myDependencyScope); }
addTo
28,273
Collection<OrderRoot> (Project project, String coordinates) { RepositoryLibraryProperties libraryProperties = new RepositoryLibraryProperties(coordinates, true); Collection<OrderRoot> roots = JarRepositoryManager.loadDependenciesModal(project, libraryProperties, false, false, null, getRemoteRepositoryDescriptions()); assert !roots.isEmpty(); return roots; }
loadRoots
28,274
List<RemoteRepositoryDescription> () { return ContainerUtil.map(IntelliJProjectConfiguration.getRemoteRepositoryDescriptions(), repository -> { return new RemoteRepositoryDescription(repository.getId(), repository.getName(), repository.getUrl()); }); }
getRemoteRepositoryDescriptions
28,275
void () { doTest(); }
testAssign
28,276
void () { doTest(); }
testClosure
28,277
void () { doTest(); }
testClosure1
28,278
void () { doTest(); }
testEm1
28,279
void () { doTest(); }
testEm2
28,280
void () { doTest(); }
testEm3
28,281
void () { doTest(); }
testIf1
28,282
void () { doTest(); }
testInner
28,283
void () { doTest(); }
testLocal1
28,284
void () { doTest(); }
testLocal2
28,285
void () { doTest(); }
testSimpl1
28,286
void () { doTest(); }
testSimpl2
28,287
void () { doTest(); }
testSimpl3
28,288
void () { doTest(); }
testWhile1
28,289
void () { final List<String> data = TestUtils.readInput(getTestDataPath() + getTestName(true) + ".test"); String text = data.get(0); myFixture.configureByText(GroovyFileType.GROOVY_FILE_TYPE, text); int selStart = myFixture.getEditor().getSelectionModel().getSelectionStart(); int selEnd = myFixture.getEditor().getSelectionModel().getSelectionEnd(); final GroovyFile file = (GroovyFile)myFixture.getFile(); final PsiElement start = file.findElementAt(selStart); final PsiElement end = file.findElementAt(selEnd - 1); final GrControlFlowOwner owner = PsiTreeUtil.getParentOfType(PsiTreeUtil.findCommonParent(start, end), GrControlFlowOwner.class, false); assert owner != null; GrStatement firstStatement = getStatement(start, owner); GrStatement lastStatement = getStatement(end, owner); final GrControlFlowOwner flowOwner = ControlFlowUtils.findControlFlowOwner(firstStatement); final GroovyControlFlow flow = ControlFlowBuilder.buildControlFlow(flowOwner, GrAllVarsInitializedPolicy.getInstance()); final FragmentVariableInfos fragmentVariableInfos = ReachingDefinitionsCollector.obtainVariableFlowInformation(firstStatement, lastStatement, flowOwner, flow); TestCase.assertEquals(data.get(1), dumpInfo(fragmentVariableInfos).trim()); }
doTest
28,290
String (FragmentVariableInfos fragmentVariableInfos) { StringBuilder builder = new StringBuilder(); builder.append("input:\n"); for (VariableInfo info : fragmentVariableInfos.getInputVariableNames()) { builder.append(info.getName()).append("\n"); } builder.append("output:\n"); for (VariableInfo info : fragmentVariableInfos.getOutputVariableNames()) { builder.append(info.getName()).append("\n"); } return builder.toString(); }
dumpInfo
28,291
GrStatement (@NotNull PsiElement element, PsiElement context) { while (!element.getParent().equals(context)) { element = element.getParent(); assertNotNull(element); } return (GrStatement)element; }
getStatement
28,292
String () { return basePath; }
getBasePath
28,293
void (String basePath) { this.basePath = basePath; }
setBasePath
28,294
Sdk () { return JavaSdk.getInstance().createJdk("TEST_JDK", IdeaTestUtil.requireRealJdkHome(), false); }
getSdk
28,295
Sdk () { return JavaSdk.getInstance().createJdk("TEST_JDK", IdeaTestUtil.requireRealJdkHome(), false); }
getSdk
28,296
Sdk () { return JavaSdk.getInstance().createJdk("TEST_JDK", IdeaTestUtil.requireRealJdkHome(), false); }
getSdk
28,297
Sdk () { return JavaSdk.getInstance().createJdk("TEST_JDK", IdeaTestUtil.requireRealJdkHome(), false); }
getSdk
28,298
JavaCodeInsightTestFixture () { return myFixture; }
getFixture
28,299
LightProjectDescriptor () { return GroovyProjectDescriptors.GROOVY_2_1; }
getProjectDescriptor