/** * Returns the set of containers (Project configurations) (project_name;config_id) for the project * descriptions reported as changed by the ICDescriptionDelta * * @param delta * @return String[] of Configuration Reference IDs */ private String[] getContainerIds(ICDescriptionDelta delta) { if (delta == null) return new String[0]; int deltaKind = delta.getDeltaKind(); Set<String> cfgIds = new HashSet<String>(); switch (deltaKind) { case ICDescriptionDelta.ADDED: case ICDescriptionDelta.REMOVED: ICProjectDescription des = (ICProjectDescription) delta.getSetting(); ICConfigurationDescription[] cfgs = des.getConfigurations(); if (cfgs.length != 0) { for (int i = 0; i < cfgs.length; i++) { cfgIds.add(cfgs[i].getId()); } cfgIds.add(ACTIVE_CONFIG_ID); } break; case ICDescriptionDelta.CHANGED: ICDescriptionDelta[] children = delta.getChildren(); collectCfgIds(children, cfgIds); if ((delta.getChangeFlags() & ICDescriptionDelta.ACTIVE_CFG) != 0) cfgIds.add(ACTIVE_CONFIG_ID); break; } String[] ids = new String[cfgIds.size()]; if (ids.length != 0) { String projName = ((ICProjectDescription) delta.getSetting()).getProject().getName(); int i = 0; for (String config : cfgIds) ids[i++] = createId(projName, config); } return ids; }
/** * Return the set of changed {Added, Remove & Changed} configuration IDs as discovered from an * ICDescrptionDelta[] * * @param deltas * @param c * @return */ private Collection<String> collectCfgIds(ICDescriptionDelta[] deltas, Collection<String> c) { for (ICDescriptionDelta delta : deltas) { switch (delta.getDeltaKind()) { case ICDescriptionDelta.ADDED: case ICDescriptionDelta.REMOVED: c.add(delta.getSetting().getId()); break; case ICDescriptionDelta.CHANGED: int changeFlags = delta.getChangeFlags(); if ((changeFlags & (ICDescriptionDelta.EXTERNAL_SETTINGS_ADDED | ICDescriptionDelta.EXTERNAL_SETTINGS_REMOVED)) != 0) { c.add(delta.getSetting().getId()); // If this is the Active configuration, then record it as changed too (bug 312575) if (delta.getSetting().getConfiguration().isActive()) c.add(ACTIVE_CONFIG_ID); } break; } } return c; }