use of com.intellij.openapi.roots.CompilerProjectExtension in project intellij-community by JetBrains.
the class ProjectConfigurable method apply.
@Override
public void apply() throws ConfigurationException {
final CompilerProjectExtension compilerProjectExtension = CompilerProjectExtension.getInstance(myProject);
assert compilerProjectExtension != null : myProject;
if (myProjectName != null && StringUtil.isEmptyOrSpaces(myProjectName.getText())) {
throw new ConfigurationException("Please, specify project name!");
}
ApplicationManager.getApplication().runWriteAction(() -> {
// set the output path first so that handlers of RootsChanged event sent after JDK is set
// would see the updated path
String canonicalPath = myProjectCompilerOutput.getText();
if (canonicalPath != null && canonicalPath.length() > 0) {
try {
canonicalPath = FileUtil.resolveShortWindowsName(canonicalPath);
} catch (IOException e) {
//file doesn't exist yet
}
canonicalPath = FileUtil.toSystemIndependentName(canonicalPath);
compilerProjectExtension.setCompilerOutputUrl(VfsUtilCore.pathToUrl(canonicalPath));
} else {
compilerProjectExtension.setCompilerOutputPointer(null);
}
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myProject);
LanguageLevel level = myLanguageLevelCombo.getSelectedLevel();
if (level != null) {
extension.setLanguageLevel(level);
}
extension.setDefault(myLanguageLevelCombo.isDefault());
myProjectJdkConfigurable.apply();
if (myProjectName != null) {
((ProjectEx) myProject).setProjectName(getProjectName());
if (myDetailsComponent != null)
myDetailsComponent.setText(getBannerSlogan());
}
});
}
Aggregations