eclipse3.1 release notes at the time indicated a heuristic change to match content types. <sh> This was due to error 90218 , part of error 82986 (improvements for matching in 3.1), which refers to error 86862 ("I need an API to search for related user objects")
This API did not do this, but is reusable.
public Object[] findRelatedObjects(IContentType type, String fileName, IRelatedRegistry registry) { List allRelated = new ArrayList(); // first add any objects directly related to the content type Object[] related = registry.getRelatedObjects(type); for (int i = 0; i < related.length; i++) { allRelated.add(related[i]); } // backward compatibility requested - add any objects related to the file name if (fileName != null) { related = registry.getRelatedObjects(fileName); for (int i = 0; i < related.length; i++) { if (!allRelated.contains(related[i])) { // we don't want to return duplicates allRelated.add(related[i]); } } } // now add any indirectly related objects, walking up the content type hierarchy while ((type = type.getBaseType()) != null) { related = registry.getRelatedObjects(type); for (int i = 0; i < related.length; i++) { if (!allRelated.contains(related[i])) { // we don't want to return duplicates allRelated.add(related[i]); } } } return allRelated.toArray(); }
source share