|
1 | | -/* |
2 | | - * Copyright (c) 2016 Patrick Scheibe |
3 | | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | | - * of this software and associated documentation files (the "Software"), to deal |
5 | | - * in the Software without restriction, including without limitation the rights |
6 | | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
7 | | - * copies of the Software, and to permit persons to whom the Software is |
8 | | - * furnished to do so, subject to the following conditions: |
9 | | - * |
10 | | - * The above copyright notice and this permission notice shall be included in |
11 | | - * all copies or substantial portions of the Software. |
12 | | - * |
13 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
14 | | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
15 | | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
16 | | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
17 | | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
18 | | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
19 | | - * THE SOFTWARE. |
20 | | - */ |
21 | | - |
22 | | -package de.halirutan.mathematica.actions; |
23 | | - |
24 | | -import com.intellij.openapi.actionSystem.AnAction; |
25 | | -import com.intellij.openapi.actionSystem.AnActionEvent; |
26 | | -import com.intellij.openapi.actionSystem.DataKeys; |
27 | | -import com.intellij.openapi.project.Project; |
28 | | -import com.intellij.openapi.vfs.VirtualFile; |
29 | | -import com.intellij.psi.search.GlobalSearchScope; |
30 | | -import com.intellij.util.indexing.FileBasedIndex; |
31 | | -import com.intellij.util.indexing.ID; |
32 | | -import de.halirutan.mathematica.index.packageexport.MathematicaPackageExportIndex; |
33 | | -import de.halirutan.mathematica.index.packageexport.MathematicaPackageExportIndex.FileKey; |
34 | | -import de.halirutan.mathematica.index.packageexport.MathematicaPackageExportIndex.Key; |
35 | | -import de.halirutan.mathematica.index.packageexport.PackageExportSymbol; |
36 | | - |
37 | | -import java.util.Collection; |
38 | | -import java.util.List; |
39 | | - |
40 | | -/** |
41 | | - * @author patrick (08.11.16). |
42 | | - */ |
43 | | -public class PackageExportChecker extends AnAction { |
44 | | - |
45 | | - @Override |
46 | | - public void actionPerformed(AnActionEvent e) { |
47 | | - |
48 | | - final Project project = e.getProject(); |
49 | | - if (project == null) { |
50 | | - return; |
51 | | - } |
52 | | - |
53 | | - final VirtualFile currentFile = e.getDataContext().getData(DataKeys.VIRTUAL_FILE); |
54 | | - final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance(); |
55 | | - final ID<Key, List<PackageExportSymbol>> indexId = MathematicaPackageExportIndex.INDEX_ID; |
56 | | - final Collection<Key> allKeys = fileBasedIndex.getAllKeys(indexId,project); |
57 | | - |
58 | | - for (Key next : allKeys) { |
59 | | - final VirtualFile file = fileBasedIndex.findFileById(project, ((FileKey) next).getFileId()); |
60 | | - System.out.printf("\nFILE: " + file.getPresentableName() + "\n-----------------------------------------\n"); |
61 | | - final List<List<PackageExportSymbol>> values = fileBasedIndex.getValues(indexId, next, GlobalSearchScope.allScope(project)); |
62 | | - for (List<PackageExportSymbol> list : values) { |
63 | | - for (PackageExportSymbol info : list) { |
64 | | - System.out.println(info.symbol + " (" + info.nameSpace +")"); |
65 | | - } |
66 | | - } |
67 | | - } |
68 | | - } |
69 | | -} |
| 1 | +///* |
| 2 | +// * Copyright (c) 2016 Patrick Scheibe |
| 3 | +// * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | +// * of this software and associated documentation files (the "Software"), to deal |
| 5 | +// * in the Software without restriction, including without limitation the rights |
| 6 | +// * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | +// * copies of the Software, and to permit persons to whom the Software is |
| 8 | +// * furnished to do so, subject to the following conditions: |
| 9 | +// * |
| 10 | +// * The above copyright notice and this permission notice shall be included in |
| 11 | +// * all copies or substantial portions of the Software. |
| 12 | +// * |
| 13 | +// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | +// * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | +// * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | +// * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | +// * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | +// * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 19 | +// * THE SOFTWARE. |
| 20 | +// */ |
| 21 | +// |
| 22 | +//package de.halirutan.mathematica.actions; |
| 23 | +// |
| 24 | +//import com.intellij.openapi.actionSystem.AnAction; |
| 25 | +//import com.intellij.openapi.actionSystem.AnActionEvent; |
| 26 | +//import com.intellij.openapi.actionSystem.DataKeys; |
| 27 | +//import com.intellij.openapi.project.Project; |
| 28 | +//import com.intellij.openapi.vfs.VirtualFile; |
| 29 | +//import com.intellij.psi.search.GlobalSearchScope; |
| 30 | +//import com.intellij.util.indexing.FileBasedIndex; |
| 31 | +//import com.intellij.util.indexing.ID; |
| 32 | +//import de.halirutan.mathematica.index.packageexport.MathematicaPackageExportIndex; |
| 33 | +//import de.halirutan.mathematica.index.packageexport.MathematicaPackageExportIndex.FileKey; |
| 34 | +//import de.halirutan.mathematica.index.packageexport.MathematicaPackageExportIndex.Key; |
| 35 | +//import de.halirutan.mathematica.index.packageexport.PackageExportSymbol; |
| 36 | +// |
| 37 | +//import java.util.Collection; |
| 38 | +//import java.util.List; |
| 39 | +// |
| 40 | +///** |
| 41 | +// * @author patrick (08.11.16). |
| 42 | +// */ |
| 43 | +//public class PackageExportChecker extends AnAction { |
| 44 | +// |
| 45 | +// @Override |
| 46 | +// public void actionPerformed(AnActionEvent e) { |
| 47 | +// |
| 48 | +// final Project project = e.getProject(); |
| 49 | +// if (project == null) { |
| 50 | +// return; |
| 51 | +// } |
| 52 | +// |
| 53 | +// final VirtualFile currentFile = e.getDataContext().getData(DataKeys.VIRTUAL_FILE); |
| 54 | +// final FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance(); |
| 55 | +// final ID<Key, List<PackageExportSymbol>> indexId = MathematicaPackageExportIndex.INDEX_ID; |
| 56 | +// final Collection<Key> allKeys = fileBasedIndex.getAllKeys(indexId,project); |
| 57 | +// |
| 58 | +// for (Key next : allKeys) { |
| 59 | +// final VirtualFile file = fileBasedIndex.findFileById(project, ((FileKey) next).getFileId()); |
| 60 | +// System.out.printf("\nFILE: " + file.getPresentableName() + "\n-----------------------------------------\n"); |
| 61 | +// final List<List<PackageExportSymbol>> values = fileBasedIndex.getValues(indexId, next, GlobalSearchScope.allScope(project)); |
| 62 | +// for (List<PackageExportSymbol> list : values) { |
| 63 | +// for (PackageExportSymbol info : list) { |
| 64 | +// System.out.println(info.symbol + " (" + info.nameSpace +")"); |
| 65 | +// } |
| 66 | +// } |
| 67 | +// } |
| 68 | +// } |
| 69 | +//} |
0 commit comments