use of com.intellij.pom.java.LanguageLevel in project intellij-community by JetBrains.
the class IdeaTestUtil method withLevel.
public static void withLevel(final Module module, final LanguageLevel level, final Runnable r) {
final LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(module.getProject());
final LanguageLevel projectLevel = projectExt.getLanguageLevel();
final LanguageLevel moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
try {
projectExt.setLanguageLevel(level);
setModuleLanguageLevel(module, level);
r.run();
} finally {
setModuleLanguageLevel(module, moduleLevel);
projectExt.setLanguageLevel(projectLevel);
}
}
use of com.intellij.pom.java.LanguageLevel in project intellij-community by JetBrains.
the class IdeaTestUtil method setModuleLanguageLevel.
public static void setModuleLanguageLevel(Module module, final LanguageLevel level, Disposable parentDisposable) {
LanguageLevel prev = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
setModuleLanguageLevel(module, level);
Disposer.register(parentDisposable, () -> setModuleLanguageLevel(module, prev));
}
use of com.intellij.pom.java.LanguageLevel in project intellij-community by JetBrains.
the class ProjectConfigurable method createUIComponents.
private void createUIComponents() {
myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
@Override
protected LanguageLevel getDefaultLevel() {
Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
if (sdk == null)
return null;
JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
return version == null ? null : version.getMaxLanguageLevel();
}
};
final JTextField textField = new JTextField();
final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
outputPathsChooserDescriptor.setHideIgnored(false);
BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
use of com.intellij.pom.java.LanguageLevel in project intellij-community by JetBrains.
the class PsiJavaParserFacadeImpl method createTypeElementFromText.
@NotNull
@Override
public PsiTypeElement createTypeElementFromText(@NotNull final String text, @Nullable final PsiElement context) throws IncorrectOperationException {
final LanguageLevel level = level(context);
final DummyHolder holder = DummyHolderFactory.createHolder(myManager, new JavaDummyElement(text, TYPE, level), context);
final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode());
if (!(element instanceof PsiTypeElement)) {
throw new IncorrectOperationException("Incorrect type '" + text + "' (" + level + ")");
}
return (PsiTypeElement) element;
}
use of com.intellij.pom.java.LanguageLevel in project intellij-community by JetBrains.
the class JavaFileElementType method serialize.
@Override
public void serialize(@NotNull PsiJavaFileStub stub, @NotNull StubOutputStream dataStream) throws IOException {
dataStream.writeBoolean(stub.isCompiled());
LanguageLevel level = stub.getLanguageLevel();
dataStream.writeByte(level != null ? level.ordinal() : -1);
dataStream.writeName(stub.getPackageName());
}
Aggregations