use of org.jetbrains.idea.maven.utils.Url in project intellij-community by JetBrains.
the class MavenRootModelAdapter method addSourceFolder.
private <P extends JpsElement> void addSourceFolder(@NotNull String path, @NotNull final JpsModuleSourceRootType<P> rootType, boolean ifNotEmpty, @NotNull final P properties) {
if (ifNotEmpty) {
String[] childs = new File(toPath(path).getPath()).list();
if (childs == null || childs.length == 0)
return;
} else {
if (!exists(path))
return;
}
Url url = toUrl(path);
myRootModelModuleExtension.addSourceFolder(url, rootType, properties);
}
use of org.jetbrains.idea.maven.utils.Url in project intellij-community by JetBrains.
the class MavenRootModelAdapter method hasCollision.
public boolean hasCollision(String sourceRootPath) {
Url url = toUrl(sourceRootPath);
for (ContentEntry eachEntry : myRootModel.getContentEntries()) {
for (SourceFolder eachFolder : eachEntry.getSourceFolders()) {
String ancestor = url.getUrl();
String child = eachFolder.getUrl();
if (VfsUtilCore.isEqualOrAncestor(ancestor, child) || VfsUtilCore.isEqualOrAncestor(child, ancestor)) {
return true;
}
}
for (String excludeUrl : eachEntry.getExcludeFolderUrls()) {
String ancestor = url.getUrl();
if (VfsUtilCore.isEqualOrAncestor(ancestor, excludeUrl) || VfsUtilCore.isEqualOrAncestor(excludeUrl, ancestor)) {
return true;
}
}
}
return false;
}
use of org.jetbrains.idea.maven.utils.Url in project intellij-community by JetBrains.
the class MavenRootModelAdapter method unregisterAll.
public void unregisterAll(String path, boolean under, boolean unregisterSources) {
Url url = toUrl(path);
for (ContentEntry eachEntry : myRootModel.getContentEntries()) {
if (unregisterSources) {
myRootModelModuleExtension.unregisterAll(url, under);
}
for (String excludedUrl : eachEntry.getExcludeFolderUrls()) {
String ancestor = under ? url.getUrl() : excludedUrl;
String child = under ? excludedUrl : url.getUrl();
if (VfsUtilCore.isEqualOrAncestor(ancestor, child)) {
eachEntry.removeExcludeFolder(excludedUrl);
}
}
for (String outputUrl : getCompilerExtension().getOutputRootUrls(true)) {
String ancestor = under ? url.getUrl() : outputUrl;
String child = under ? outputUrl : url.getUrl();
if (VfsUtilCore.isEqualOrAncestor(ancestor, child)) {
getCompilerExtension().setExcludeOutput(false);
}
}
}
}
use of org.jetbrains.idea.maven.utils.Url in project intellij-community by JetBrains.
the class MavenRootModelAdapter method addExcludedFolder.
public void addExcludedFolder(String path) {
unregisterAll(path, true, false);
Url url = toUrl(path);
ContentEntry e = getContentRootFor(url);
if (e == null)
return;
if (e.getUrl().equals(url.getUrl()))
return;
e.addExcludeFolder(url.getUrl());
if (!Registry.is("ide.hide.excluded.files")) {
Project project = myRootModel.getProject();
ChangeListManager.getInstance(project).addDirectoryToIgnoreImplicitly(toPath(path).getPath());
}
}
use of org.jetbrains.idea.maven.utils.Url in project intellij-community by JetBrains.
the class MavenRootModelAdapter method initContentRoots.
private void initContentRoots() {
Url url = toUrl(myMavenProject.getDirectory());
if (getContentRootFor(url) != null)
return;
myRootModel.addContentEntry(url.getUrl());
}
Aggregations