/** Creates the icon of the window shell. */ private void setWindowImage(Shell androidSdkUpdater) { String imageName = "android_icon_16.png"; // $NON-NLS-1$ if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_DARWIN) { imageName = "android_icon_128.png"; // $NON-NLS-1$ } if (mUpdaterData != null) { ImageFactory imgFactory = mUpdaterData.getImageFactory(); if (imgFactory != null) { mAndroidSdkUpdater.setImage(imgFactory.getImageByName(imageName)); } } }
/** The tool package executes tools/lib/post_tools_install[.bat|.sh] {@inheritDoc} */ @Override public void postInstallHook(Archive archive, ITaskMonitor monitor, File installFolder) { super.postInstallHook(archive, monitor, installFolder); if (installFolder == null) { return; } File libDir = new File(installFolder, SdkConstants.FD_LIB); if (!libDir.isDirectory()) { return; } String scriptName = "post_tools_install"; // $NON-NLS-1$ String shell = ""; // $NON-NLS-1$ if (SdkConstants.currentPlatform() == SdkConstants.PLATFORM_WINDOWS) { shell = "cmd.exe /c "; // $NON-NLS-1$ scriptName += ".bat"; // $NON-NLS-1$ } else { scriptName += ".sh"; // $NON-NLS-1$ } File scriptFile = new File(libDir, scriptName); if (!scriptFile.isFile()) { return; } Process proc; int status = -1; try { proc = Runtime.getRuntime() .exec( shell + scriptName, // command null, // environment libDir); // working dir status = grabProcessOutput(proc, monitor, scriptName); } catch (Exception e) { monitor.logError("Exception: %s", e.toString()); } if (status != 0) { monitor.logError("Failed to execute %s", scriptName); return; } }