public Map getAllAttsValues()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/common/model/IvyFile.java [150:192]


    public Map<String, String> getAllAttsValues(int documentOffset) {
        Map<String, String> result = new HashMap<>();

        int start = reversed.indexOf('<', getReverseOffset(documentOffset));
        if (start != -1) {
            start = getReverseOffset(start);
        } else {
            start = 0;
        }
        int end;
        if (doc.charAt(documentOffset) == '>' && getAttributeName(documentOffset) == null) {
            end = documentOffset + 1;
        } else {
            Pattern p = Pattern.compile("[^\\-]>");
            Matcher m = p.matcher(doc);
            if (m.find(documentOffset)) {
                end = m.end();
            } else {
                end = doc.length();
            }
        }
        Pattern regexp = ATTRIBUTE_VALUE_PATTERN;
        try {
            String tag = doc.substring(start, end);
            tag = tag.substring(tag.indexOf(' '));
            Matcher m = regexp.matcher(tag);
            while (m.find()) {
                String key = m.group(1);
                String val = m.group(2);
                result.put(key, val);
                if (m.end() + m.group(0).length() < tag.length()) {
                    tag = tag.substring(m.end());
                    m = regexp.matcher(tag);
                }
            }
        } catch (Exception e) {
            // FIXME : what is really caught here ?
            if (settings != null) {
                settings.logError("Something bad happened", e);
            }
        }
        return result;
    }