当前位置: 首页>>代码示例>>Java>>正文


Java JavaSdkType类代码示例

本文整理汇总了Java中com.intellij.openapi.projectRoots.JavaSdkType的典型用法代码示例。如果您正苦于以下问题:Java JavaSdkType类的具体用法?Java JavaSdkType怎么用?Java JavaSdkType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavaSdkType类属于com.intellij.openapi.projectRoots包,在下文中一共展示了JavaSdkType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getState

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
  final Module module = getModule();
  if (module == null) {
    throw new ExecutionException("Module is not specified");
  }

  if (!isSupport(module)) {
    throw new ExecutionException(getNoSdkMessage());
  }

  final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  final Sdk sdk = rootManager.getSdk();
  if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) {
    throw CantRunException.noJdkForModule(module);
  }

  return createCommandLineState(environment, module);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MvcRunConfiguration.java

示例2: initArtifacts

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
@Override
public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) {
  final Collection<? extends Artifact> artifacts =
    ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance());
  if (artifacts.isEmpty()) return;
  final Sdk[] jdks = BuildProperties.getUsedJdks(project);
  Sdk javaSdk = null;
  for (Sdk jdk : jdks) {
    if (jdk.getSdkType() instanceof JavaSdkType) {
      javaSdk = jdk;
      break;
    }
  }
  if (javaSdk != null) {
    final Tag taskdef = new Tag("taskdef",
                                Couple.of("resource", "com/sun/javafx/tools/ant/antlib.xml"),
                                Couple.of("uri", "javafx:com.sun.javafx.tools.ant"),
                                Couple.of("classpath",
                                          BuildProperties
                                            .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) +
                                          "/lib/ant-javafx.jar"));
    generator.add(taskdef);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaFxChunkBuildExtension.java

示例3: createParserSetupCommand

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
private static String[] createParserSetupCommand(final Sdk jdk) {

    final VirtualFile homeDirectory = jdk.getHomeDirectory();
    if (homeDirectory == null) {
      throw new IllegalArgumentException(CompilerBundle.jdkHomeNotFoundMessage(jdk));
    }

    final List<String> commandLine = new ArrayList<String>();
    commandLine.add(((JavaSdkType)jdk.getSdkType()).getVMExecutablePath(jdk));

    CompilerUtil.addLocaleOptions(commandLine, false);

    //noinspection HardCodedStringLiteral
    commandLine.add("-classpath");
    commandLine.add(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk) + File.pathSeparator + JavaSdkUtil.getIdeaRtJarPath());

    commandLine.add(JavacResourcesReader.class.getName());

    return ArrayUtil.toStringArray(commandLine);
  }
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:JavacOutputParserPool.java

示例4: createStartupCommand

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
private void createStartupCommand(final ModuleChunk chunk,
                                  @NonNls final ArrayList<String> commandLine,
                                  final String outputPath,
                                  final boolean useTempFile) throws IOException {
  final EclipseCompilerOptions options = EclipseCompilerConfiguration.getOptions(myProject, EclipseCompilerConfiguration.class);

  final Sdk projectJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
  final String vmExePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
  commandLine.add(vmExePath);
  commandLine.add("-Xmx" + options.MAXIMUM_HEAP_SIZE + "m");

  CompilerUtil.addLocaleOptions(commandLine, false);

  commandLine.add("-classpath");
  commandLine.add(PATH_TO_COMPILER_JAR);
  commandLine.add(getCompilerClass());

  addCommandLineOptions(commandLine, chunk, outputPath, options, useTempFile, true);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:EclipseCompiler.java

示例5: getState

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
  final Module module = getModule();
  if (module == null) {
    throw new ExecutionException("Module is not specified");
  }

  if (!isSupport(module)) {
    throw new ExecutionException(getNoSdkMessage());
  }

  final ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  final Sdk sdk = rootManager.getSdk();
  if (sdk == null || !(sdk.getSdkType() instanceof JavaSdkType)) {
    throw CantRunException.noJdkForModule(module);
  }

  return createCommandLineState(environment, module);

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MvcRunConfiguration.java

示例6: isAvailable

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
  final GrAnnotation anno = PsiTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), GrAnnotation.class, false);
  if (anno == null) {
    return false;
  }

  final String qname = anno.getQualifiedName();
  if (qname == null || !(qname.startsWith(GRAB_ANNO) || GRAPES_ANNO.equals(qname))) {
    return false;
  }

  final Module module = ModuleUtilCore.findModuleForPsiElement(file);
  if (module == null) {
    return false;
  }

  final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk == null) {
    return false;
  }

  return file.getOriginalFile().getVirtualFile() != null && sdk.getSdkType() instanceof JavaSdkType;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GrabDependencies.java

