/** Adds a resource changed listener to the managed method library resources. */ protected void addResourceChangedListeners() { if (library == null || library.eResource() == null) { return; } if (!library.eResource().eAdapters().contains(resourceChangedListener)) { library.eResource().eAdapters().add(resourceChangedListener); } for (Iterator it = library.getMethodPlugins().iterator(); it.hasNext(); ) { MethodPlugin plugin = (MethodPlugin) it.next(); if (!plugin.eResource().eAdapters().contains(resourceChangedListener)) { plugin.eResource().eAdapters().add(resourceChangedListener); } } for (Iterator it = library.getPredefinedConfigurations().iterator(); it.hasNext(); ) { MethodConfiguration config = (MethodConfiguration) it.next(); if (!config.eResource().eAdapters().contains(resourceChangedListener)) { config.eResource().eAdapters().add(resourceChangedListener); } } }
/** * Removes the resource changed listener to the managed method library resource and method * plug-ins. */ protected void removeResourceChangedListeners() { if (library == null || library.eResource() == null) { return; } library.eResource().eAdapters().remove(resourceChangedListener); for (Iterator iter = library.getMethodPlugins().iterator(); iter.hasNext(); ) { MethodPlugin plugin = (MethodPlugin) iter.next(); plugin.eResource().eAdapters().remove(resourceChangedListener); } for (Iterator it = library.getPredefinedConfigurations().iterator(); it.hasNext(); ) { MethodConfiguration config = (MethodConfiguration) it.next(); config.eResource().eAdapters().remove(resourceChangedListener); } }