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


Java Restarter类代码示例

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


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

示例1: getStartName

import com.intellij.util.Restarter; //导入依赖的package包/类
@Nonnull
private static String getStartName() {
  boolean supported = Restarter.isSupported();
  if(supported) {
    return "Start using " + ApplicationNamesInfo.getInstance().getFullProductName();
  }
  else {
    return "Manual start " + ApplicationNamesInfo.getInstance().getFullProductName();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:CustomizeDownloadAndStartStepPanel.java

示例2: installPatch

import com.intellij.util.Restarter; //导入依赖的package包/类
private static void installPatch() throws Exception {
  String platform = System.getProperty(PLATFORM_PREFIX_PROPERTY, "idea");
  String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase(Locale.US);
  String tempDir = System.getProperty("java.io.tmpdir");

  // always delete previous patch copy
  File patchCopy = new File(tempDir, patchFileName + "_copy");
  File log4jCopy = new File(tempDir, "log4j.jar." + platform + "_copy");
  File jnaUtilsCopy = new File(tempDir, "jna-platform.jar." + platform + "_copy");
  File jnaCopy = new File(tempDir, "jna.jar." + platform + "_copy");
  if (!FileUtilRt.delete(patchCopy) || !FileUtilRt.delete(log4jCopy) || !FileUtilRt.delete(jnaUtilsCopy) || !FileUtilRt.delete(jnaCopy)) {
    throw new IOException("Cannot delete temporary files in " + tempDir);
  }

  File patch = new File(tempDir, patchFileName);
  if (!patch.exists()) return;

  File log4j = new File(PathManager.getLibPath(), "log4j.jar");
  if (!log4j.exists()) throw new IOException("Log4J is missing: " + log4j);

  File jnaUtils = new File(PathManager.getLibPath(), "jna-platform.jar");
  if (!jnaUtils.exists()) throw new IOException("jna-platform.jar is missing: " + jnaUtils);

  File jna = new File(PathManager.getLibPath(), "jna.jar");
  if (!jna.exists()) throw new IOException("jna is missing: " + jna);

  copyFile(patch, patchCopy, true);
  copyFile(log4j, log4jCopy, false);
  copyFile(jna, jnaCopy, false);
  copyFile(jnaUtils, jnaUtilsCopy, false);

  int status = 0;
  if (Restarter.isSupported()) {
    List<String> args = new ArrayList<String>();

    if (SystemInfoRt.isWindows) {
      File launcher = new File(PathManager.getBinPath(), "VistaLauncher.exe");
      args.add(Restarter.createTempExecutable(launcher).getPath());
      Restarter.createTempExecutable(new File(PathManager.getBinPath(), "restarter.exe"));
    }

    //noinspection SpellCheckingInspection
    String java = getJava();
    Collections.addAll(args,
                       java,
                       "-Xmx750m",
                       "-Djna.nosys=true",
                       "-Djna.boot.library.path=",
                       "-Djna.debug_load=true",
                       "-Djna.debug_load.jna=true",
                       "-classpath",
                       patchCopy.getPath() + pathSeparator + log4jCopy.getPath() + pathSeparator + jnaCopy.getPath() + pathSeparator + jnaUtilsCopy.getPath(),
                       "-Djava.io.tmpdir=" + tempDir,
                       "-Didea.updater.log=" + PathManager.getLogPath(),
                       "-Dswing.defaultlaf=" + UIManager.getSystemLookAndFeelClassName(),
                       "com.intellij.updater.Runner",
                       "install",
                       PathManager.getHomePath());

    status = Restarter.scheduleRestart(ArrayUtilRt.toStringArray(args));
  }
  else {
    String message = "Patch update is not supported - please do it manually";
    showMessage("Update Error", message, true);
  }

  System.exit(status);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:69,代码来源:Main.java

示例3: installPatch

import com.intellij.util.Restarter; //导入依赖的package包/类
private static void installPatch() throws IOException {
  String platform = System.getProperty("idea.platform.prefix", "idea");
  String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
  File originalPatchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName);
  File copyPatchFile = new File(System.getProperty("java.io.tmpdir"), patchFileName + "_copy");

  // always delete previous patch copy
  if (!FileUtilRt.delete(copyPatchFile)) {
    throw new IOException("Cannot create temporary patch file");
  }

  if (!originalPatchFile.exists()) {
    return;
  }

  if (!originalPatchFile.renameTo(copyPatchFile) || !FileUtilRt.delete(originalPatchFile)) {
    throw new IOException("Cannot create temporary patch file");
  }

  int status = 0;
  if (Restarter.isSupported()) {
    List<String> args = new ArrayList<String>();

    if (SystemInfo.isWindows) {
      File launcher = new File(PathManager.getBinPath(), "VistaLauncher.exe");
      args.add(Restarter.createTempExecutable(launcher).getPath());
    }

    Collections.addAll(args,
                       System.getProperty("java.home") + "/bin/java",
                       "-Xmx500m",
                       "-classpath",
                       copyPatchFile.getPath(),
                       "com.intellij.updater.Runner",
                       "install",
                       PathManager.getHomePath());

    status = Restarter.scheduleRestart(ArrayUtilRt.toStringArray(args));
  }
  else {
    String message = "Patch update is not supported - please do it manually";
    showMessage("Update Error", message, true);
  }

  System.exit(status);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:47,代码来源:Main.java


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