public void setCloudId(@Nullable String cloudId) { if (cloudId != null && cloudId.indexOf('.') == -1) { Map<String, CloudPlugin> registeredClouds = DetectorFactoryCollection.instance().getRegisteredClouds(); String check = "." + cloudId; int count = 0; String result = cloudId; for(String name : registeredClouds.keySet()) { if (name.endsWith(check)) { count++; result = name; } } if (count == 1) { cloudId = result; } } this.cloudId = cloudId; }
protected void changeClicked() { final List<CloudPlugin> plugins = new ArrayList<CloudPlugin>(); final List<String> descriptions = new ArrayList<String>(); List<CloudPlugin> clouds = new ArrayList<CloudPlugin>(DetectorFactoryCollection.instance().getRegisteredClouds().values()); Collections.sort(clouds, new Comparator<CloudPlugin>() { @Override public int compare(CloudPlugin o1, CloudPlugin o2) { return o1.getDescription().compareToIgnoreCase(o2.getDescription()); } }); for (final CloudPlugin plugin : clouds) { final boolean disabled = isDisabled(plugin); if (!disabled && !plugin.isHidden()) { descriptions.add(plugin.getDescription()); plugins.add(plugin); } } showCloudChooser(plugins, descriptions); }
public static CloudPlugin getCloudPlugin(BugCollection bc) { CloudPlugin plugin = null; Project project = bc.getProject(); assert project != null; String cloudId = project.getCloudId(); if (cloudId != null) { plugin = DetectorFactoryCollection.instance().getRegisteredClouds().get(cloudId); if (plugin == null && FAIL_ON_CLOUD_ERROR) { throw new IllegalArgumentException("Cannot find registered cloud for " + cloudId); } } // is the desired plugin disabled for this project (and/or globally)? if so, skip it. if (plugin != null) { Plugin fbplugin = Plugin.getByPluginId(plugin.getFindbugsPluginId()); //noinspection PointlessBooleanExpression if (fbplugin != null && Boolean.FALSE.equals(project.getPluginStatus(fbplugin))) { plugin = null; // use default cloud below } } if (plugin == null) { if (DEFAULT_CLOUD != null) { LOGGER.log(Level.FINE, "Trying default cloud " + DEFAULT_CLOUD); } cloudId = DEFAULT_CLOUD; plugin = DetectorFactoryCollection.instance().getRegisteredClouds().get(cloudId); } return plugin; }
String cloudId = project.getCloudId(); for (CloudPlugin c : DetectorFactoryCollection.instance().getRegisteredClouds().values()) { String fbid = c.getFindbugsPluginId(); Plugin plugin = Plugin.getByPluginId(fbid); CloudPlugin c = DetectorFactoryCollection.instance().getRegisteredClouds().get(project.getCloudId()); cloudSelector.setSelectedItem(c);