@Override
 public void actionPerformed(NodeActionEvent e) {
   try {
     // get the parent MobileServiceNode node
     MobileServiceNode mobileServiceNode = customAPINode.findParentByType(MobileServiceNode.class);
     MobileService mobileService = mobileServiceNode.getMobileService();
     saveCustomAPI(
         (Project) customAPINode.getProject(),
         mobileService.getName(),
         mobileService.getSubcriptionId());
   } catch (AzureCmdException e1) {
     DefaultLoader.getUIHelper()
         .showException(
             "An error occurred while attempting to upload script.",
             e1,
             "Azure Services Explorer - Error Uploading Script",
             false,
             true);
   }
 }
  public void saveCustomAPI(Project project, final String serviceName, final String subscriptionId)
      throws AzureCmdException {
    VirtualFile editorFile =
        LocalFileSystem.getInstance()
            .refreshAndFindFileByIoFile(
                new File(customAPINode.getCustomAPI().getLocalFilePath(serviceName)));
    if (editorFile != null) {
      FileEditor[] fe = FileEditorManager.getInstance(project).getAllEditors(editorFile);

      if (fe.length > 0 && fe[0].isModified()) {
        int i =
            JOptionPane.showConfirmDialog(
                null,
                "The file is modified. Do you want to save pending changes?",
                "Upload Script",
                JOptionPane.YES_NO_CANCEL_OPTION,
                JOptionPane.INFORMATION_MESSAGE);
        switch (i) {
          case JOptionPane.YES_OPTION:
            ApplicationManager.getApplication().saveAll();
            break;
          case JOptionPane.CANCEL_OPTION:
          case JOptionPane.CLOSED_OPTION:
            return;
        }
      }

      ProgressManager.getInstance()
          .run(
              new Task.Backgroundable(project, "Uploading custom api script", false) {
                @Override
                public void run(@NotNull ProgressIndicator progressIndicator) {
                  try {
                    progressIndicator.setIndeterminate(true);
                    AzureManagerImpl.getManager()
                        .uploadAPIScript(
                            subscriptionId,
                            serviceName,
                            customAPINode.getCustomAPI().getName(),
                            customAPINode.getCustomAPI().getLocalFilePath(serviceName));
                  } catch (AzureCmdException e) {
                    DefaultLoader.getUIHelper()
                        .showException(
                            "An error occurred while attempting to upload script.",
                            e,
                            "Azure Services Explorer - Error Uploading Script",
                            false,
                            true);
                  }
                }
              });
    }
  }