Java Code Examples for com.intellij.util.ArrayUtil#EMPTY_STRING_ARRAY

The following examples show how to use com.intellij.util.ArrayUtil#EMPTY_STRING_ARRAY . 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: Win32FsCache.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
String[] list(@Nonnull VirtualFile file) {
  String path = file.getPath();
  FileInfo[] fileInfo = myKernel.listChildren(path);
  if (fileInfo == null || fileInfo.length == 0) {
    return ArrayUtil.EMPTY_STRING_ARRAY;
  }

  String[] names = new String[fileInfo.length];
  TIntObjectHashMap<THashMap<String, FileAttributes>> map = getMap();
  int parentId = ((VirtualFileWithId)file).getId();
  THashMap<String, FileAttributes> nestedMap = map.get(parentId);
  if (nestedMap == null) {
    nestedMap = new THashMap<String, FileAttributes>(fileInfo.length, FileUtil.PATH_HASHING_STRATEGY);
    map.put(parentId, nestedMap);
  }
  for (int i = 0, length = fileInfo.length; i < length; i++) {
    FileInfo info = fileInfo[i];
    String name = info.getName();
    nestedMap.put(name, info.toFileAttributes());
    names[i] = name;
  }
  return names;
}
 
Example 2
Source File: MultiLineLabelUI.java    From consulo with Apache License 2.0 6 votes vote down vote up
public String[] splitStringByLines(String str) {
  if (str == null) return ArrayUtil.EMPTY_STRING_ARRAY;
  if (str.equals(myString)) {
    return myLines;
  }
  myString = convertTabs(str, 2);

  ArrayList list = new ArrayList();
  StringTokenizer st = new StringTokenizer(str, "\n\r");
  while (st.hasMoreTokens()) {
    list.add(st.nextToken());
  }

  myLines = (String[])ArrayUtil.toStringArray(list);
  return myLines;
}
 
Example 3
Source File: ModulesAndLibrariesSourceItemsProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static Collection<? extends PackagingSourceItem> createModuleItems(ArtifactEditorContext editorContext, Artifact artifact,
                                                                           @Nonnull String[] groupPath) {
  final Module[] modules = editorContext.getModulesProvider().getModules();
  final List<PackagingSourceItem> items = new ArrayList<PackagingSourceItem>();
  Set<String> groups = new HashSet<String>();
  for (Module module : modules) {
    String[] path = ModuleManager.getInstance(editorContext.getProject()).getModuleGroupPath(module);
    if (path == null) {
      path = ArrayUtil.EMPTY_STRING_ARRAY;
    }

    if (Comparing.equal(path, groupPath)) {
      items.add(new ModuleSourceItemGroup(module));
    }
    else if (ArrayUtil.startsWith(path, groupPath)) {
      groups.add(path[groupPath.length]);
    }
  }
  for (String group : groups) {
    items.add(0, new ModuleGroupItem(ArrayUtil.append(groupPath, group)));
  }
  return items;
}
 
Example 4
Source File: KeymapImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public String[] getActionIds(final Shortcut shortcut) {
  if (shortcut instanceof KeyboardShortcut) {
    final KeyboardShortcut kb = (KeyboardShortcut)shortcut;
    final KeyStroke first = kb.getFirstKeyStroke();
    final KeyStroke second = kb.getSecondKeyStroke();
    return second != null ? getActionIds(first, second) : getActionIds(first);
  }
  else if (shortcut instanceof MouseShortcut) {
    return getActionIds((MouseShortcut)shortcut);
  }
  else if (shortcut instanceof KeyboardModifierGestureShortcut) {
    return getActionIds((KeyboardModifierGestureShortcut)shortcut);
  }
  else {
    return ArrayUtil.EMPTY_STRING_ARRAY;
  }
}
 
Example 5
Source File: ListOfElementsEP.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static String[] getValuesOfVariableIfFound(String text) {
  if (StringUtil.isEmptyOrSpaces(text)) {
    return ArrayUtil.EMPTY_STRING_ARRAY;
  }
  if (text.startsWith(LIST_VARIABLE_START)) {
    Collection<String> valuesOf = getValuesOf(text);
    if (valuesOf.isEmpty()) {
      return ArrayUtil.EMPTY_STRING_ARRAY;
    }
    return ArrayUtil.toStringArray(valuesOf);
  }
  else {
    List<String> split = StringUtil.split(text, ",");
    return ArrayUtil.toStringArray(split);
  }
}
 
