Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.Plugin


        String redirect = dfc.getGlobalOption(KEY_REDIRECT_ALL_UPDATE_CHECKS);
        String sysprop = System.getProperty("findbugs.redirectUpdateChecks");
        if (sysprop != null) {
            redirect = sysprop;
        }
        Plugin setter = dfc.getGlobalOptionSetter(KEY_REDIRECT_ALL_UPDATE_CHECKS);
        URI redirectUri = null;
        String pluginName = setter == null ? "<unknown plugin>" : setter.getShortDescription();
        if (redirect != null && !redirect.trim().equals("")) {
            try {
                redirectUri = new URI(redirect);
                logError(Level.INFO, "Redirecting all plugin update checks to " + redirectUri + " (" + pluginName + ")");
View Full Code Here


        return ENV_FB_NO_UPDATE_CHECKS || getPluginThatDisabledUpdateChecks() != null;
    }

    public String getPluginThatDisabledUpdateChecks() {
        String disable = dfc.getGlobalOption(KEY_DISABLE_ALL_UPDATE_CHECKS);
        Plugin setter = dfc.getGlobalOptionSetter(KEY_DISABLE_ALL_UPDATE_CHECKS);
        String pluginName = setter == null ? "<unknown plugin>" : setter.getShortDescription();
        String disablingPlugin = null;
        if ("true".equalsIgnoreCase(disable)) {
            logError(Level.INFO, "Skipping update checks due to " + KEY_DISABLE_ALL_UPDATE_CHECKS + "=true set by "
                    + pluginName);
            disablingPlugin = pluginName;
View Full Code Here

            for (Plugin p : plugins) {
                map.put(p.getPluginId(), p);
            }
            for (Element pluginEl : pluginEls) {
                String id = pluginEl.attributeValue("id");
                Plugin plugin = map.get(id);
                if (plugin != null) {
                    checkPlugin(pluginEl, plugin);
                }

            }
View Full Code Here

        if (!pluginFile.getName().endsWith(".jar")) {
          continue;
        }
        try {
          if (FindBugsCustomPluginUtil.check(pluginFile)) {
            Plugin plugin = FindBugsCustomPluginUtil.loadTemporary(pluginFile);
            if (plugin == null) {
              handleError("Could not load plugin: " + pluginFile.getPath());
              continue;
            }
            seenBundledPlugin(plugin);
            if (!disabledBundledPluginIds.contains(plugin.getPluginId()) && enabledBundledPluginIds.contains(plugin.getPluginId())) {
              enabledBundledPluginUrls.add(FindBugsCustomPluginUtil.getAsString(plugin));
            }
            FindBugsCustomPluginUtil.unload(plugin);
          } else {
            handleError("Plugin '" + pluginFile.getPath() + "' not loaded. Archive inaccessible.");
          }
        } catch (final Exception e) {
          handleError("Could not load custom findbugs plugin: " + pluginFile.getPath(), e);
        }
      }
    }


    // 3. load user plugins and unload
    final Set<String> enabledUserPluginUrls = new HashSet<String>();
    for (final String pluginUrl : userPluginsUrls) {
      try {
        final File pluginFile = FindBugsCustomPluginUtil.getAsFile(pluginUrl);
        if (FindBugsCustomPluginUtil.check(pluginFile)) {
          final Plugin plugin = FindBugsCustomPluginUtil.loadTemporary(pluginUrl);
          if (plugin == null) {
            handleError("Could not load plugin: " + pluginUrl);
            continue;
          }
          seenUserPlugin(plugin);
          if (!disabledUserPluginIds.contains(plugin.getPluginId())) {
            enabledUserPluginUrls.add(pluginUrl);
          }
          FindBugsCustomPluginUtil.unload(plugin);
        } else {
          handleError("Plugin '" + pluginUrl + "' not loaded. Archive '" + pluginFile.getPath() + "' inaccessible or not exists.");
View Full Code Here


  private void loadPluginsPermanently(final Set<String> pluginUrls, final boolean userPlugins) {
    for (final String pluginUrl : pluginUrls) {
      try {
        final Plugin plugin = FindBugsCustomPluginUtil.loadPermanently(pluginUrl);
        if (plugin == null) {
          handleError("Could not load plugin: " + pluginUrl);
          continue;
        }
        pluginPermanentlyLoaded(plugin, userPlugins);
View Full Code Here

  }


  private static Plugin loadTemporary(@NotNull final URL plugin) throws MalformedURLException, PluginException {
    final PluginLoader pluginLoader = PluginLoader.getPluginLoader(plugin, PluginLoader.class.getClassLoader(), false, true);
    final Plugin ret = pluginLoader.loadPlugin();
    if (ret != null) {
      ret.setGloballyEnabled(true);
    }
    return ret;
  }
View Full Code Here

  }


  @Nullable
  public static Plugin loadPermanently(@NotNull final URL plugin) throws PluginException {
    final Plugin ret = Plugin.loadCustomPlugin(plugin, null);
    if (ret != null) {
      ret.setGloballyEnabled(true);
    }
    return ret;
  }
View Full Code Here

    final DetectorFactoryCollection detectorFactoryCollection = FindBugsPreferences.getDetectorFactorCollection();

    final Iterator<DetectorFactory> iterator = detectorFactoryCollection.factoryIterator();
    while (iterator.hasNext()) {
      final DetectorFactory factory = iterator.next();
      final Plugin plugin = factory.getPlugin();
      final boolean enabledByUser = Boolean.valueOf(getDetectors().get(factory.getShortName()));
      final boolean enable = enabledByUser && plugin.isGloballyEnabled();
      getUserPreferences().enableDetector(factory, enable);
    }

    // DO NOT DO THIS HERE:
    //_detectors = getAvailableDetectors(getUserPreferences());
View Full Code Here

      if (factory != null) {
        // Only configure non-hidden factories
        if (factory.isHidden() && !getHiddenCheckBox().isSelected()) {
          continue;
        }
        final Plugin plugin = factory.getPlugin();
        if (!plugin.isCorePlugin() && !plugin.isGloballyEnabled()) {
          continue;
        }
        _bugPatternModel.add(factory);
      }
    }
View Full Code Here


  private void doAddPlugin(final File selectedFile) {
    try {
      // TODO CUSTOM_PLUGIN: check what happen when a plugin with same pluginId is already loaded ?
      final Plugin plugin = FindBugsCustomPluginUtil.loadTemporary(selectedFile);
      if (plugin == null) {
        Messages.showErrorDialog(_parent, "Can not load plugin " + selectedFile.getPath(), "Plugin Loading");
        return;
      }
      try {
        final int answer = Messages.showYesNoDialog(_parent, "Add plugin '" + plugin.getPluginId() + "'?", "Add Plugin", null);
        if (answer == Messages.YES) {
          _preferences.addUserPlugin(FindBugsCustomPluginUtil.getAsString(plugin), plugin.getPluginId(), true);
          updatePreferences();
          _preferences.setModified(true);
        }
      } finally {
        FindBugsCustomPluginUtil.unload(plugin);
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.Plugin

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.