Package org.infernus.idea.checkstyle.model

Examples of org.infernus.idea.checkstyle.model.ConfigurationLocation


        if (module == null) {
            return null;
        }

        ConfigurationLocation configurationLocation = null;
        try {
            configurationLocation = getConfigurationLocation(module, checkStylePlugin);
            if (configurationLocation == null) {
                return null;
            }

            if (configurationLocation.isBlacklisted()) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Configuration is blacklisted, skipping: " + configurationLocation);
                }
                return null;
            }

            LOG.info("Loading configuration from " + configurationLocation);
            return getCheckerFactory().getChecker(configurationLocation, module);

        } catch (Exception e) {
            LOG.error("Checker could not be created.", e);

            if (configurationLocation != null) {
                configurationLocation.blacklist();
            }

            throw new CheckStylePluginException("Couldn't create Checker", e);
        }
    }
View Full Code Here


        return ServiceManager.getService(CheckerFactory.class);
    }

    private ConfigurationLocation getConfigurationLocation(final Module module,
                                                           final CheckStylePlugin checkStylePlugin) {
        final ConfigurationLocation configurationLocation;
        if (module != null) {
            final CheckStyleModuleConfiguration moduleConfiguration
                    = ModuleServiceManager.getService(module, CheckStyleModuleConfiguration.class);
            if (moduleConfiguration == null) {
                throw new IllegalStateException("Couldn't get checkstyle module configuration");
View Full Code Here

    private Configuration getConfig(final CheckStylePlugin checkStylePlugin,
                                    final Module module) {
        LOG.debug("Getting CheckStyle checker for inspection.");

        try {
            final ConfigurationLocation configurationLocation = getConfigurationLocation(module, checkStylePlugin);
            if (configurationLocation == null) {
                return null;
            }

            LOG.info("Loading configuration from " + configurationLocation);
View Full Code Here

        public void actionPerformed(final ActionEvent event) {
            final ResourceBundle resources = ResourceBundle.getBundle(CheckStyleConstants.RESOURCE_BUNDLE);

            commitButton.setEnabled(false);

            final ConfigurationLocation location;
            switch (currentStep) {
                case SELECT:
                    location = locationPanel.getConfigurationLocation();
                    if (location == null) {
                        showError(resources, resources.getString("config.file.no-file"));
                        return;
                    }

                    if (location.getDescription() == null || location.getDescription().isEmpty()) {
                        showError(resources, resources.getString("config.file.no-description"));
                        return;
                    }

                    Map<String, String> properties;
                    try {
                        location.resolve();
                        properties = location.getProperties();

                    } catch (IOException e) {
                        final String message = resources.getString("config.file.resolve-failed");
                        final String formattedMessage = new MessageFormat(message).format(new Object[]{e.getMessage()});
                        showError(resources, formattedMessage);
View Full Code Here

        return columnIndex == COLUMN_ACTIVE;
    }

    @Override
    public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) {
        final ConfigurationLocation rowLocation = locations.get(rowIndex);

        switch (columnIndex) {
            case COLUMN_ACTIVE:
                updateActiveLocation(rowLocation, rowIndex, true);
                break;
View Full Code Here

                                                                        final List<ScannableFile> tempFiles,
                                                                        final Map<String, PsiFile> filesToElements,
                                                                        final ConfigurationLocation override) {
        final InspectionManager manager = InspectionManager.getInstance(module.getProject());

        final ConfigurationLocation location = getConfigurationLocation(module, override);
        if (location == null) {
            configurationLocationStatus = ConfigurationLocationStatus.NOT_PRESENT;
            return null;
        }

        if (location.isBlacklisted()) {
            configurationLocationStatus = ConfigurationLocationStatus.BLACKLISTED;
            return null;
        }

        final CheckerContainer checkerContainer = getChecker(module, moduleClassLoader, location);
View Full Code Here

            final LocationDialogue dialogue = new LocationDialogue(project, getThirdPartyClasspath());

            dialogue.setVisible(true);

            if (dialogue.isCommitted()) {
                final ConfigurationLocation newLocation = dialogue.getConfigurationLocation();
                if (locationModel.getLocations().contains(newLocation)) {
                    final ResourceBundle resources = ResourceBundle.getBundle(
                            CheckStyleConstants.RESOURCE_BUNDLE);

                    Messages.showWarningDialog(project,
View Full Code Here

            final int selectedIndex = locationTable.getSelectedRow();
            if (selectedIndex == -1) {
                return;
            }

            final ConfigurationLocation location = locationModel.getLocationAt(selectedIndex);

            final PropertiesDialogue propertiesDialogue = new PropertiesDialogue(project);
            propertiesDialogue.setConfigurationLocation(location);

            propertiesDialogue.setVisible(true);

            if (propertiesDialogue.isCommitted()) {
                final ConfigurationLocation editedLocation = propertiesDialogue.getConfigurationLocation();
                locationModel.updateLocation(location, editedLocation);
            }
        }
View Full Code Here

        if (!containsKey(ACTIVE_CONFIG)) {
            return getProjectConfiguration();
        }

        ConfigurationLocation activeLocation = null;
        try {
            activeLocation = configurationLocationFactory(module.getProject()).create(module.getProject(), getProperty(ACTIVE_CONFIG));
        } catch (IllegalArgumentException e) {
            LOG.warn("Could not load active configuration", e);
        }
View Full Code Here

        }

        this.project = project;

        final ResourceBundle resources = ResourceBundle.getBundle(CheckStyleConstants.RESOURCE_BUNDLE);
        final ConfigurationLocation checkStyleSunChecks = configurationLocationFactory().create(project, ConfigurationType.CLASSPATH,
                SUN_CHECKS_CONFIG, resources.getString("file.default.description"));
        presetLocations.add(checkStyleSunChecks);
    }
View Full Code Here

TOP

Related Classes of org.infernus.idea.checkstyle.model.ConfigurationLocation

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.