/**
  * Unregisters listener from this cache. The listener is removed from all models to which it has
  * been added.
  */
 public void removeListener(XModelTreeListener listener) {
   listeners.remove(listener);
   Collection<Map<XModel, XFilteredTree>> i1 = map.values();
   for (Map<XModel, XFilteredTree> m : i1) {
     Collection<XFilteredTree> i2 = m.values();
     for (XFilteredTree t : i2) {
       XModel model = t.getRoot().getModel();
       if (model != null) model.removeModelTreeListener(listener);
     }
   }
 }
 XFilteredTree createTree(String name, XModel model) {
   if (model == null || name == null) return null;
   String classname =
       model.getMetaData().getMapping("FilteredTrees").getValue(name); // $NON-NLS-1$
   XFilteredTree result = null;
   try {
     result = (XFilteredTree) ModelFeatureFactory.getInstance().createFeatureInstance(classname);
   } catch (ClassCastException e) {
     ModelUIPlugin.getPluginLog().logError(e);
     return null;
   }
   result.setModel(model);
   if (result.getRoot() == null) {
     result = null;
     IProject p = EclipseResourceUtil.getProject(model.getRoot());
     IModelNature nature = EclipseResourceUtil.getModelNature(p);
     if (nature != null) {
       ModelUIPlugin.getPluginLog()
           .logInfo(
               "Red Hat Project " + p.getName() + " is corrupted."); // $NON-NLS-1$ //$NON-NLS-2$
     }
   }
   return result;
 }