if (file != null && file.exists()) {
IBeansProject project = BeansCorePlugin.getModel().getProject(file.getProject());
Set<IBeansConfig> allConfigs = BeansCorePlugin.getModel().getConfigs(file, true);
for (IBeansConfig config : allConfigs) {
if (config instanceof IImportedBeansConfig) {
IBeansConfig rootBeansConfig = BeansModelUtils.getParentOfClass(config, IBeansConfig.class);
configs.add(rootBeansConfig);
}
}
if (project != null) {
Set<IBeansConfigSet> configSets = project.getConfigSets();
for (IBeansConfigSet configSet : configSets) {
if (configSet.hasConfig(file) || !BeansCoreUtils.isBeansConfig(file)) {
Set<IBeansConfig> bcs = configSet.getConfigs();
configs.addAll(bcs);
}
Set<IBeansConfig> tempConfigs = new HashSet<IBeansConfig>(configs);
for (IBeansConfig config : tempConfigs) {
if (configSet.hasConfig(config.getElementName())) {
Set<IBeansConfig> bcs = configSet.getConfigs();
configs.addAll(bcs);
}
}
}
}
if (BeansCoreUtils.isBeansConfig(file, true)) {
IBeansConfig config = BeansCorePlugin.getModel().getConfig(file);
if (config instanceof IImportedBeansConfig) {
configs.add(BeansModelUtils.getParentOfClass(config, IBeansConfig.class));
}
else {
configs.add(config);