Search in sources :

Example 1 with NotNull

use of org.jetbrains.annotations.NotNull in project scss-lint-plugin by idok.

the class FileUtils method displayDirectoryContents.

@NotNull
public static List<String> displayDirectoryContents(@NotNull File projectRoot, @NotNull File dir, @NotNull FilenameFilter filter) {
    List<String> ret = listFiles(projectRoot, dir, filter);
    File[] files = dir.listFiles();
    for (final File file : files) {
        if (file.isDirectory()) {
            ret.addAll(displayDirectoryContents(projectRoot, file, filter));
        //            } else {
        //                listFiles(file, filter, allFiles);
        }
    }
    return ret;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) PsiFile(com.intellij.psi.PsiFile) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with NotNull

use of org.jetbrains.annotations.NotNull in project scss-lint-plugin by idok.

the class FileUtils method findExeFilesInPath.

@NotNull
private static List<File> findExeFilesInPath(@Nullable String pathEnvVarValue, @NotNull String fileBaseName, boolean stopAfterFirstMatch, boolean logDetails) {
    if (logDetails) {
        LOG.info("Finding files in PATH (base name=" + fileBaseName + ", PATH=" + StringUtil.notNullize(pathEnvVarValue) + ").");
    }
    if (pathEnvVarValue == null) {
        return Collections.emptyList();
    }
    List<File> result = new SmartList<File>();
    List<String> paths = StringUtil.split(pathEnvVarValue, File.pathSeparator, true, true);
    for (String path : paths) {
        File dir = new File(path);
        if (logDetails) {
            File file = new File(dir, fileBaseName);
            LOG.info("path:" + path + ", path.isAbsolute:" + dir.isAbsolute() + ", path.isDirectory:" + dir.isDirectory() + ", file.isFile:" + file.isFile() + ", file.canExecute:" + file.canExecute());
        }
        if (dir.isAbsolute() && dir.isDirectory()) {
            File file = new File(dir, fileBaseName);
            if (file.isFile() && file.canExecute()) {
                result.add(file);
                if (stopAfterFirstMatch) {
                    return result;
                }
            }
        }
    }
    return result;
}
Also used : SmartList(com.intellij.util.SmartList) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) PsiFile(com.intellij.psi.PsiFile) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with NotNull

use of org.jetbrains.annotations.NotNull in project actor-platform by actorapp.

the class ContactContent method create.

@NotNull
public static ContactContent create(@NotNull String name, @NotNull ArrayList<String> phones, @NotNull ArrayList<String> emails, @Nullable String base64photo) {
    try {
        JSONObject obj = new JSONObject();
        obj.put("dataType", "contact");
        JSONObject contact = new JSONObject();
        contact.put("name", name);
        if (base64photo != null) {
            contact.put("photo", base64photo);
        }
        JSONArray phoneArray = new JSONArray();
        for (String phone : phones) {
            phoneArray.put(phone);
        }
        JSONArray emailArray = new JSONArray();
        for (String phone : emails) {
            emailArray.put(phone);
        }
        contact.put("emails", emailArray);
        contact.put("phones", phoneArray);
        JSONObject data = new JSONObject();
        data.put("contact", contact);
        obj.put("data", data);
        return new ContactContent(new ContentRemoteContainer(new ApiJsonMessage(obj.toString())));
    } catch (JSONException e) {
        throw new RuntimeException(e);
    }
}
Also used : JSONObject(im.actor.runtime.json.JSONObject) JSONArray(im.actor.runtime.json.JSONArray) ContentRemoteContainer(im.actor.core.entity.content.internal.ContentRemoteContainer) JSONException(im.actor.runtime.json.JSONException) ApiJsonMessage(im.actor.core.api.ApiJsonMessage) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with NotNull

use of org.jetbrains.annotations.NotNull in project adb-idea by pbreault.

the class MyDeviceChooser method getSelectedDevices.

@NotNull
public IDevice[] getSelectedDevices() {
    int[] rows = mySelectedRows != null ? mySelectedRows : myDeviceTable.getSelectedRows();
    List<IDevice> result = new ArrayList<IDevice>();
    for (int row : rows) {
        if (row >= 0) {
            Object serial = myDeviceTable.getValueAt(row, SERIAL_COLUMN_INDEX);
            final AndroidDebugBridge bridge = AndroidSdkUtils.getDebugBridge(myFacet.getModule().getProject());
            if (bridge == null) {
                return EMPTY_DEVICE_ARRAY;
            }
            IDevice[] devices = getFilteredDevices(bridge);
            for (IDevice device : devices) {
                if (device.getSerialNumber().equals(serial.toString())) {
                    result.add(device);
                    break;
                }
            }
        }
    }
    return result.toArray(new IDevice[result.size()]);
}
Also used : TIntArrayList(gnu.trove.TIntArrayList) IDevice(com.android.ddmlib.IDevice) AndroidDebugBridge(com.android.ddmlib.AndroidDebugBridge) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with NotNull

use of org.jetbrains.annotations.NotNull in project midpoint by Evolveum.

the class ResourceValidatorImpl method getString.

@NotNull
private String getString(ResourceBundle bundle, String key, Object... parameters) {
    final String resolvedKey;
    if (key != null) {
        if (bundle.containsKey(key)) {
            resolvedKey = bundle.getString(key);
        } else {
            resolvedKey = key;
        }
    } else {
        resolvedKey = "";
    }
    final MessageFormat format = new MessageFormat(resolvedKey, bundle.getLocale());
    return format.format(parameters);
}
Also used : MessageFormat(java.text.MessageFormat) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)8140 VirtualFile (com.intellij.openapi.vfs.VirtualFile)888 ArrayList (java.util.ArrayList)809 PsiElement (com.intellij.psi.PsiElement)764 Project (com.intellij.openapi.project.Project)647 File (java.io.File)627 Nullable (org.jetbrains.annotations.Nullable)518 List (java.util.List)400 PsiFile (com.intellij.psi.PsiFile)358 Module (com.intellij.openapi.module.Module)336 IOException (java.io.IOException)325 TextRange (com.intellij.openapi.util.TextRange)260 Document (com.intellij.openapi.editor.Document)173 ContainerUtil (com.intellij.util.containers.ContainerUtil)173 BasePhpElementVisitor (com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpElementVisitor)169 ASTNode (com.intellij.lang.ASTNode)167 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)167 Map (java.util.Map)156 java.util (java.util)154 IElementType (com.intellij.psi.tree.IElementType)146