Java Code Examples for com.intellij.util.ArrayUtil#toStringArray()
The following examples show how to use
com.intellij.util.ArrayUtil#toStringArray() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuleGroupUtil.java From consulo with Apache License 2.0 | 6 votes |
public static <T> T buildModuleGroupPath(final ModuleGroup group, T parentNode, final Map<ModuleGroup, T> map, final Consumer<ParentChildRelation<T>> insertNode, final Function<ModuleGroup, T> createNewNode) { final ArrayList<String> path = new ArrayList<String>(); final String[] groupPath = group.getGroupPath(); for (String pathElement : groupPath) { path.add(pathElement); final ModuleGroup moduleGroup = new ModuleGroup(ArrayUtil.toStringArray(path)); T moduleGroupNode = map.get(moduleGroup); if (moduleGroupNode == null) { moduleGroupNode = createNewNode.fun(moduleGroup); map.put(moduleGroup, moduleGroupNode); insertNode.consume(new ParentChildRelation<T>(parentNode, moduleGroupNode)); } parentNode = moduleGroupNode; } return parentNode; }
Example 2
Source File: ChooseActionsDialog.java From consulo with Apache License 2.0 | 6 votes |
public String[] getTreeSelectedActionIds() { TreePath[] paths = myActionsTree.getTree().getSelectionPaths(); if (paths == null) return ArrayUtil.EMPTY_STRING_ARRAY; ArrayList<String> actions = new ArrayList<String>(); for (TreePath path : paths) { Object node = path.getLastPathComponent(); if (node instanceof DefaultMutableTreeNode) { DefaultMutableTreeNode defNode = (DefaultMutableTreeNode)node; Object userObject = defNode.getUserObject(); if (userObject instanceof String) { actions.add((String)userObject); } else if (userObject instanceof QuickList) { actions.add(((QuickList)userObject).getActionId()); } } } return ArrayUtil.toStringArray(actions); }
Example 3
Source File: OrderRootsEnumeratorImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull @Override public String[] getUrls() { if (myUsingCache) { checkCanUseCache(); final OrderRootsCache cache = myOrderEnumerator.getCache(); if (cache != null) { final int flags = myOrderEnumerator.getFlags(); String[] cached = cache.getCachedUrls(myRootType, flags); if (cached == null) { return cache.setCachedRoots(myRootType, flags, computeRootsUrls()).getUrls(); } else { return cached; } } } return ArrayUtil.toStringArray(computeRootsUrls()); }
Example 4
Source File: TreeFileChooserDialog.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public String[] getNames(final boolean checkBoxState) { final String[] fileNames; if (myFileType != null && myProject != null) { GlobalSearchScope scope = myShowLibraryContents ? GlobalSearchScope.allScope(myProject) : GlobalSearchScope.projectScope(myProject); Collection<VirtualFile> virtualFiles = FileTypeIndex.getFiles(myFileType, scope); fileNames = ContainerUtil.map2Array(virtualFiles, String.class, new Function<VirtualFile, String>() { @Override public String fun(VirtualFile file) { return file.getName(); } }); } else { fileNames = FilenameIndex.getAllFilenames(myProject); } final Set<String> array = new THashSet<String>(); for (String fileName : fileNames) { if (!array.contains(fileName)) { array.add(fileName); } } final String[] result = ArrayUtil.toStringArray(array); Arrays.sort(result); return result; }
Example 5
Source File: ArchiveHandler.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull public String[] list(@Nonnull String relativePath) { EntryInfo entry = getEntryInfo(relativePath); if (entry == null || !entry.isDirectory) return ArrayUtil.EMPTY_STRING_ARRAY; Set<String> names = new THashSet<String>(); for (EntryInfo info : getEntriesMap().values()) { if (info.parent == entry) { names.add(info.shortName.toString()); } } return ArrayUtil.toStringArray(names); }
Example 6
Source File: KeymapImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public String[] getActionIds() { ArrayList<String> ids = new ArrayList<String>(); if (myParent != null) { String[] parentIds = getParentActionIds(); ContainerUtil.addAll(ids, parentIds); } String[] ownActionIds = getOwnActionIds(); for (String id : ownActionIds) { if (!ids.contains(id)) { ids.add(id); } } return ArrayUtil.toStringArray(ids); }
Example 7
Source File: DetailsComponent.java From consulo with Apache License 2.0 | 5 votes |
public void update() { ArrayList<String> strings = new ArrayList<String>(); if (myPrefix != null) { ContainerUtil.addAll(strings, myPrefix); } if (myText != null) { ContainerUtil.addAll(strings, myText); } myBannerText = ArrayUtil.toStringArray(strings); updateBanner(); }
Example 8
Source File: ContentEntryImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public String[] getFolderUrls(@Nonnull Predicate<ContentFolderTypeProvider> predicate) { List<String> list = new ArrayList<>(); for (ContentFolder contentFolder : getFolders0(predicate)) { list.add(contentFolder.getUrl()); } return ArrayUtil.toStringArray(list); }
Example 9
Source File: CSharpSymbolNameContributor.java From consulo-csharp with Apache License 2.0 | 5 votes |
@Nonnull @Override public String[] getNames(Project project, boolean includeNonProjectItems) { Collection<String> k1 = MethodIndex.getInstance().getAllKeys(project); Collection<String> k2 = EventIndex.getInstance().getAllKeys(project); Collection<String> k3 = PropertyIndex.getInstance().getAllKeys(project); Collection<String> k4 = FieldIndex.getInstance().getAllKeys(project); List<String> list = new ArrayList<String>(k1.size() + k2.size() + k3.size() + k4.size()); list.addAll(k1); list.addAll(k2); list.addAll(k3); list.addAll(k4); return ArrayUtil.toStringArray(list); }
Example 10
Source File: BlazeProblemsView.java From intellij with Apache License 2.0 | 5 votes |
private static String[] convertMessage(final IssueOutput issue) { String text = issue.getMessage(); if (!text.contains("\n")) { return new String[] {text}; } final List<String> lines = new ArrayList<>(); StringTokenizer tokenizer = new StringTokenizer(text, "\n", false); while (tokenizer.hasMoreTokens()) { lines.add(tokenizer.nextToken()); } return ArrayUtil.toStringArray(lines); }
Example 11
Source File: OrderRootsEnumeratorImpl.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @Override public String[] fun(ModuleRootModel t, Predicate<ContentFolderTypeProvider> v) { List<String> urls = new ArrayList<>(5); ModuleCompilerPathsManager compilerPathsManager = ModuleCompilerPathsManager.getInstance(t.getModule()); for (ContentFolderTypeProvider contentFolderTypeProvider : ContentFolderTypeProvider.EP_NAME.getExtensionList()) { if(v.apply(contentFolderTypeProvider)) { ContainerUtil.addIfNotNull(urls, compilerPathsManager.getCompilerOutputUrl(contentFolderTypeProvider)); } } return ArrayUtil.toStringArray(urls); }
Example 12
Source File: HaxeDefineIntention.java From intellij-haxe with Apache License 2.0 | 5 votes |
private String[] changeDefinitions(Set<String> definitions) { if (isDefined) { definitions.remove(myWord); } else { definitions.add(myWord); } return ArrayUtil.toStringArray(definitions); }
Example 13
Source File: KeyboardShortcutDialog.java From consulo with Apache License 2.0 | 4 votes |
private void updateCurrentKeyStrokeInfo() { if (myConflictInfoArea == null || myKeystrokePreview == null){ return; } myConflictInfoArea.setText(null); myKeystrokePreview.setText(" "); if (myKeymap == null){ return; } KeyboardShortcut keyboardShortcut = getKeyboardShortcut(); if (keyboardShortcut == null){ return; } String strokeText = getTextByKeyStroke(keyboardShortcut.getFirstKeyStroke()); String suffixText = getTextByKeyStroke(keyboardShortcut.getSecondKeyStroke()); if(suffixText != null && suffixText.length() > 0) { strokeText += ',' + suffixText; } myKeystrokePreview.setText(strokeText); StringBuffer buffer = new StringBuffer(); Map<String, ArrayList<KeyboardShortcut>> conflicts = myKeymap.getConflicts(myActionId, keyboardShortcut); Set<String> keys = conflicts.keySet(); String[] actionIds = ArrayUtil.toStringArray(keys); boolean loaded = true; for (String actionId : actionIds) { String actionPath = myMainGroup.getActionQualifiedPath(actionId); if (actionPath == null) { loaded = false; } if (buffer.length() > 1) { buffer.append('\n'); } buffer.append('['); buffer.append(actionPath != null ? actionPath : actionId); buffer.append(']'); } if (buffer.length() == 0) { myConflictInfoArea.setForeground(UIUtil.getTextAreaForeground()); myConflictInfoArea.setText(KeyMapBundle.message("no.conflict.info.message")); } else { myConflictInfoArea.setForeground(JBColor.RED); if (loaded) { myConflictInfoArea.setText(KeyMapBundle.message("assigned.to.info.message", buffer.toString())); } else { myConflictInfoArea.setText("Assigned to " + buffer.toString() + " which is now not loaded but may be loaded later"); } } }
Example 14
Source File: ThriftClassContributor.java From intellij-thrift with Apache License 2.0 | 4 votes |
@NotNull @Override public String[] getNames(Project project, boolean includeNonProjectItems) { return ArrayUtil.toStringArray(ThriftDeclarationIndex.findAllKeys(project, getScope(project, includeNonProjectItems))); }
Example 15
Source File: FindInProjectSettingsBase.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public String[] getRecentFindStrings(){ return ArrayUtil.toStringArray(findStrings); }
Example 16
Source File: DefaultProjectProfileManager.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public synchronized String[] getAvailableProfileNames() { return ArrayUtil.toStringArray(myProfiles.keySet()); }
Example 17
Source File: LineTokenizer.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public String[] execute() { ArrayList<String> lines = new ArrayList<String>(); doExecute(lines); return ArrayUtil.toStringArray(lines); }
Example 18
Source File: ModuleRootLayerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull @Override public String[] getDependencyModuleNames() { List<String> result = orderEntries().withoutSdk().withoutLibraries().withoutModuleSourceEntries().process(new CollectDependentModules(), new ArrayList<String>()); return ArrayUtil.toStringArray(result); }
Example 19
Source File: HaskellChooseByNameContributor.java From intellij-haskforce with Apache License 2.0 | 4 votes |
@NotNull @Override public String[] getNames(Project project, boolean includeNonProjectItems) { return ArrayUtil.toStringArray(StubIndex.getInstance().getAllKeys(HaskellAllNameIndex.KEY, project)); }
Example 20
Source File: FileSaverDescriptor.java From consulo with Apache License 2.0 | 2 votes |
/** * Returns accepted file extensions * * @return accepted file extensions */ public String[] getFileExtensions() { return ArrayUtil.toStringArray(extensions); }