示例7: initArtifacts

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
@Override
public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) {
  final Collection<? extends Artifact> artifacts =
    ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance());
  if (artifacts.isEmpty()) return;
  final Sdk[] jdks = BuildProperties.getUsedJdks(project);
  Sdk javaSdk = null;
  for (Sdk jdk : jdks) {
    if (jdk.getSdkType() instanceof JavaSdkType) {
      javaSdk = jdk;
      break;
    }
  }
  if (javaSdk != null) {
    final Tag taskdef = new Tag("taskdef",
                                new Pair<String, String>("resource", "com/sun/javafx/tools/ant/antlib.xml"),
                                new Pair<String, String>("uri", "javafx:com.sun.javafx.tools.ant"),
                                new Pair<String, String>("classpath",
                                                         BuildProperties
                                                           .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) +
                                                         "/lib/ant-javafx.jar"));
    generator.add(taskdef);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:JavaFxChunkBuildExtension.java

示例8: checkVirtualMachineVersion

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
private void checkVirtualMachineVersion(VirtualMachine vm)
{
	final String version = vm.version();
	if("1.4.0".equals(version))
	{
		DebuggerInvocationUtil.swingInvokeLater(myProject, () -> Messages.showMessageDialog(myProject, DebuggerBundle.message("warning.jdk140.unstable"), DebuggerBundle.message("title.jdk140" +
				".unstable"), Messages.getWarningIcon()));
	}

	if(getSession().getAlternativeJre() == null)
	{
		Sdk runjre = getSession().getRunJre();
		if((runjre == null || runjre.getSdkType() instanceof JavaSdkType) && !versionMatch(runjre, version))
		{
			SdkTable.getInstance().getSdksOfType(JavaSdk.getInstance()).stream().filter(sdk -> versionMatch(sdk, version)).findFirst().ifPresent(sdk ->
			{
				XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("message.remote.jre.version.mismatch", version, runjre != null ? runjre.getVersionString() :
						"unknown", sdk.getName()), MessageType.INFO).notify(myProject);
				getSession().setAlternativeJre(sdk);
			});
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:DebugProcessImpl.java

示例9: setupJVMCommandLine

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
public static GeneralCommandLine setupJVMCommandLine(@NotNull OwnSimpleJavaParameters javaParameters) throws CantRunException
{
	Sdk jdk = javaParameters.getJdk();
	if(jdk == null)
	{
		throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified"));
	}
	SdkTypeId type = jdk.getSdkType();
	if(!(type instanceof JavaSdkType))
	{
		throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified"));
	}

	GeneralCommandLine commandLine = new GeneralCommandLine();
	((JavaSdkType) type).setupCommandLine(commandLine, jdk);
	String exePath = commandLine.getExePath();
	if(exePath == null)
	{
		throw new CantRunException(ExecutionBundle.message("run.configuration.cannot.find.vm.executable"));
	}

	setupCommandLine(commandLine, javaParameters);
	return commandLine;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:OwnJdkUtil.java

示例10: getLanguageSettingsComponent

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
@Nullable
@Override
public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) {
  myModel = ProjectStructureConfigurable.getInstance(ProjectManager.getInstance().getDefaultProject()).getProjectJdksModel();
  myJdkComboBox = new JdkComboBox(myModel, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), sdk -> true, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), true);
  ComboboxWithBrowseButton comboboxWithBrowseButton = new ComboboxWithBrowseButton(myJdkComboBox);
  FixedSizeButton setupButton = comboboxWithBrowseButton.getButton();
  myJdkComboBox.setSetupButton(setupButton, null, myModel, (JdkComboBox.JdkComboBoxItem) myJdkComboBox.getModel().getSelectedItem(), null, false);
  return LabeledComponent.create(comboboxWithBrowseButton, "Jdk", BorderLayout.WEST);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:11,代码来源:EduIntellijCourseProjectGeneratorBase.java

示例11: setupExeParams

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
private void setupExeParams(final Sdk jdk, GeneralCommandLine cmdLine) throws ExecutionException {
  final String jdkPath =
    jdk != null && jdk.getSdkType() instanceof JavaSdkType ? ((JavaSdkType)jdk.getSdkType()).getBinPath(jdk) : null;
  if (jdkPath == null) {
    throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path"));
  }
  JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
  if (myConfiguration.HEAP_SIZE != null && myConfiguration.HEAP_SIZE.trim().length() != 0) {
    if (version == null || version.isAtLeast(JavaSdkVersion.JDK_1_2)) {
      cmdLine.getParametersList().prepend("-J-Xmx" + myConfiguration.HEAP_SIZE + "m");
    }
    else {
      cmdLine.getParametersList().prepend("-J-mx" + myConfiguration.HEAP_SIZE + "m");
    }
  }
  cmdLine.setWorkDirectory((File)null);
  @NonNls final String javadocExecutableName = File.separator + (SystemInfo.isWindows ? "javadoc.exe" : "javadoc");
  @NonNls String exePath = jdkPath.replace('/', File.separatorChar) + javadocExecutableName;
  if (new File(exePath).exists()) {
    cmdLine.setExePath(exePath);
  }
  else { //try to use wrapper jdk
    exePath = new File(jdkPath).getParent().replace('/', File.separatorChar) + javadocExecutableName;
    if (!new File(exePath).exists()) {
      final File parent = new File(System.getProperty("java.home")).getParentFile(); //try system jre
      exePath = parent.getPath() + File.separator + "bin" + javadocExecutableName;
      if (!new File(exePath).exists()) {
        throw new CantRunException(JavadocBundle.message("javadoc.generate.no.jdk.path"));
      }
    }
    cmdLine.setExePath(exePath);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:JavadocGeneratorRunProfile.java

示例12: adjustAddedFileSet

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
@Override
protected VirtualFile[] adjustAddedFileSet(final Component component, final VirtualFile[] files) {
  if (mySdk.getSdkType() instanceof JavaSdkType) {
    return PathUIUtils.scanAndSelectDetectedJavaSourceRoots(component, files);
  }
  return super.adjustAddedFileSet(component, files);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SourcesOrderRootTypeUIFactory.java

示例13: addJavaHome

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
public static void addJavaHome(@NotNull JavaParameters params, @NotNull Module module) {
  final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) {
    String path = StringUtil.trimEnd(sdk.getHomePath(), File.separator);
    if (StringUtil.isNotEmpty(path)) {
      params.addEnv("JAVA_HOME", FileUtil.toSystemDependentName(path));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:MvcFramework.java

示例14: isGroovyCompatibleModule

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
@NotNull
private static Condition<Module> isGroovyCompatibleModule(final Condition<Module> condition) {
  return new Condition<Module>() {
    @Override
    public boolean value(Module module) {
      if (condition.value(module)) {
        final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
        if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) {
          return true;
        }
      }
      return false;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ModuleChooserUtil.java

示例15: isCorrectModule

import com.intellij.openapi.projectRoots.JavaSdkType; //导入依赖的package包/类
private static boolean isCorrectModule(PsiFile file) {
  final Module module = ModuleUtilCore.findModuleForPsiElement(file);
  if (module == null) {
    return false;
  }

  final Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
  if (sdk == null) {
    return false;
  }

  return file.getOriginalFile().getVirtualFile() != null && sdk.getSdkType() instanceof JavaSdkType;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GrabDependencies.java


注:本文中的com.intellij.openapi.projectRoots.JavaSdkType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。