public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); final String locked = element.getAttributeValue(IS_LOCKED); if (locked != null) { myLockedProfile = Boolean.parseBoolean(locked); } myBaseProfile = getDefaultProfile(); final String version = element.getAttributeValue(VERSION_TAG); if (version == null || !version.equals(VALID_VERSION)) { try { element = InspectionProfileConvertor.convertToNewFormat(element, this); } catch (IOException e) { LOG.error(e); } catch (JDOMException e) { LOG.error(e); } } final Element highlightElement = element.getChild(USED_LEVELS); if (highlightElement != null) { // from old profiles ((SeverityProvider) getProfileManager()) .getOwnSeverityRegistrar() .readExternal(highlightElement); } for (final Object o : element.getChildren(INSPECTION_TOOL_TAG)) { Element toolElement = (Element) o; String toolClassName = toolElement.getAttributeValue(CLASS_TAG); myDeinstalledInspectionsSettings.put(toolClassName, toolElement); } }
@Override public void setProfileManager(@NotNull ProfileManager profileManager) { super.setProfileManager(profileManager); /*final NamedScopesHolder scopesHolder = profileManager.getScopesManager(); if (scopesHolder != null) { scopesHolder.addScopeListener(new NamedScopesHolder.ScopeListener() {//todo scopes change tracking public void scopesChanged() { } }); }*/ }
public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); element.setAttribute(VERSION_TAG, VALID_VERSION); element.setAttribute(IS_LOCKED, String.valueOf(myLockedProfile)); if (!myInitialized) { for (Element el : myDeinstalledInspectionsSettings.values()) { element.addContent((Element) el.clone()); } return; } Map<String, Boolean> diffMap = getDisplayLevelMap(); if (diffMap != null) { diffMap = new TreeMap<String, Boolean>(diffMap); for (String toolName : myDeinstalledInspectionsSettings.keySet()) { diffMap.put(toolName, false); } for (final String toolName : diffMap.keySet()) { if (!myLockedProfile && diffMap.get(toolName).booleanValue()) continue; final Element toolElement = myDeinstalledInspectionsSettings.get(toolName); if (toolElement == null) { final ToolsImpl toolList = myTools.get(toolName); LOG.assertTrue(toolList != null); final Element inspectionElement = new Element(INSPECTION_TOOL_TAG); inspectionElement.setAttribute(CLASS_TAG, toolName); toolList.writeExternal(inspectionElement); element.addContent(inspectionElement); } else { element.addContent((Element) toolElement.clone()); } } } }
public void copyFrom(InspectionProfile profile) { super.copyFrom(profile); final InspectionProfileImpl inspectionProfile = (InspectionProfileImpl) profile; myBaseProfile = inspectionProfile.myBaseProfile; }