Example 6
Source File: WeexAttrDescriptor.java    From weex-language-support with MIT License 5 votes vote down vote up
@Override
public String[] getEnumeratedValues() {
    if (enumValue == null) {
        return ArrayUtil.EMPTY_STRING_ARRAY;
    }
    return enumValue.toArray(new String[enumValue.size()]);
}
 
Example 7
Source File: KeymapImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getActionIds(KeyStroke firstKeyStroke) {
  // first, get keystrokes from own map
  List<String> list = getKeystroke2ListOfIds().get(firstKeyStroke);
  if (myParent != null) {
    String[] ids = getParentActionIds(firstKeyStroke);
    if (ids.length > 0) {
      boolean originalListInstance = true;
      for (String id : ids) {
        // add actions from parent keymap only if they are absent in this keymap
        if (!myActionId2ListOfShortcuts.containsKey(id)) {
          if (list == null) {
            list = new ArrayList<String>();
            originalListInstance = false;
          }
          else if (originalListInstance) {
            list = new ArrayList<String>(list);
            originalListInstance = false;
          }
          if (!list.contains(id)) list.add(id);
        }
      }
    }
  }
  if (list == null) return ArrayUtil.EMPTY_STRING_ARRAY;
  return sortInOrderOfRegistration(ArrayUtil.toStringArray(list));
}
 
Example 8
Source File: ArchiveHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
@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 9
Source File: ModuleRootsProcessorFromModuleDir.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public String[] getUrls(@Nonnull ModuleRootModel moduleRootModel, @Nonnull Predicate<ContentFolderTypeProvider> predicate) {
  if (predicate.apply(ProductionContentFolderTypeProvider.getInstance())) {
    return new String[]{moduleRootModel.getModule().getModuleDirUrl()};
  }
  return ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 10
Source File: ModuleRootLayerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public String[] getContentRootUrls() {
  if (getContent().isEmpty()) return ArrayUtil.EMPTY_STRING_ARRAY;
  final ArrayList<String> result = new ArrayList<>(getContent().size());

  for (ContentEntry contentEntry : getContent()) {
    result.add(contentEntry.getUrl());
  }

  return ArrayUtil.toStringArray(result);
}
 
Example 11
Source File: TempFileSystem.java    From consulo with Apache License 2.0 4 votes vote down vote up
public String[] list() {
  return ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 12
Source File: FeatureDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public String[] getDependencyFeatures() {
  if (myDependencies == null) return ArrayUtil.EMPTY_STRING_ARRAY;
  return ArrayUtil.toStringArray(myDependencies);
}
 
Example 13
Source File: MockFileTypeManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String[] getAssociatedExtensions(@Nonnull FileType type) {
  return ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 14
Source File: ToolWindowHeadlessManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String[] getToolWindowIds() {
  return ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 15
Source File: MockFileTypeManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public String[] getAssociatedExtensions(@Nonnull FileType type) {
  return ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 16
Source File: ModuleOrderEntryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public String[] getUrls(OrderRootType rootType) {
  final OrderRootsEnumerator enumerator = getEnumerator(rootType);
  return enumerator != null ? enumerator.getUrls() : ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 17
Source File: ColumnFilteringStrategy.java    From consulo with Apache License 2.0 4 votes vote down vote up
private MyListModel() {
  myValues = ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 18
Source File: LineTokenizer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static String[] tokenize(CharSequence chars, final boolean includeSeparators, final boolean skipLastEmptyLine) {
  final List<String> strings = tokenizeIntoList(chars, includeSeparators, skipLastEmptyLine);
  return strings.isEmpty() ? ArrayUtil.EMPTY_STRING_ARRAY : ArrayUtil.toStringArray(strings);
}
 
Example 19
Source File: AbstractProjectViewPane.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return all supported sub views IDs.
 * should return empty array if there is no subViews as in Project/Packages view.
 */
@Nonnull
public String[] getSubIds() {
  return ArrayUtil.EMPTY_STRING_ARRAY;
}
 
Example 20
Source File: ComponentShortNamesCache.java    From litho with Apache License 2.0 4 votes vote down vote up
@Override
public String[] getAllFieldNames() {
  return ArrayUtil.EMPTY_STRING_ARRAY;
}