Ejemplo n.º 1
0
 private static RSetup loadSetup(
     final String id,
     final Map<String, String> filter,
     final IConfigurationElement[] configurationElements) {
   try {
     for (int i = 0; i < configurationElements.length; i++) {
       final IConfigurationElement element = configurationElements[i];
       if (element.getName().equals(SETUP_ELEMENT_NAME)
           && id.equals(element.getAttribute(ID_ATTRIBUTE_NAME))) {
         final RSetup setup = new RSetup(id);
         if (filter != null && filter.containsKey("$os$")) { // $NON-NLS-1$
           setup.setOS(filter.get("$os$"), filter.get("$arch$")); // $NON-NLS-1$ //$NON-NLS-2$
         } else {
           setup.setOS(Platform.getOS(), Platform.getOSArch());
         }
         setup.setName(element.getAttribute(NAME_ATTRIBUTE_NAME));
         loadSetupBase(id, filter, configurationElements, setup);
         if (setup.getRHome() == null) {
           log(
               IStatus.WARNING,
               "Incomplete R setup: Missing R home for setup '" + id + "', the setup is ignored.",
               element);
           return null;
         }
         loadSetupLibraries(id, filter, configurationElements, setup);
         return setup;
       }
     }
   } catch (final Exception e) {
     LOGGER.log(
         new Status(IStatus.ERROR, PLUGIN_ID, "Error in R setup: Failed to load setup.", e));
   }
   return null;
 }
 public int runDirectorToInstall(
     String message, File installFolder, String sourceRepo, String iuToInstall) {
   String[] command =
       new String[] { //
         "-application",
         "org.eclipse.equinox.p2.director", //
         "-repository",
         sourceRepo,
         "-installIU",
         iuToInstall, //
         "-destination",
         installFolder.getAbsolutePath(), //
         "-bundlepool",
         installFolder.getAbsolutePath(), //
         "-roaming",
         "-profile",
         "PlatformProfile",
         "-profileProperties",
         "org.eclipse.update.install.features=true", //
         "-p2.os",
         Platform.getOS(),
         "-p2.ws",
         Platform.getWS(),
         "-p2.arch",
         Platform.getOSArch()
       };
   return runEclipse(message, command);
 }
Ejemplo n.º 3
0
 public static ImageCapture getImageCapture() {
   if (instance == null) {
     if (Platform.OS_WIN32.equals(Platform.getOS())) instance = new Win32ImageCapture();
     else if (Platform.WS_GTK.equals(Platform.getWS())) {
       if (Platform.ARCH_IA64.equals(Platform.getOSArch())
           || Platform.ARCH_X86_64.equals(Platform.getOSArch()))
         instance = new org.eclipse.ve.internal.swt.targetvm.unix.bits64.ImageCapture();
       else instance = new org.eclipse.ve.internal.swt.targetvm.unix.ImageCapture();
     } else if (Platform.OS_MACOSX.equals(Platform.getOS())) {
       if (Platform.WS_COCOA.equals(Platform.getWS())) {
         instance = new org.eclipse.ve.internal.swt.targetvm.macosx.cocoa.ImageCapture();
       } else if (Platform.WS_CARBON.equals(Platform.getWS())) {
         instance = new org.eclipse.ve.internal.swt.targetvm.macosx.ImageCapture();
       } else {
         throw new UnsupportedOperationException(Platform.getOS());
       }
     } else {
       throw new UnsupportedOperationException(Platform.getOS());
     }
   }
   return instance;
 }
Ejemplo n.º 4
0
  @Override
  public String getProperty(String key) {
    String value = properties.get(key);
    if (value != null) {
      return value;
    }

    // By default, we're a local GCC
    switch (key) {
      case ATTR_OS:
        return Platform.getOS();
      case ATTR_ARCH:
        return Platform.getOSArch();
    }

    return null;
  }
Ejemplo n.º 5
0
  private String generateStudioFingerprint() {
    IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
    List<IBundleGroup> groups = new ArrayList<IBundleGroup>();
    if (providers != null) {
      for (int i = 0; i < providers.length; ++i) {
        IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
        groups.addAll(Arrays.asList(bundleGroups));
      }
    }
    String version = "";
    for (IBundleGroup group : groups) {
      if (group.getIdentifier().equals(ANDROID_FEATURE)) {
        version = group.getVersion();
        break;
      }
    }

    StringBuilder stringBuilder =
        new StringBuilder(CertificateManagerActivator.CREATED_BY_FIELD_VALUE);
    stringBuilder.append(" v");
    stringBuilder.append(version);
    stringBuilder.append(" - ");
    stringBuilder.append(Platform.getOS());
    stringBuilder.append(", ");
    stringBuilder.append(Platform.getOSArch());
    stringBuilder.append(". ");
    if (targetName.trim().length() > 0) {
      stringBuilder.append("Android target - ");
      stringBuilder.append(targetName);
      stringBuilder.append(", ");
    }
    if (apiVersion >= 0) {
      stringBuilder.append("API version - ");
      stringBuilder.append(apiVersion);
      stringBuilder.append(".");
    }
    return stringBuilder.toString();
  }
Ejemplo n.º 6
0
  private static OS create() {
    String os = Platform.getOS();
    String ws = Platform.getWS();
    String arch = Platform.getOSArch();

    if (Platform.OS_WIN32.equals(os)) {
      if (Platform.ARCH_X86_64.equals(arch)) {
        return new Win64(ws);
      }

      return new Win32(ws, arch);
    }

    if (Platform.OS_MACOSX.equals(os)) {
      return new Mac(ws, arch);
    }

    if (Platform.OS_LINUX.equals(os)) {
      return new Linux(ws, arch);
    }

    throw new IllegalStateException("Operating system not supported: " + os);
  }
Ejemplo n.º 7
0
 public boolean isCurrent() {
   return Platform.getOS().equals(osgiOS)
       && Platform.getWS().equals(osgiWS)
       && Platform.getOSArch().equals(osgiArch);
 }