@Override public void delete() { m_addressSpace.removeListener(m_addressSpaceListener); if (m_addressSpace.isLoaded()) { m_addressSpace.getContent().removeListener(m_contentListener); for (final INaviModule module : m_addressSpace.getContent().getModules()) { module.removeListener(m_modulesListener); } } }
/** * Creates a new model object. * * @param addressSpace The address space that provides the modules. */ public CProjectModulesModel(final INaviAddressSpace addressSpace) { Preconditions.checkNotNull(addressSpace, "IE01955: Address space argument can't be null"); m_addressSpace = addressSpace; addressSpace.addListener(m_addressSpaceListener); if (addressSpace.isLoaded()) { addressSpace.getContent().addListener(m_contentListener); for (final INaviModule module : addressSpace.getContent().getModules()) { module.addListener(m_modulesListener); } } }
/** * Returns the currently displayed modules. * * @return The currently displayed modules. */ public List<INaviModule> getModules() { List<INaviModule> localCachedValues = m_cachedValues; if (localCachedValues == null) { final IFilter<INaviModule> filter = getFilter(); if (m_addressSpace.isLoaded()) { localCachedValues = filter == null ? m_addressSpace.getContent().getModules() : filter.get(m_addressSpace.getContent().getModules()); } else { localCachedValues = new ArrayList<INaviModule>(); } } m_cachedValues = localCachedValues; return new ArrayList<INaviModule>(localCachedValues); }