private void inspectBundle(IBundle bundle) { for (int i = 0; i < H_TOTAL; i++) { if (fSearchFor == S_FOR_TYPES && (i == H_IMP || i == H_EXP)) continue; IManifestHeader header = bundle.getManifestHeader(SEARCH_HEADERS[i]); if (header != null) { try { ManifestElement[] elements = ManifestElement.parseHeader(header.getName(), header.getValue()); if (elements == null) continue; for (int j = 0; j < elements.length; j++) { String value = null; Matcher matcher = null; if (fSearchFor == S_FOR_TYPES) { value = elements[j].getValue(); matcher = getMatcher(value); } if (value == null || (matcher != null && !matcher.matches())) { value = getProperValue(elements[j].getValue()); matcher = getMatcher(value); } if (matcher.matches()) { String group = matcher.group(0); int[] offlen; offlen = getOffsetOfElement(bundle, header, group); fSearchRequestor.reportMatch( new Match( bundle.getModel().getUnderlyingResource(), Match.UNIT_CHARACTER, offlen[0], offlen[1])); break; // only one package will be listed per header } } } catch (BundleException e) { } } } }
private void checkMatch(IPluginAttribute attr, IFile file) { String value = null; Matcher matcher = null; if (fSearchFor == S_FOR_TYPES) { value = removeInitializationData(attr.getValue()) .replaceAll("\\$", "."); // $NON-NLS-1$ //$NON-NLS-2$ matcher = getMatcher(value); } if (value == null || (matcher != null && !matcher.matches())) { value = removeInitializationData(getProperValue(attr.getValue())) .replaceAll("\\$", "."); // $NON-NLS-1$ //$NON-NLS-2$ matcher = getMatcher(value); } if (matcher.matches()) { String group = matcher.group(0); int offset = ((IDocumentAttributeNode) attr).getValueOffset() + value.indexOf(group); int attOffset = attr.getValue().indexOf(value); if (attOffset != -1) offset += attOffset; int length = group.length(); fSearchRequestor.reportMatch(new Match(file, Match.UNIT_CHARACTER, offset, length)); } }