本文整理汇总了Java中consulo.roots.impl.ProductionContentFolderTypeProvider类的典型用法代码示例。如果您正苦于以下问题:Java ProductionContentFolderTypeProvider类的具体用法?Java ProductionContentFolderTypeProvider怎么用?Java ProductionContentFolderTypeProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProductionContentFolderTypeProvider类属于consulo.roots.impl包,在下文中一共展示了ProductionContentFolderTypeProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCustomPathToFile
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
private void updateCustomPathToFile() {
if (myCustomPathCheckBox.isSelected()) {
myPathToFileTextField.setText(FileUtil.toSystemDependentName(customPathToFile));
}
else if (getSelectedModule() != null) {
final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(getSelectedModule());
final ModuleCompilerPathsManager compilerPathsManager = ModuleCompilerPathsManager.getInstance(getSelectedModule());
final String url = compilerPathsManager.getCompilerOutputUrl(ProductionContentFolderTypeProvider.getInstance()) + "/" + settings.getOutputFileName();
myPathToFileTextField.setText(FileUtil.toSystemDependentName(VfsUtil.urlToPath(url)));
}
else {
myPathToFileTextField.setText("");
}
myPathToFileTextField.setEnabled(myCustomPathCheckBox.isSelected());
}
示例2: findFileByRelativePath
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@Nullable
private static File findFileByRelativePath(final CompileContext context, final Module module, final String relativePath)
{
VirtualFile output = context.getOutputForFile(module, ProductionContentFolderTypeProvider.getInstance());
File file = output != null ? getFileByRelativeOrNull(output.getPath(), relativePath) : null;
if(file == null)
{
final VirtualFile testsOutput = context.getOutputForFile(module, TestContentFolderTypeProvider.getInstance());
if(testsOutput != null && !testsOutput.equals(output))
{
file = getFileByRelativeOrNull(testsOutput.getPath(), relativePath);
}
}
return file;
}
示例3: addModule
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
public static Module addModule(final Project project, final String name, final VirtualFile root) {
return new WriteCommandAction<Module>(project) {
@Override
protected void run(Result<Module> result) throws Throwable {
final ModifiableModuleModel moduleModel = ModuleManager.getInstance(project).getModifiableModel();
String moduleName = moduleModel.newModule(name, root.getPath()).getName();
moduleModel.commit();
final Module dep = ModuleManager.getInstance(project).findModuleByName(moduleName);
final ModifiableRootModel model = ModuleRootManager.getInstance(dep).getModifiableModel();
final ContentEntry entry = model.addContentEntry(root);
entry.addFolder(root, ProductionContentFolderTypeProvider.getInstance());
model.commit();
result.setResult(dep);
}
}.execute().getResultObject();
}
示例4: getModuleOutputDirectory
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
/**
* @param module
* @param forTestClasses true if directory for test sources, false - for sources.
* @return a directory to which the sources (or test sources depending on the second partameter) should be compiled.
* Null is returned if output directory is not specified or is not valid
*/
@Nullable
public static VirtualFile getModuleOutputDirectory(final Module module, boolean forTestClasses) {
final ModuleCompilerPathsManager manager = ModuleCompilerPathsManager.getInstance(module);
VirtualFile outPath;
if (forTestClasses) {
final VirtualFile path = manager.getCompilerOutput(TestContentFolderTypeProvider.getInstance());
if (path != null) {
outPath = path;
}
else {
outPath = manager.getCompilerOutput(ProductionContentFolderTypeProvider.getInstance());
}
}
else {
outPath = manager.getCompilerOutput(ProductionContentFolderTypeProvider.getInstance());
}
if (outPath == null) {
return null;
}
if (!outPath.isValid()) {
LOGGER.info("Requested output path for module " + module.getName() + " is not valid");
return null;
}
return outPath;
}
示例5: getModuleOutputPath
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
/**
* The same as {@link #getModuleOutputDirectory} but returns String.
* The method still returns a non-null value if the output path is specified in Settings but does not exist on disk.
*/
@Nullable
@Deprecated
public static String getModuleOutputPath(final Module module, final boolean forTestClasses) {
final String outPathUrl;
final Application application = ApplicationManager.getApplication();
final ModuleCompilerPathsManager pathsManager = ModuleCompilerPathsManager.getInstance(module);
if (application.isDispatchThread()) {
outPathUrl = pathsManager.getCompilerOutputUrl(
forTestClasses ? TestContentFolderTypeProvider.getInstance() : ProductionContentFolderTypeProvider.getInstance());
}
else {
outPathUrl = application.runReadAction(new Computable<String>() {
@Override
public String compute() {
return pathsManager.getCompilerOutputUrl(
forTestClasses ? TestContentFolderTypeProvider.getInstance() : ProductionContentFolderTypeProvider.getInstance());
}
});
}
return outPathUrl != null ? VirtualFileManager.extractPath(outPathUrl) : null;
}
示例6: moduleCompileOutputChanged
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@Override
public void moduleCompileOutputChanged(final String baseUrl, final String moduleName) {
ModuleCompilerPathsManager moduleCompilerPathsManager = ModuleCompilerPathsManager.getInstance(getModule());
if (moduleCompilerPathsManager.isInheritedCompilerOutput()) {
if (baseUrl != null) {
myOutputPathPanel.setText(FileUtil.toSystemDependentName(
VfsUtilCore.urlToPath(moduleCompilerPathsManager.getCompilerOutputUrl(ProductionContentFolderTypeProvider.getInstance()))));
myTestsOutputPathPanel.setText(FileUtil.toSystemDependentName(
VfsUtilCore.urlToPath(moduleCompilerPathsManager.getCompilerOutputUrl(TestContentFolderTypeProvider.getInstance()))));
myResourcesOutputPathPanel.setText(FileUtil.toSystemDependentName(
VfsUtilCore.urlToPath(moduleCompilerPathsManager.getCompilerOutputUrl(ProductionResourceContentFolderTypeProvider.getInstance()))));
myTestResourcesOutputPathPanel.setText(FileUtil.toSystemDependentName(
VfsUtilCore.urlToPath(moduleCompilerPathsManager.getCompilerOutputUrl(TestResourceContentFolderTypeProvider.getInstance()))));
}
else {
myOutputPathPanel.setText(null);
myTestsOutputPathPanel.setText(null);
myResourcesOutputPathPanel.setText(null);
myTestResourcesOutputPathPanel.setText(null);
}
}
}
示例7: testCreationOfSourceFolderWithFile
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
public void testCreationOfSourceFolderWithFile() throws IOException {
VirtualFile dir = root.createChildDirectory(null, "src");
String url = dir.getUrl();
ContentFolder f = entry.addFolder(dir, ProductionContentFolderTypeProvider.getInstance());
assertEquals(dir, f.getFile());
assertEquals(url, f.getUrl());
dir.delete(null);
assertNull(f.getFile());
assertEquals(url, f.getUrl());
dir = root.createChildDirectory(null, "src");
assertEquals(dir, f.getFile());
assertEquals(url, f.getUrl());
}
示例8: replaceSourceRoot
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
private void replaceSourceRoot(final VirtualFile newSourceRoot) {
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
@Override
public void run() {
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(myModule).getModifiableModel();
final ContentEntry[] content = rootModel.getContentEntries();
boolean contentToChangeFound = false;
for (ContentEntry contentEntry : content) {
final ContentFolder[] sourceFolders = contentEntry.getFolders(ContentFolderScopes.of(ProductionContentFolderTypeProvider.getInstance()));
for (ContentFolder sourceFolder : sourceFolders) {
contentEntry.removeFolder(sourceFolder);
}
final VirtualFile contentRoot = contentEntry.getFile();
if (contentRoot != null && VfsUtilCore.isAncestor(contentRoot, newSourceRoot, false)) {
contentEntry.addFolder(newSourceRoot, ProductionContentFolderTypeProvider.getInstance());
contentToChangeFound = true;
}
}
assertTrue(contentToChangeFound);
rootModel.commit();
}
}
);
}
示例9: patch
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@Override
public void patch(@NotNull ModifiableRootModel model, @NotNull Set<ContentFolderTypeProvider> set)
{
HaxeModuleExtension extension = model.getExtension(HaxeModuleExtension.class);
if(extension != null)
{
set.add(ProductionContentFolderTypeProvider.getInstance());
}
}
示例10: patch
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@Override
public void patch(@NotNull ModifiableRootModel model, @NotNull Set<ContentFolderTypeProvider> set)
{
DotNetModuleExtension extension = model.getExtension(DotNetModuleExtension.class);
if(extension != null && extension.isAllowSourceRoots())
{
set.add(ProductionContentFolderTypeProvider.getInstance());
}
}
示例11: getFiles
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile[] getFiles(@NotNull ModuleRootModel moduleRootModel, @NotNull Predicate<ContentFolderTypeProvider> predicate)
{
if(predicate.apply(ProductionContentFolderTypeProvider.getInstance()))
{
return moduleRootModel.getContentRoots();
}
return VirtualFile.EMPTY_ARRAY;
}
示例12: getUrls
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@NotNull
@Override
public String[] getUrls(@NotNull ModuleRootModel moduleRootModel, @NotNull Predicate<ContentFolderTypeProvider> predicate)
{
if(predicate.apply(ProductionContentFolderTypeProvider.getInstance()))
{
return moduleRootModel.getContentRootUrls();
}
return ArrayUtil.EMPTY_STRING_ARRAY;
}
示例13: addSourceContentToRoots
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
public static void addSourceContentToRoots(final Module module, @Nonnull final VirtualFile vDir, final boolean testSource) {
new WriteCommandAction.Simple(module.getProject()) {
@Override
protected void run() throws Throwable {
final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
final ContentEntry contentEntry = rootModel.addContentEntry(vDir);
contentEntry.addFolder(vDir, testSource ? TestContentFolderTypeProvider.getInstance() : ProductionContentFolderTypeProvider.getInstance());
rootModel.commit();
}
}.execute().throwException();
}
示例14: addSourceRoot
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
public static void addSourceRoot(final Module module, final VirtualFile vDir, final boolean isTestSource) {
new WriteCommandAction.Simple(module.getProject()) {
@Override
protected void run() throws Throwable {
final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
ContentEntry entry = findContentEntry(rootModel, vDir);
if (entry == null) entry = rootModel.addContentEntry(vDir);
entry.addFolder(vDir, isTestSource ? TestContentFolderTypeProvider.getInstance() : ProductionContentFolderTypeProvider.getInstance());
rootModel.commit();
}
}.execute().throwException();
}
示例15: getModuleOutputDirectory
import consulo.roots.impl.ProductionContentFolderTypeProvider; //导入依赖的package包/类
@Override
public VirtualFile getModuleOutputDirectory(final Module module) {
return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
@Override
public VirtualFile compute() {
return ModuleCompilerPathsManager.getInstance(module)
.getCompilerOutput(ProductionContentFolderTypeProvider.getInstance());
}
});
}