Search in sources :

Example 16 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 17 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 18 with NotNull

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

the class ScssLintProjectComponent method validationFailed.

private void validationFailed(String msg) {
    NotificationListener notificationListener = new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
            ScssLintInspection.showSettings(project);
        }
    };
    String errorMessage = msg + FIX_CONFIG_HREF;
    showInfoNotification(errorMessage, NotificationType.WARNING, notificationListener);
    LOG.debug(msg);
    settingValidStatus = false;
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Notification(com.intellij.notification.Notification) NotificationListener(com.intellij.notification.NotificationListener)

Example 19 with NotNull

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

the class ScssLintSettingsPage method configESLintBinField.

private void configESLintBinField() {
    TextFieldWithHistory textFieldWithHistory = scssLintExeField.getChildComponent();
    textFieldWithHistory.setHistorySize(-1);
    textFieldWithHistory.setMinimumAndPreferredWidth(0);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {

        @NotNull
        public List<String> produce() {
            //                File projectRoot = new File(project.getBaseDir().getPath());
            //searchForESLintBin(projectRoot);
            List<File> newFiles = ScssLintFinder.findAllScssLintExe();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, scssLintExeField, "Select SCSS Lint Exe", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
Also used : TextFieldWithHistory(com.intellij.ui.TextFieldWithHistory) List(java.util.List) NotNull(org.jetbrains.annotations.NotNull)

Example 20 with NotNull

use of org.jetbrains.annotations.NotNull in project android-selector-intellij-plugin by importre.

the class AndroidSelectorDialog method parseColorsXml.

@NotNull
private HashMap<String, String> parseColorsXml(VirtualFile colorsXml) {
    HashMap<String, String> map = new LinkedHashMap<String, String>();
    try {
        NodeList colors = getColorNodes(colorsXml.getInputStream());
        makeColorMap(colors, map);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return map;
}
Also used : NodeList(org.w3c.dom.NodeList) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)6249 VirtualFile (com.intellij.openapi.vfs.VirtualFile)829 ArrayList (java.util.ArrayList)617 Project (com.intellij.openapi.project.Project)540 File (java.io.File)531 PsiElement (com.intellij.psi.PsiElement)461 Nullable (org.jetbrains.annotations.Nullable)391 Module (com.intellij.openapi.module.Module)315 PsiFile (com.intellij.psi.PsiFile)296 List (java.util.List)272 IOException (java.io.IOException)263 TextRange (com.intellij.openapi.util.TextRange)245 ContainerUtil (com.intellij.util.containers.ContainerUtil)170 Document (com.intellij.openapi.editor.Document)158 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)154 ASTNode (com.intellij.lang.ASTNode)145 Pair (com.intellij.openapi.util.Pair)141 StringUtil (com.intellij.openapi.util.text.StringUtil)133 Logger (com.intellij.openapi.diagnostic.Logger)127 Editor (com.intellij.openapi.editor.Editor)120