Search in sources :

Example 1 with ArrayListSet

use of com.intellij.util.containers.ArrayListSet in project intellij-community by JetBrains.

the class AntDomTargetReference method getExistingNames.

private Set<String> getExistingNames() {
    final AntDomElement hostingElement = getHostingAntDomElement();
    if (hostingElement == null) {
        return Collections.emptySet();
    }
    final AntDomTarget contextTarget = hostingElement.getParentOfType(AntDomTarget.class, false);
    if (contextTarget == null) {
        return Collections.emptySet();
    }
    final Set<String> existing = new ArrayListSet<>();
    final String selfName = contextTarget.getName().getStringValue();
    if (selfName != null) {
        existing.add(selfName);
    }
    final String dependsString = contextTarget.getDependsList().getRawText();
    if (dependsString != null) {
        final StringTokenizer tokenizer = new StringTokenizer(dependsString, ",", false);
        while (tokenizer.hasMoreTokens()) {
            existing.add(tokenizer.nextToken().trim());
        }
    }
    return existing;
}
Also used : StringTokenizer(com.intellij.util.text.StringTokenizer) ArrayListSet(com.intellij.util.containers.ArrayListSet)

Example 2 with ArrayListSet

use of com.intellij.util.containers.ArrayListSet in project intellij-community by JetBrains.

the class EditorsSplitters method getSelectedFiles.

@NotNull
public VirtualFile[] getSelectedFiles() {
    final Set<VirtualFile> files = new ArrayListSet<>();
    for (final EditorWindow window : myWindows) {
        final VirtualFile file = window.getSelectedFile();
        if (file != null) {
            files.add(file);
        }
    }
    final VirtualFile[] virtualFiles = VfsUtilCore.toVirtualFileArray(files);
    final VirtualFile currentFile = getCurrentFile();
    if (currentFile != null) {
        for (int i = 0; i != virtualFiles.length; ++i) {
            if (Comparing.equal(virtualFiles[i], currentFile)) {
                virtualFiles[i] = virtualFiles[0];
                virtualFiles[0] = currentFile;
                break;
            }
        }
    }
    return virtualFiles;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) RelativePoint(com.intellij.ui.awt.RelativePoint) ArrayListSet(com.intellij.util.containers.ArrayListSet) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ArrayListSet (com.intellij.util.containers.ArrayListSet)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 StringTokenizer (com.intellij.util.text.StringTokenizer)1 NotNull (org.jetbrains.annotations.NotNull)1