private void inspectExtension(ISchema schema, IPluginParent parent, IFile file) { IPluginObject[] children = parent.getChildren(); if (parent instanceof PluginElementNode && parent.getParent() instanceof PluginElementNode) { // check if this node corresponds to a Java type attribute which would have been defined has // an element PluginElementNode node = (PluginElementNode) parent; PluginElementNode parentNode = (PluginElementNode) parent.getParent(); ISchemaElement schemaElement = schema.findElement(parentNode.getName()); if (schemaElement != null) { ISchemaAttribute attInfo = schemaElement.getAttribute(node.getName()); if (attInfo != null && attInfo.getKind() == IMetaAttribute.JAVA) checkMatch(node.getAttribute("class"), file); // $NON-NLS-1$ } } for (int i = 0; i < children.length; i++) { IPluginElement child = (IPluginElement) children[i]; ISchemaElement schemaElement = schema.findElement(child.getName()); if (schemaElement != null) { IPluginAttribute[] attributes = child.getAttributes(); for (int j = 0; j < attributes.length; j++) { IPluginAttribute attr = attributes[j]; ISchemaAttribute attInfo = schemaElement.getAttribute(attr.getName()); if (attInfo != null && attInfo.getKind() == IMetaAttribute.JAVA && attr instanceof IDocumentAttributeNode) checkMatch(attr, file); } } inspectExtension(schema, child, file); } }
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)); } }