// Check for duplicate profile names
for (int i = 0; i < myRoot.getChildCount(); i++) {
final MyNode node = (MyNode) myRoot.getChildAt(i);
final LessProfileConfigurableForm form = (LessProfileConfigurableForm) node.getConfigurable();
final LessProfile profile = form.getCurrentState();
final String name = profile.getName();
final String dirPath = profile.getLessDirPath();
if (StringUtils.isBlank(name)) {
selectNodeInTree(name);
throw new ConfigurationException(UIBundle.message("blank.less.profile.name"));
}
if (names.contains(name)) {
selectNodeInTree(name);
throw new ConfigurationException(UIBundle.message("duplicate.less.profile.name", name));
}
if (StringUtils.isBlank(dirPath)) {
selectNodeInTree(name);
throw new ConfigurationException(UIBundle.message("blank.less.profile.source.dir"));
}
if (!profile.getLessDir().exists()) {
if (!confirmWarning(UIBundle.message("nonexistent.less.profile.source.dir.title"),
UIBundle.message("nonexistent.less.profile.source.dir.prompt", dirPath))) {
selectNodeInTree(name);
throw new ConfigurationException(UIBundle.message("nonexistent.less.profile.source.dir.error", dirPath));
}
}
if (profile.getCssDirectories().isEmpty()) {
selectNodeInTree(name);
throw new ConfigurationException(UIBundle.message("no.less.profile.css.dirs"));
}
for (final CssDirectory cssDirectory : profile.getCssDirectories()) {
if (!new File(cssDirectory.getPath()).exists()) {
if (!confirmWarning(UIBundle.message("nonexistent.less.profile.css.dir.title"),
UIBundle.message("nonexistent.less.profile.css.dir.prompt", dirPath))) {
selectNodeInTree(name);
throw new ConfigurationException(UIBundle.message("nonexistent.less.profile.css.dir.error", dirPath));