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 void convert(Element element) { initInspectionTools(); final Element scopes = element.getChild(DefaultProjectProfileManager.SCOPES); if (scopes != null) { final List children = scopes.getChildren(SCOPE); if (children != null) { for (Object s : children) { Element scopeElement = (Element) s; final String profile = scopeElement.getAttributeValue(DefaultProjectProfileManager.PROFILE); if (profile != null) { final InspectionProfileImpl inspectionProfile = (InspectionProfileImpl) getProfileManager().getProfile(profile); if (inspectionProfile != null) { final NamedScope scope = getProfileManager() .getScopesManager() .getScope(scopeElement.getAttributeValue(NAME)); if (scope != null) { for (InspectionProfileEntry entry : inspectionProfile.getInspectionTools(null)) { final HighlightDisplayKey key = HighlightDisplayKey.find(entry.getShortName()); try { getTools(entry.getShortName()) .addTool( scope, copyToolSettings((InspectionTool) entry), inspectionProfile.isToolEnabled(key), inspectionProfile.getErrorLevel(key, (NamedScope) null)); } catch (Exception e) { LOG.error(e); } } } } } } reduceConvertedScopes(); } } }