本文整理汇总了Java中com.intellij.openapi.roots.CompilerProjectExtension类的典型用法代码示例。如果您正苦于以下问题:Java CompilerProjectExtension类的具体用法?Java CompilerProjectExtension怎么用?Java CompilerProjectExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilerProjectExtension类属于com.intellij.openapi.roots包,在下文中一共展示了CompilerProjectExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWizard
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
private AddModuleWizard getWizard(final Project project) throws ConfigurationException {
final HybrisProjectImportProvider provider = getHybrisProjectImportProvider();
final String basePath = project.getBasePath();
final String projectName = project.getName();
final Sdk jdk = ProjectRootManager.getInstance(project).getProjectSdk();
final String compilerOutputUrl = CompilerProjectExtension.getInstance(project).getCompilerOutputUrl();
final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState();
final AddModuleWizard wizard = new AddModuleWizard(null, basePath, provider) {
protected void init() {
// non GUI mode
}
};
final WizardContext wizardContext = wizard.getWizardContext();
wizardContext.setProjectJdk(jdk);
wizardContext.setProjectName(projectName);
wizardContext.setCompilerOutputDirectory(compilerOutputUrl);
final StepSequence stepSequence = wizard.getSequence();
for (ModuleWizardStep step : stepSequence.getAllSteps()) {
if (step instanceof NonGuiSupport) {
((NonGuiSupport) step).nonGuiModeImport(settings);
}
}
return wizard;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:ProjectRefreshAction.java
示例2: CompilerTester
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public CompilerTester(Project project, List<Module> modules) throws Exception {
myProject = project;
myModules = modules;
myMainOutput = new TempDirTestFixtureImpl();
myMainOutput.setUp();
CompilerTestUtil.enableExternalCompiler();
new WriteCommandAction(getProject()) {
@Override
protected void run(@NotNull Result result) throws Throwable {
//noinspection ConstantConditions
CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
for (Module module : myModules) {
ModuleRootModificationUtil.setModuleSdk(module, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
}
}
}.execute();
}
示例3: getExcludeRootsForModule
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@NotNull
@Override
public VirtualFilePointer[] getExcludeRootsForModule(@NotNull final ModuleRootModel rootModel) {
ArrayList<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>();
final CompilerModuleExtension extension = rootModel.getModuleExtension(CompilerModuleExtension.class);
if (extension == null) {
return VirtualFilePointer.EMPTY_ARRAY;
}
if (extension.isCompilerOutputPathInherited()) {
ContainerUtil.addIfNotNull(result, CompilerProjectExtension.getInstance(myProject).getCompilerOutputPointer());
}
else {
if (!extension.isExcludeOutput()) return VirtualFilePointer.EMPTY_ARRAY;
ContainerUtil.addIfNotNull(result, extension.getCompilerOutputPointer());
ContainerUtil.addIfNotNull(result, extension.getCompilerOutputForTestsPointer());
}
return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]);
}
示例4: compile
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public static Class compile(@NotNull PsiClass psiClass) {
Class cls = null;
String compileText = psiClass.getText();
String compileName = psiClass.getName();
CompilerProjectExtension extension = CompilerProjectExtension.getInstance(psiClass.getProject());
String outputRootUrl = extension.getCompilerOutputUrl();
File root = new File(outputRootUrl + "/tmp");
File sourceFile = new File(root, compileName + ".java");
sourceFile.getParentFile().mkdirs();
try {
new FileWriter(sourceFile).append(compileText).close();
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
compiler.run(null, null, null, sourceFile.getPath());
URLClassLoader classLoader = URLClassLoader.newInstance(new URL[]{root.toURI().toURL()});
cls = Class.forName(compileName, true, classLoader);
sourceFile.delete();
} catch (Exception e) {
e.printStackTrace();
}
return cls;
}
示例5: CompilerTester
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public CompilerTester(boolean externalMake, Module module) throws Exception {
myExternalMake = externalMake;
myModule = module;
myMainOutput = new TempDirTestFixtureImpl();
myMainOutput.setUp();
CompilerManagerImpl.testSetup();
new WriteCommandAction(getProject()) {
@Override
protected void run(Result result) throws Throwable {
//noinspection ConstantConditions
CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
if (myExternalMake) {
CompilerTestUtil.enableExternalCompiler(getProject());
ModuleRootModificationUtil.setModuleSdk(myModule, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
}
else {
CompilerTestUtil.disableExternalCompiler(getProject());
}
}
}.execute();
}
示例6: getExcludeRootsForModule
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@NotNull
@Override
public VirtualFilePointer[] getExcludeRootsForModule(@NotNull final ModuleRootModel rootModel) {
ArrayList<VirtualFilePointer> result = new ArrayList<VirtualFilePointer>();
final CompilerModuleExtension extension = rootModel.getModuleExtension(CompilerModuleExtension.class);
if (extension == null) {
return VirtualFilePointer.EMPTY_ARRAY;
}
if (extension.isCompilerOutputPathInherited()) {
result.add(CompilerProjectExtension.getInstance(myProject).getCompilerOutputPointer());
}
else {
if (!extension.isExcludeOutput()) return VirtualFilePointer.EMPTY_ARRAY;
final VirtualFilePointer outputPath = extension.getCompilerOutputPointer();
if (outputPath != null) result.add(outputPath);
final VirtualFilePointer outputPathForTests = extension.getCompilerOutputForTestsPointer();
if (outputPathForTests != null) result.add(outputPathForTests);
}
return result.isEmpty() ? VirtualFilePointer.EMPTY_ARRAY : result.toArray(new VirtualFilePointer[result.size()]);
}
示例7: setCompilerOutput
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
protected void setCompilerOutput(@NotNull Project project) {
CompilerProjectExtension compilerProjectExtension = CompilerProjectExtension.getInstance(project);
String basePath = project.getBasePath();
if (compilerProjectExtension != null && basePath != null) {
compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(FileUtilRt.toSystemDependentName(basePath)));
}
}
示例8: getCompilerOutputPath
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public VirtualFile getCompilerOutputPath() {
if (myInheritedCompilerOutput) {
final VirtualFile projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutput();
if (projectOutputPath == null) return null;
return projectOutputPath.findFileByRelativePath(PRODUCTION + "/" + getModule().getName());
}
return myCompilerOutputPointer == null ? null : myCompilerOutputPointer.getFile();
}
示例9: getCompilerOutputPathForTests
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public VirtualFile getCompilerOutputPathForTests() {
if (myInheritedCompilerOutput) {
final VirtualFile projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutput();
if (projectOutputPath == null) return null;
return projectOutputPath.findFileByRelativePath(TEST + "/" + getModule().getName());
}
return myCompilerOutputPathForTestsPointer == null ? null : myCompilerOutputPathForTestsPointer.getFile();
}
示例10: getCompilerOutputUrl
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public String getCompilerOutputUrl() {
if (myInheritedCompilerOutput) {
final String projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutputUrl();
if (projectOutputPath == null) return null;
return projectOutputPath + "/" + PRODUCTION + "/" + getModule().getName();
}
return myCompilerOutputPointer == null ? null : myCompilerOutputPointer.getUrl();
}
示例11: getCompilerOutputUrlForTests
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Override
@Nullable
public String getCompilerOutputUrlForTests() {
if (myInheritedCompilerOutput) {
final String projectOutputPath = CompilerProjectExtension.getInstance(getProject()).getCompilerOutputUrl();
if (projectOutputPath == null) return null;
return projectOutputPath + "/" + TEST + "/" + getModule().getName();
}
return myCompilerOutputPathForTestsPointer == null ? null : myCompilerOutputPathForTestsPointer.getUrl();
}
示例12: getExcludeRootsForProject
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@NotNull
@Override
public VirtualFile[] getExcludeRootsForProject() {
VirtualFile outputPath = CompilerProjectExtension.getInstance(myProject).getCompilerOutput();
if (outputPath != null) {
return new VirtualFile[] { outputPath };
}
return VirtualFile.EMPTY_ARRAY;
}
示例13: getDefaultArtifactOutputPath
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
@Nullable
public static String getDefaultArtifactOutputPath(@NotNull String artifactName, final @NotNull Project project) {
final CompilerProjectExtension extension = CompilerProjectExtension.getInstance(project);
if (extension == null) return null;
String outputUrl = extension.getCompilerOutputUrl();
if (outputUrl == null || outputUrl.length() == 0) {
final VirtualFile baseDir = project.getBaseDir();
if (baseDir == null) return null;
outputUrl = baseDir.getUrl() + "/out";
}
return VfsUtilCore.urlToPath(outputUrl) + "/artifacts/" + FileUtil.sanitizeFileName(artifactName);
}
示例14: testProjectOutput
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public void testProjectOutput() throws IOException {
VirtualFile output = getVirtualFile(createTempDir("projectOutput"));
CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(output.getUrl());
getChangeListManager().convertExcludedToIgnored();
assertTrue(getChangeListManager().isIgnoredFile(output));
assertIgnored(output);
}
示例15: testModuleOutputUnderProjectOutput
import com.intellij.openapi.roots.CompilerProjectExtension; //导入依赖的package包/类
public void testModuleOutputUnderProjectOutput() throws IOException {
VirtualFile output = getVirtualFile(createTempDir("projectOutput"));
CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(output.getUrl());
VirtualFile moduleOutput = createChildDirectory(output, "module");
PsiTestUtil.setCompilerOutputPath(myModule, moduleOutput.getUrl(), false);
getChangeListManager().convertExcludedToIgnored();
assertTrue(getChangeListManager().isIgnoredFile(output));
assertTrue(getChangeListManager().isIgnoredFile(moduleOutput));
assertIgnored(output);
}