Пример #1
0
 public static boolean checkNoContigAceFiles(CharacterData data, MesquiteModule ownerModule) {
   DNAData editedData = ChromaseqUtil.getEditedData(data);
   if (editedData == null) return false;
   int count = 0;
   boolean resave = false;
   boolean warn = false;
   for (int it = 0; it < editedData.getNumTaxa(); it++)
     if (AceFile.hasAceFilePath(editedData, it)) {
       if (!AceFile.hasAceFile(ownerModule, editedData, it)) {}
       AceFile ace = AceFile.getAceFile(ownerModule, editedData, it);
       if (ace != null) {
         if (ace.getNumContigs() <= 0 || ace.getContig(0).getNumBases() == 0) {
           if (!warn
               && !AlertDialog.query(
                   ownerModule.containerOfModule(),
                   "Reprocess and save file?",
                   "Some of the contigs need to be reprocessed, which will"
                       + " alter the modified .ace files produced by Phrap and Chromaseq.  To be compatible with these altered .ace files, the Mesquite file "
                       + "would then need to be re-saved. If instead you choose not to reprocess contigs, they will not be fully editable in Chromaseq.",
                   "Reprocess and Save",
                   "Do not reprocess",
                   -1)) {
             return false;
           } else resave = true;
           warn = true;
           ChromaseqUtil.setReprocessContig(editedData, it);
         }
       }
       count++;
     }
   return resave;
 }
 /*.................................................................................................................*/
 boolean checkUsernamePassword(boolean tellUserAboutCipres) {
   if (StringUtil.blank(username) || StringUtil.blank(password)) {
     MesquiteBoolean answer = new MesquiteBoolean(false);
     MesquiteString usernameString = new MesquiteString();
     if (username != null) usernameString.setValue(username);
     MesquiteString passwordString = new MesquiteString();
     if (password != null) passwordString.setValue(password);
     String help =
         "You will need an account on the CIPRes REST system to use this service.  To register, go to https://www.phylo.org/restusers/register.action";
     new UserNamePasswordDialog(
         ownerModule.containerOfModule(),
         "Sign in to CIPRes",
         help,
         "",
         "Username",
         "Password",
         answer,
         usernameString,
         passwordString);
     if (answer.getValue()) {
       username = usernameString.getValue();
       password = passwordString.getValue();
     }
     ownerModule.storePreferences();
   }
   boolean success = StringUtil.notEmpty(username) && StringUtil.notEmpty(password);
   if (!success && tellUserAboutCipres) {
     MesquiteMessage.discreetNotifyUser(
         "Use of the CIPRes service requires an account with CIPRes's REST service.  Go to https://www.phylo.org/restusers/register.action to register for an account");
   }
   return success;
 }
 /*..........................................MContinuousStates................*/
 public int userQueryItem(String message, MesquiteModule module) {
   int numItems = getNumItems();
   String[] items = new String[numItems];
   for (int i = 0; i < items.length; i++) {
     if (StringUtil.blank(getItemName(i))) items[i] = "(unnamed)";
     else items[i] = getItemName(i);
   }
   return ListDialog.queryList(
       module.containerOfModule(), "Select item", message, MesquiteString.helpString, items, 0);
 }