Package org.infernus.idea.checkstyle

Examples of org.infernus.idea.checkstyle.CheckStylePlugin


        final Project project = DataKeys.PROJECT.getData(event.getDataContext());
        if (project == null) {
            return false;
        }

        final CheckStylePlugin checkStylePlugin
                = project.getComponent(CheckStylePlugin.class);
        if (checkStylePlugin == null) {
            throw new IllegalStateException("Couldn't get checkstyle plugin");
        }
View Full Code Here


        final Project project = DataKeys.PROJECT.getData(event.getDataContext());
        if (project == null) {
            return;
        }

        final CheckStylePlugin checkStylePlugin
                = project.getComponent(CheckStylePlugin.class);
        if (checkStylePlugin == null) {
            throw new IllegalStateException("Couldn't get checkstyle plugin");
        }
View Full Code Here

            final Project project = DataKeys.PROJECT.getData(event.getDataContext());
            if (project == null) { // check if we're loading...
                return;
            }

            final CheckStylePlugin checkStylePlugin
                    = project.getComponent(CheckStylePlugin.class);
            if (checkStylePlugin == null) {
                throw new IllegalStateException("Couldn't get checkstyle plugin");
            }

            final Presentation presentation = event.getPresentation();

            final LocalChangeList changeList = ChangeListManager.getInstance(project).getDefaultChangeList();
            if (changeList == null
                    || changeList.getChanges() == null
                    || changeList.getChanges().size() == 0) {
                presentation.setEnabled(false);

            } else {
                presentation.setEnabled(!checkStylePlugin.isScanInProgress());
            }

        } catch (Throwable e) {
            final CheckStylePluginException processed
                    = CheckStylePlugin.processError(null, e);
View Full Code Here

        if (project == null) {
            return;
        }

        try {
            final CheckStylePlugin checkStylePlugin
                    = project.getComponent(CheckStylePlugin.class);
            if (checkStylePlugin == null) {
                throw new IllegalStateException("Couldn't get checkstyle plugin");
            }
View Full Code Here

            final Project project = DataKeys.PROJECT.getData(event.getDataContext());
            if (project == null) { // check if we're loading...
                return;
            }

            final CheckStylePlugin checkStylePlugin
                    = project.getComponent(CheckStylePlugin.class);
            if (checkStylePlugin == null) {
                throw new IllegalStateException("Couldn't get checkstyle plugin");
            }

            final boolean scanOnlyJavaFiles = !checkStylePlugin.getConfiguration().isScanningNonJavaFiles();
            final VirtualFile selectedFile = getSelectedFile(project);

            // disable if no files are selected
            final Presentation presentation = event.getPresentation();
            if (selectedFile == null) {
                presentation.setEnabled(false);

            } else if (scanOnlyJavaFiles) {
                // check files are valid
                if (!CheckStyleUtilities.isJavaFile(selectedFile.getFileType())) {
                    presentation.setEnabled(false);
                    return;
                }

                presentation.setEnabled(!checkStylePlugin.isScanInProgress());
            }
        } catch (Throwable e) {
            CheckStylePlugin.processErrorAndLog("Current File button update", e);
        }
    }
View Full Code Here

        final Project project = DataKeys.PROJECT.getData(event.getDataContext());
        if (project == null) {
            return;
        }

        final CheckStylePlugin checkStylePlugin
                = project.getComponent(CheckStylePlugin.class);
        if (checkStylePlugin == null) {
            throw new IllegalStateException("Couldn't get checkstyle plugin");
        }
View Full Code Here

        if (project == null) {
            LOG.error("Could not get project for check-in panel, skipping");
            return ReturnResult.COMMIT;
        }

        final CheckStylePlugin plugin = project.getComponent(CheckStylePlugin.class);
        if (plugin == null) {
            LOG.error("Could not get CheckStyle Plug-in, skipping");
            return ReturnResult.COMMIT;
        }

        if (plugin.getConfiguration().isScanFilesBeforeCheckin()) {
            try {
                final Map<PsiFile, List<ProblemDescriptor>> scanResults = new HashMap<PsiFile, List<ProblemDescriptor>>();
                new Task.Modal(project, getResource("handler.before.checkin.scan.text", "CheckStyle is Scanning"), false) {
                    public void run(@NotNull final ProgressIndicator progressIndicator) {
                        progressIndicator.setText(getResource("handler.before.checkin.scan.in-progress", "Scanning..."));
                        progressIndicator.setIndeterminate(true);
                        plugin.scanFiles(new ArrayList<VirtualFile>(checkinPanel.getVirtualFiles()), scanResults);
                    }
                }.queue();

                if (!scanResults.isEmpty()) {
                    return processScanResults(scanResults, executor, plugin);
View Full Code Here

        if (project == null) {
            LOG.error("Could not get project for check-in panel");
            return null;
        }

        final CheckStylePlugin plugin = project.getComponent(CheckStylePlugin.class);
        if (plugin == null) {
            LOG.error("Could not get CheckStyle Plug-in, skipping");
            return null;
        }

        return plugin.getConfiguration();
    }
View Full Code Here

            if (module == null) {
                setProgressText(toolWindow, "plugin.status.in-progress.no-module");
                return;
            }

            final CheckStylePlugin checkStylePlugin
                    = project.getComponent(CheckStylePlugin.class);
            if (checkStylePlugin == null) {
                throw new IllegalStateException("Couldn't get checkstyle plugin");
            }
View Full Code Here

                    selectedFiles[0], project);
            if (module == null) {
                return;
            }

            final CheckStylePlugin checkStylePlugin
                    = project.getComponent(CheckStylePlugin.class);
            if (checkStylePlugin == null) {
                throw new IllegalStateException("Couldn't get checkstyle plugin");
            }

            final ModuleRootManager moduleRootManager
                    = ModuleRootManager.getInstance(module);
            final VirtualFile[] moduleFiles = moduleRootManager.getSourceRoots();

            // disable if no files are selected
            if (moduleFiles.length == 0) {
                presentation.setEnabled(false);

            } else {
                presentation.setEnabled(!checkStylePlugin.isScanInProgress());
            }
        } catch (Throwable e) {
            CheckStylePlugin.processErrorAndLog("Current Module button update", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.infernus.idea.checkstyle.CheckStylePlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.