Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
268,800
void (@NotNull VirtualFile file) { Document document = FileDocumentManager.getInstance().getDocument(file); assertEquals(UNFORMATTED_SAMPLE, document.getText()); }
assertUnformatted
268,801
void (boolean optimizeImports, boolean rearrangeCode) { final PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(getOrCreateProjectBaseDir()); ReformatCodeAction.reformatDirectory( getProject(), psiDirectory, new DirectoryFormattingOptions() { @Override public boolean isIncludeSubdirectories() ...
formatProjectFiles
268,802
boolean () { return true; }
isIncludeSubdirectories
268,803
String () { return null; }
getFileTypeMask
268,804
SearchScope () { return null; }
getSearchScope
268,805
TextRangeType () { return TextRangeType.WHOLE_FILE; }
getTextRangeType
268,806
boolean () { return optimizeImports; }
isOptimizeImports
268,807
boolean () { return rearrangeCode; }
isRearrangeCode
268,808
void () { String sample = " "; IndentData data = IndentData.createFrom(sample, 0, sample.length(), 4); assertEquals(9, data.getTotalSpaces()); assertEquals(9, data.getIndentSpaces()); assertEquals(0, data.getSpaces()); }
testCreateFromSpaces
268,809
void () { String sample = "\t\t "; IndentData data = IndentData.createFrom(sample, 0, sample.length(), 4); assertEquals(11, data.getTotalSpaces()); assertEquals(8, data.getIndentSpaces()); assertEquals(3, data.getSpaces()); }
testCreateFromTabsAndSpaces
268,810
void () { String sample = "\t\t \t "; // -->|-->|ss>|ss IndentData data = IndentData.createFrom(sample, 0, sample.length(), 4); assertEquals(14, data.getTotalSpaces()); assertEquals(8, data.getIndentSpaces()); assertEquals(6, data.getSpaces()); // we assume spaces always start // the alignment even if there are tabs af...
testCreateFromTabsAndSpaces1
268,811
String () { return "../../../platform/platform-tests/testData/codeStyle/formatter/service"; }
getBasePath
268,812
String () { return "txt"; }
getFileExtension
268,813
void (@NotNull Document document, @NotNull List<TextRange> formattingRanges, @NotNull FormattingContext formattingContext, boolean canChangeWhiteSpaceOnly, boolean quickFormat) { for (TextRange range : formattingRanges) { document.replaceString( range.getStartOffset(), range.getEndOffset(), getFormatted( document.getCh...
formatDocument
268,814
Set<Feature> () { return FEATURES; }
getFeatures
268,815
boolean (@NotNull PsiFile file) { return true; }
canFormat
268,816
String (@NotNull CharSequence chars) { StringBuilder replacement = new StringBuilder(); for (int i = 0; i < chars.length(); i ++) { char c = chars.charAt(i); replacement.append(c == ' ' || c == '\n' || c == '\r' ? c : '*'); } return replacement.toString(); }
getFormatted
268,817
boolean () { return false; }
cancel
268,818
void () { String documentText = formattingRequest.getDocumentText(); new Thread(() -> { String formatted = getFormatted(documentText); formattingRequest.onTextReady(formatted); }, "AsyncFormat").start(); }
run
268,819
String () { return "Test group"; }
getNotificationGroupId
268,820
String () { return "AsyncFormat"; }
getName
268,821
Set<Feature> () { return EnumSet.of(Feature.AD_HOC_FORMATTING, Feature.FORMAT_FRAGMENTS); }
getFeatures
268,822
boolean (@NotNull PsiFile file) { return true; }
canFormat
268,823
boolean (@NotNull TransientCodeStyleSettings settings, @NotNull PsiFile file) { if (myFileName.equals(file.getName())) { mySettingsConsumer.accept(settings); return true; } return false; }
modifySettings
268,824
String () { return "Mock Code Style Modifier"; }
getName
268,825
CodeStyleStatusBarUIContributor (@NotNull TransientCodeStyleSettings transientSettings) { return null; }
getStatusBarUiContributor
268,826
void () { GlobPatternDescriptor entry = new GlobPatternDescriptor("*.java"); assertTrue(entry.matches(createFile("src/test.java"))); assertFalse(entry.matches(createFile("src/test.txt"))); assertTrue(entry.matches(createFile("file3.java"))); }
testSimpleFileMask
268,827
void () { GlobPatternDescriptor entry = new GlobPatternDescriptor("/src/*.java"); assertTrue(entry.matches(createFile("src/test.java"))); assertFalse(entry.matches(createFile("src/test.txt"))); assertFalse(entry.matches(createFile("file3.java"))); }
testFileMaskWithDir
268,828
void () { GlobPatternDescriptor entry = new GlobPatternDescriptor("/src/**/test/*.java"); // Fails, why??? assertTrue(entry.matches(createFile("src/test/file1.java"))); assertTrue(entry.matches(createFile("src/dir1/test/file1.java"))); assertTrue(entry.matches(createFile("src/dir1/dir2/test/file1.java"))); assertFalse(...
testExtendedDirSpec
268,829
void () { GlobPatternDescriptor entry = new GlobPatternDescriptor("/test-??/**/test?.java"); assertFalse(entry.matches(createFile("test-1/test2.java"))); // Fails, why??? assertTrue(entry.matches(createFile("test-12/test3.java"))); assertTrue(entry.matches(createFile("test-12/test/testa.java"))); }
testAnyCharMarks
268,830
void () { GlobPatternDescriptor entry = new GlobPatternDescriptor("test/*.java"); assertTrue(entry.matches(createFile("src/test/file1.java"))); assertTrue(entry.matches(createFile("test/file2.java"))); assertTrue(entry.matches(createFile("a/b/c/d/test/file3.java"))); }
testRelativeDirTest
268,831
void () { TestProductivityFeatureProvider provider = ProductivityFeaturesProvider.EP_NAME.findExtension(TestProductivityFeatureProvider.class); final FeatureDescriptor featureDescriptor = myRegistry.getFeatureDescriptor(TestProductivityFeatureProvider.tipId); assertNotNull("App: "+ApplicationManager.getApplication()+";...
testAddFeature
268,832
void () { final GroupDescriptor groupDescriptor = myRegistry.getGroupDescriptor(TestProductivityFeatureProvider.groupId); assertNotNull(groupDescriptor); assertEquals("test", groupDescriptor.getDisplayName()); }
testAddGroup
268,833
void () { myTracker.triggerFeatureUsed(TestProductivityFeatureProvider.tipId); final FeatureDescriptor featureDescriptor = myRegistry.getFeatureDescriptor(TestProductivityFeatureProvider.tipId); assertEquals(1, featureDescriptor.getUsageCount()); }
testTriggerFeatureUsed
268,834
void () { myTracker.triggerFeatureShown(TestProductivityFeatureProvider.tipId); final FeatureDescriptor featureDescriptor = myRegistry.getFeatureDescriptor(TestProductivityFeatureProvider.tipId); assertEquals(1, featureDescriptor.getShownCount()); }
testTriggerFeatureShow
268,835
void () { long current = System.currentTimeMillis(); myTracker.triggerFeatureUsed(TestProductivityFeatureProvider.tipId); final FeatureDescriptor featureDescriptor = myRegistry.getFeatureDescriptor(TestProductivityFeatureProvider.tipId); assertTrue(current <= featureDescriptor.getLastTimeUsed()); }
testStatistics
268,836
void () { final FeatureDescriptor featureDescriptor = myRegistry.getFeatureDescriptor(TestProductivityFeatureProvider.tipId); Element featureStatistics = new Element("features"); Element element = new Element("feature"); element.setAttribute("id", TestProductivityFeatureProvider.tipId); element.setAttribute("count", "1...
testStoredStatistics
268,837
FeatureDescriptor[] () { asked = true; return new FeatureDescriptor[] { new FeatureDescriptor(tipId, groupId, "TestTip", "test", 0, 0, null, 0, this) }; }
getFeatureDescriptors
268,838
GroupDescriptor[] () { return new GroupDescriptor[]{ new GroupDescriptor(groupId, "test") }; }
getGroupDescriptors
268,839
String () { return super.toString() + "; was asked: "+asked; }
toString
268,840
ActionPresentation () { throw new RuntimeException(); }
getPresentation
268,841
String () { throw new RuntimeException(); }
getName
268,842
Collection<TreeElement> () { Collection<TreeElement> result = new LinkedHashSet<>(); for (TreeElement object : myChildren) { if (object.toString().contains(myString)) { result.add(object); } } return result; }
getChildren
268,843
ItemPresentation () { throw new UnsupportedOperationException(); }
getPresentation
268,844
String () { return "Group:" + myString; }
toString
268,845
boolean (Object o) { if (this == o) return true; if (!(o instanceof Group)) return false; final StringGroup group = (StringGroup)o; if (myString != null ? !myString.equals(group.myString) : group.myString != null) return false; return true; }
equals
268,846
int () { return (myString != null ? myString.hashCode() : 0); }
hashCode
268,847
Collection<Group> (@NotNull AbstractTreeNode<?> parent, @NotNull Collection<TreeElement> children) { List<Group> result = new ArrayList<>(); Collection<String> parentGroupUsedStrings = parent.getValue() instanceof StringGroup ? ((StringGroup)parent.getValue()).myChildrenUsedStrings : Collections.emptySet(); Collection<...
group
268,848
StructureViewTreeElement () { return myRoot; }
getRoot
268,849
void (Filter filter) { myFilters.add(filter); }
addFlter
268,850
void (Sorter sorter) { mySorters.add(sorter); }
addSorter
268,851
ItemPresentation () { return new PresentationData(myValue, null, null, null); }
getPresentation
268,852
String () { return myValue; }
toString
268,853
StringTreeElement (@NonNls String s) { StringTreeElement child = new StringTreeElement(s); myChildren.add(child); return child; }
addChild
268,854
String () { return myValue; }
getValue
268,855
Object () { return null; }
getCurrentEditorElement
268,856
void (@NotNull FileEditorPositionListener listener) { }
addEditorPositionListener
268,857
void (@NotNull FileEditorPositionListener listener) { }
removeEditorPositionListener
268,858
void () { }
dispose
268,859
boolean (final Object element) { return false; }
shouldEnterElement
268,860
void (@NotNull ModelListener modelListener) { }
addModelListener
268,861
void (@NotNull ModelListener modelListener) { }
removeModelListener
268,862
void () { assertStructureEqual(""" root .Group:a ..Group:d ...ade ....Group:a .....Group:d ......aed ..abc ...Group:a ....Group:d .....abc_de .Group:b ..Group:d ...bcd ....Group:b .....bhg_yt ..Group:f ...bft ....ttt .Group:d ..eed ...zzz .xxx .xxx ..Group:a ...aaa ....Group:b .....bbb """, PlatformTestUtil.createCompa...
testGrouping
268,863
void () { myModel.addFlter(new Filter() { @Override @NotNull public ActionPresentation getPresentation() { throw new RuntimeException(); } @Override @NotNull public String getName() { throw new RuntimeException(); } @Override public boolean isVisible(TreeElement treeNode) { return !treeNode.toString().contains("a"); } ...
testFiltering
268,864
ActionPresentation () { throw new RuntimeException(); }
getPresentation
268,865
String () { throw new RuntimeException(); }
getName
268,866
boolean (TreeElement treeNode) { return !treeNode.toString().contains("a"); }
isVisible
268,867
boolean () { return false; }
isReverted
268,868
void () { myModel.addSorter(new Sorter() { @NotNull @Override public Comparator getComparator() { return (o1, o2) -> { if (o1 instanceof Group && !(o2 instanceof Group)) return -1; if (!(o1 instanceof Group) && o2 instanceof Group) return 1; return 0; }; } @Override public boolean isVisible() { return true; } @Override...
testSorting
268,869
Comparator () { return (o1, o2) -> { if (o1 instanceof Group && !(o2 instanceof Group)) return -1; if (!(o1 instanceof Group) && o2 instanceof Group) return 1; return 0; }; }
getComparator
268,870
boolean () { return true; }
isVisible
268,871
ActionPresentation () { throw new RuntimeException(); }
getPresentation
268,872
String () { throw new RuntimeException(); }
getName
268,873
Comparator () { return Comparator.comparing(Object::toString); }
getComparator
268,874
boolean () { return true; }
isVisible
268,875
ActionPresentation () { throw new RuntimeException(); }
getPresentation
268,876
String () { throw new RuntimeException(); }
getName
268,877
void () { TestTreeModel.StringTreeElement root = new TestTreeModel.StringTreeElement("root"); myModel = new TestTreeModel(root); root.addChild("xxx"); root.addChild("bbb"); root.addChild("bbb"); root.addChild("zzz").addChild("ttt"); root.addChild("aaa"); root.addChild("aaa").addChild("zzz"); root.addChild("xxx"); asser...
testUnsorted
268,878
void (@NonNls String expected, @Nullable Comparator comparator) { SmartTreeStructure structure = new SmartTreeStructure(myFixture.getProject(), myModel); String actual = PlatformTestUtil.print(structure, structure.getRootElement(), 0, comparator, -1, '.', null).toString(); assertEquals(expected, actual); }
assertStructureEqual
268,879
void () { getConfiguration().addExcludedFramework(getType()); assertEquals("type", assertOneElement(getState().getFrameworkTypes())); }
testAddExcludedFramework
268,880
void () { disableDetection(); getConfiguration().addExcludedFramework(getType()); assertEmpty(getState().getFrameworkTypes()); }
testAddExcludedFrameworkIfDetectionIsDisabled
268,881
void () { getConfiguration().addExcludedFile(myTempDir, null); assertEquals(myTempDir.getUrl(), assertOneElement(getState().getFiles()).getUrl()); }
testAddExcludedFile
268,882
void () { disableDetection(); getConfiguration().addExcludedFile(myTempDir, null); assertEmpty(getState().getFiles()); }
testAddExcludedFileIfDetectionIsDisabled
268,883
void () { final FrameworkType type = getType(); getConfiguration().addExcludedFramework(type); getConfiguration().addExcludedFile(myTempDir, type); assertEmpty(getState().getFiles()); getConfiguration().addExcludedFile(myTempDir, null); assertOneElement(getState().getFiles()); }
testAddExcludedFileForExcludedFramework
268,884
void () { final FrameworkType type = getType(); getConfiguration().addExcludedFile(myTempDir, type); assertOneElement(getState().getFiles()); getConfiguration().addExcludedFramework(type); assertEmpty(getState().getFiles()); assertOneElement(getState().getFrameworkTypes()); }
testAddExcludedFrameworkForExcludedFile
268,885
void () { getConfiguration().addExcludedFile(myTempDir, null); getConfiguration().addExcludedFile(myTempFile, null); assertEquals(myTempDir.getUrl(), assertOneElement(getState().getFiles()).getUrl()); getConfiguration().addExcludedFile(myTempFile, getType()); assertEquals(myTempDir.getUrl(), assertOneElement(getState()...
testAddExcludedFileInExcludedDirectory
268,886
void () { getConfiguration().addExcludedFile(myTempDir, getType()); getConfiguration().addExcludedFile(myTempFile, null); assertEquals(2, getState().getFiles().size()); }
testAddExcludedFileInExcludedDirectoryForDifferentFramework
268,887
void () { getConfiguration().addExcludedFile(myTempFile, null); assertEquals(myTempFile.getUrl(), assertOneElement(getState().getFiles()).getUrl()); getConfiguration().addExcludedFile(myTempDir, null); assertEquals(myTempDir.getUrl(), assertOneElement(getState().getFiles()).getUrl()); }
testAddExcludedDirectoryContainingExcludedFile
268,888
void () { getConfiguration().addExcludedFile(myTempFile, getType()); assertEquals(myTempFile.getUrl(), assertOneElement(getState().getFiles()).getUrl()); getConfiguration().addExcludedFile(myTempDir, null); assertEquals(myTempDir.getUrl(), assertOneElement(getState().getFiles()).getUrl()); }
testAddExcludedDirectoryContainingExcludedFileForAllFrameworks
268,889
void () { getConfiguration().addExcludedFile(myTempFile, getType()); assertEquals(myTempFile.getUrl(), assertOneElement(getState().getFiles()).getUrl()); getConfiguration().addExcludedFile(myTempDir, getType2()); assertEquals(2, getState().getFiles().size()); }
testAddExcludedDirectoryContainingExcludedFileForDifferentFramework
268,890
void () { ExcludesConfigurationState state = new ExcludesConfigurationState(); state.setDetectionEnabled(false); getConfiguration().loadState(state); }
disableDetection
268,891
ExcludesConfigurationState () { final ExcludesConfigurationState state = getConfiguration().getState(); assertNotNull(state); return state; }
getState
268,892
File () { try { return createTempDirectory(); } catch (IOException e) { throw new RuntimeException(e); } }
doCreateTempDir
268,893
FrameworkType () { return new MockFrameworkType("type"); }
getType
268,894
FrameworkType () { return new MockFrameworkType("type2"); }
getType2
268,895
DetectionExcludesConfigurationImpl () { return (DetectionExcludesConfigurationImpl)DetectionExcludesConfiguration.getInstance(myProject); }
getConfiguration
268,896
String () { return getId(); }
getPresentableName
268,897
Icon () { return EmptyIcon.ICON_16; }
getIcon
268,898
void () { final DisabledAutodetectionInfo state = new DisabledAutodetectionInfo(); final VirtualFile file = getTempDir().createVirtualFile("my-file.xml"); state.getElements().add(new DisabledAutodetectionByTypeElement(FRAMEWORK_ID, myModule.getName(), file.getUrl(), false)); getOldConfiguration().loadState(state); asse...
testUseOldConfiguration
268,899
void () { final DisabledAutodetectionInfo state = new DisabledAutodetectionInfo(); final VirtualFile file = getTempDir().createVirtualFile("my-file.xml"); state.getElements().add(new DisabledAutodetectionByTypeElement(FRAMEWORK_ID)); getOldConfiguration().loadState(state); assertTrue(isFileExcluded(file)); assertNull(g...
testExcludeFrameworkConfiguration