private InspectionTool copyToolSettings(InspectionTool tool) throws WriteExternalException, InvalidDataException { @NonNls String tempRoot = "config"; Element config = new Element(tempRoot); tool.writeSettings(config); final InspectionTool inspectionTool = myRegistrar.createInspectionTool(tool.getShortName(), tool); inspectionTool.readSettings(config); return inspectionTool; }
private boolean initialize() { if (myBaseProfile != null) { myBaseProfile.initInspectionTools(); } final List<InspectionTool> tools; try { tools = myRegistrar.createTools(); } catch (ProcessCanceledException e) { return false; } for (InspectionTool tool : tools) { final String shortName = tool.getShortName(); HighlightDisplayKey key = HighlightDisplayKey.find(shortName); if (key == null) { if (tool instanceof LocalInspectionToolWrapper) { key = HighlightDisplayKey.register( shortName, tool.getDisplayName(), ((LocalInspectionToolWrapper) tool).getID(), ((LocalInspectionToolWrapper) tool).getAlternativeID()); } else { key = HighlightDisplayKey.register(shortName, tool.getDisplayName()); } } LOG.assertTrue(key != null, shortName + " ; number of initialized tools: " + myTools.size()); final ToolsImpl toolsList = new ToolsImpl( tool, myBaseProfile != null ? myBaseProfile.getErrorLevel(key) : tool.getDefaultLevel(), !myLockedProfile && (myBaseProfile != null ? myBaseProfile.isToolEnabled(key) : tool.isEnabledByDefault())); final Element element = myDeinstalledInspectionsSettings.remove(tool.getShortName()); if (element != null) { try { toolsList.readExternal(element, this); } catch (InvalidDataException e) { LOG.error(e); } } myTools.put(tool.getShortName(), toolsList); } if (mySource != null) { copyToolsConfigurations(mySource); } return true; }
public InspectionProfileImpl(@NonNls String name) { super(name); myRegistrar = InspectionToolRegistrar.getInstance(); setProfileManager(InspectionProfileManager.getInstance()); }