findPusherValuesFromParent extracted

This commit is contained in:
Dmitry Avdeev
2018-01-15 20:11:45 +03:00
parent fecf6a7001
commit 3befb73237
@@ -228,10 +228,7 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater
final T value = pusher.getImmediateValue(project, dir);
if (value != null) return value;
if (moduleValue != null) return moduleValue;
final VirtualFile parent = dir.getParent();
if (parent != null && ProjectFileIndex.getInstance(project).isInContent(parent)) return findPusherValuesUpwards(project, parent, pusher);
T projectValue = pusher.getImmediateValue(project, null);
return projectValue != null? projectValue : pusher.getDefaultValue();
return findPusherValuesFromParent(project, dir, pusher);
}
private static <T> T findPusherValuesUpwards(Project project, VirtualFile dir, FilePropertyPusher<T> pusher) {
@@ -239,6 +236,10 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater
if (userValue != null) return userValue;
final T value = pusher.getImmediateValue(project, dir);
if (value != null) return value;
return findPusherValuesFromParent(project, dir, pusher);
}
private static <T> T findPusherValuesFromParent(Project project, VirtualFile dir, FilePropertyPusher<T> pusher) {
final VirtualFile parent = dir.getParent();
if (parent != null && ProjectFileIndex.getInstance(project).isInContent(parent)) return findPusherValuesUpwards(project, parent, pusher);
T projectValue = pusher.getImmediateValue(project, null);