本文整理汇总了Java中edu.umd.cs.findbugs.Plugin.getByPluginId方法的典型用法代码示例。如果您正苦于以下问题:Java Plugin.getByPluginId方法的具体用法?Java Plugin.getByPluginId怎么用?Java Plugin.getByPluginId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.Plugin
的用法示例。
在下文中一共展示了Plugin.getByPluginId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
import edu.umd.cs.findbugs.Plugin; //导入方法依赖的package包/类
/**
*
* @param path
* non null, full abstract path in the local file system
* @return {@link Status#OK_STATUS} in case that given path might be a valid
* FindBugs detector package (jar file containing bugrank.txt,
* findbugs.xml, messages.xml and at least one class file). Returns
* error status in case anything goes wrong or file at given path is
* not considered as a valid plugin.
*/
@Nonnull
public ValidationStatus validate(String path) {
File file = new File(path);
Summary sum = null;
try {
sum = PluginLoader.validate(file);
} catch (IllegalArgumentException e) {
if(FindbugsPlugin.getDefault().isDebugging()) {
e.printStackTrace();
}
return new ValidationStatus(IStatus.ERROR,
"Invalid FindBugs plugin archive: " + e.getMessage(), sum, e);
}
Plugin loadedPlugin = Plugin.getByPluginId(sum.id);
URI uri = file.toURI();
if(loadedPlugin != null && !uri.equals(loadedPlugin.getPluginLoader().getURI())
&& loadedPlugin.isGloballyEnabled()) {
return new ValidationStatus(IStatus.ERROR, "Duplicated FindBugs plugin: " + sum.id + ", already loaded from: "
+ loadedPlugin.getPluginLoader().getURI(), sum, null);
}
return new ValidationStatus(IStatus.OK, Status.OK_STATUS.getMessage(), sum, null);
}
示例2: enablePlugins
import edu.umd.cs.findbugs.Plugin; //导入方法依赖的package包/类
private static void enablePlugins(Iterable<String> plugins, boolean enabled) {
for (String pid : plugins) {
Plugin plugin = Plugin.getByPluginId(pid);
if (plugin != null) {
if (plugin.cannotDisable())
JOptionPane.showMessageDialog(null,
"Cannot disable plugin: " + plugin.getPluginId() + "\n" + plugin.getShortDescription(),
"Cannot disable plugin", JOptionPane.ERROR_MESSAGE);
else
plugin.setGloballyEnabled(enabled);
}
}
}
示例3: enablePlugins
import edu.umd.cs.findbugs.Plugin; //导入方法依赖的package包/类
/**
* Enables or disables a FindBugs plugin.
*
* @param plugins
* @param enabled
*/
protected void enablePlugins(String pluginId, boolean enabled) {
Plugin plugin = Plugin.getByPluginId(pluginId);
if (plugin != null) {
if (!enabled && plugin.cannotDisable()) {
fail("Cannot disable plugin: " + plugin.getPluginId() + '\n' + plugin.getShortDescription());
} else {
plugin.setGloballyEnabled(enabled);
}
}
}
示例4: checkFBContribInstalled
import edu.umd.cs.findbugs.Plugin; //导入方法依赖的package包/类
private static void checkFBContribInstalled() {
fb_contribInstalled = Plugin.getByPluginId("com.mebigfatguy.fbcontrib") != null;
System.out.printf("fb-contrib (com.mebigfatguy.fbcontrib) is %sinstalled%n", fb_contribInstalled ? "": "not ");
}
示例5: checkFindSecurityBugsInstalled
import edu.umd.cs.findbugs.Plugin; //导入方法依赖的package包/类
private static void checkFindSecurityBugsInstalled() {
findSecurityBugsInstalled = Plugin.getByPluginId("com.h3xstream.findsecbugs") != null;
System.out.printf("Find Security Bugs (com.h3xstream.findsecbugs) is %sinstalled%n", findSecurityBugsInstalled ? "": "not ");
}