void (Element element) { element.setAttribute(TEXT_ATTRIBUTE_NAME, pattern); if (!looseMatching) { element.setAttribute(LOOSE_MATCHING_ATTRIBUTE_NAME, "false"); } element.setAttribute(RECURSIVE_ATTRIBUTE_NAME, String.valueOf(recursiveSearch)); element.setAttribute(OLD_CASE_SENSITIVE_ATTRIBUTE_NAME, String.valueOf(caseSensitiveMatch)); if (myFileType != null) { element.setAttribute(FILE_TYPE_ATTR_NAME, myFileType.getName()); } else if (myUnknownFileType != null) { element.setAttribute(FILE_TYPE_ATTR_NAME, myUnknownFileType); } if (myDialect != null && (myFileType == null || myFileType.getLanguage() != myDialect)) { element.setAttribute(DIALECT_ATTR_NAME, myDialect.getID()); } if (myPatternContextId != null) { element.setAttribute(PATTERN_CONTEXT_ATTR_NAME, myPatternContextId); } if (scope != null) { element.setAttribute(SCOPE_TYPE, Scopes.getType(scope).toString()).setAttribute(SCOPE_DESCRIPTOR, Scopes.getDescriptor(scope)); } if (!searchInjectedCode) { element.setAttribute(SEARCH_INJECTED_CODE, "false"); } final Set<String> constraintNames = getUsedVariableNames(); for (final MatchVariableConstraint matchVariableConstraint : variableConstraints.values()) { if (!constraintNames.contains(matchVariableConstraint.getName())) { continue; } final Element infoElement = new Element(CONSTRAINT_TAG_NAME); element.addContent(infoElement); matchVariableConstraint.writeExternal(infoElement); } }