Package com.github.masahirosuzuka.PhoneGapIntelliJPlugin.externalToolsDetector

Source Code of com.github.masahirosuzuka.PhoneGapIntelliJPlugin.externalToolsDetector.AndroidSDKDetectorThread

package com.github.masahirosuzuka.PhoneGapIntelliJPlugin.externalToolsDetector;

import com.github.masahirosuzuka.PhoneGapIntelliJPlugin.settings.PhoneGapSettings;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.OSProcessHandler;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.project.Project;

/**
* AndroidSDKDetectorThread.java
*
* Created by Masahiro Suzuka on 2014/04/23.
*/
public class AndroidSDKDetectorThread implements Runnable {

  private Project project;

  public AndroidSDKDetectorThread(Project project) {
    this.project = project;
  }

  @Override
  public void run() {
    //System.out.println("AndroidSDk detector");
    final GeneralCommandLine generalCommandLine = new GeneralCommandLine(PhoneGapSettings.ANDROID_SDK, "--version");
    generalCommandLine.setWorkDirectory(project.getBasePath());
    try {
      OSProcessHandler handler = new OSProcessHandler(generalCommandLine);
      handler.startNotify();
      generalCommandLine.createProcess();
    } catch (Exception e) {
      // AndroidSDK not working
      // Output Notify
      String groupeDisplayId = "PhoneGap notification";
      String notificationTitle = "PhoneGap Plugin";
      String notificationMessage = "AndroidSDK not detected";
      NotificationType notificationType = NotificationType.ERROR;
      Notification notification = new Notification(groupeDisplayId, notificationTitle, notificationMessage, notificationType);

      Notifications.Bus.notify(notification);
    } finally { }
  }
}
TOP

Related Classes of com.github.masahirosuzuka.PhoneGapIntelliJPlugin.externalToolsDetector.AndroidSDKDetectorThread

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.