本文整理汇总了Java中com.intellij.compiler.impl.CompilerUtil.isOfVersion方法的典型用法代码示例。如果您正苦于以下问题:Java CompilerUtil.isOfVersion方法的具体用法?Java CompilerUtil.isOfVersion怎么用?Java CompilerUtil.isOfVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.compiler.impl.CompilerUtil
的用法示例。
在下文中一共展示了CompilerUtil.isOfVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkCompiler
import com.intellij.compiler.impl.CompilerUtil; //导入方法依赖的package包/类
public boolean checkCompiler(final CompileScope scope) {
final Module[] modules = scope.getAffectedModules();
final Set<Sdk> checkedJdks = new HashSet<Sdk>();
for (final Module module : modules) {
final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
if (jdk == null || checkedJdks.contains(jdk)) {
continue;
}
checkedJdks.add(jdk);
final SdkTypeId sdkType = jdk.getSdkType();
if (!(sdkType instanceof JavaSdkType)) {
continue;
}
final VirtualFile homeDirectory = jdk.getHomeDirectory();
if (homeDirectory == null) {
//noinspection DialogTitleCapitalization
Messages.showMessageDialog(
myProject,
ErrorProneIdeaBundle.jdkHomeNotFoundMessage(jdk),
ErrorProneIdeaBundle.compilerName(),
Messages.getErrorIcon()
);
return false;
}
final String vmExecutablePath = ((JavaSdkType)sdkType).getVMExecutablePath(jdk);
if (vmExecutablePath == null) {
Messages.showMessageDialog(
myProject,
ErrorProneIdeaBundle.message("error-prone.error.vm.executable.missing", jdk.getName()),
ErrorProneIdeaBundle.compilerName(),
Messages.getErrorIcon()
);
return false;
}
final String toolsJarPath = ((JavaSdkType)sdkType).getToolsPath(jdk);
if (toolsJarPath == null) {
Messages.showMessageDialog(
myProject,
ErrorProneIdeaBundle.message("error-prone.error.tools.jar.missing", jdk.getName()),
ErrorProneIdeaBundle.compilerName(),
Messages.getErrorIcon()
);
return false;
}
final String versionString = jdk.getVersionString();
if (versionString == null) {
Messages.showMessageDialog(
myProject,
ErrorProneIdeaBundle.message("error-prone.error.unknown.jdk.version", jdk.getName()),
ErrorProneIdeaBundle.compilerName(),
Messages.getErrorIcon()
);
return false;
}
if (CompilerUtil.isOfVersion(versionString, "1.0")) {
Messages.showMessageDialog(
myProject,
ErrorProneIdeaBundle.message("error-prone.error.1_0_compilation.not.supported"),
ErrorProneIdeaBundle.compilerName(),
Messages.getErrorIcon()
);
return false;
}
}
return true;
}
示例2: checkCompiler
import com.intellij.compiler.impl.CompilerUtil; //导入方法依赖的package包/类
public boolean checkCompiler(final CompileScope scope) {
final Module[] modules = scope.getAffectedModules();
final Set<Sdk> checkedJdks = new HashSet<Sdk>();
for (final Module module : modules) {
final Sdk jdk = ModuleRootManager.getInstance(module).getSdk();
if (jdk == null || checkedJdks.contains(jdk)) {
continue;
}
checkedJdks.add(jdk);
final SdkTypeId sdkType = jdk.getSdkType();
if (!(sdkType instanceof JavaSdkType)) {
continue;
}
final VirtualFile homeDirectory = jdk.getHomeDirectory();
if (homeDirectory == null) {
Messages.showMessageDialog(
myProject, CompilerBundle.jdkHomeNotFoundMessage(jdk), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
);
return false;
}
final String vmExecutablePath = ((JavaSdkType)sdkType).getVMExecutablePath(jdk);
if (vmExecutablePath == null) {
Messages.showMessageDialog(
myProject, CompilerBundle.message("javac.error.vm.executable.missing", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
);
return false;
}
final String toolsJarPath = ((JavaSdkType)sdkType).getToolsPath(jdk);
if (toolsJarPath == null) {
Messages.showMessageDialog(
myProject, CompilerBundle.message("javac.error.tools.jar.missing", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
);
return false;
}
final String versionString = jdk.getVersionString();
if (versionString == null) {
Messages.showMessageDialog(
myProject, CompilerBundle.message("javac.error.unknown.jdk.version", jdk.getName()), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
);
return false;
}
if (CompilerUtil.isOfVersion(versionString, "1.0")) {
Messages.showMessageDialog(
myProject, CompilerBundle.message("javac.error.1_0_compilation.not.supported"), CompilerBundle.message("compiler.javac.name"), Messages.getErrorIcon()
);
return false;
}
}
return true;
}