// Path: app/src/processing/app/I18n.java
// public static String _(String s) {
//   String res;
//   try {
//     res = i18n.getString(s);
//   } catch (MissingResourceException e) {
//     res = s;
//   }
// 
//   // The single % is the arguments selector in .PO files.
//   // We must put double %% inside the translations to avoid
//   // getting .PO processing in the way.
//   res = res.replace("%%", "%");
// 
//   return res;
// }
// 
// Path: app/src/processing/app/I18n.java
// public class I18n {
//   // start using current locale but still allow using the dropdown list later
//   private static ResourceBundle i18n;
// 
//   // prompt text stuff
// 
//   static String PROMPT_YES;
//   static String PROMPT_NO;
//   static String PROMPT_CANCEL;
//   static String PROMPT_OK;
//   static String PROMPT_BROWSE;
// 
//   static protected void init(String language) throws MissingResourceException {
//     String[] languageParts = language.split("_");
//     Locale locale = Locale.getDefault();
//     // both language and country
//     if (languageParts.length == 2) {
//       locale = new Locale(languageParts[0], languageParts[1]);
//       // just language
//     } else if (languageParts.length == 1 && !"".equals(languageParts[0])) {
//       locale = new Locale(languageParts[0]);
//     }
//     // there might be a null pointer exception ... most likely will never happen but the jvm gets mad
//     Locale.setDefault(locale);
//     i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
//     PROMPT_YES = _("Yes");
//     PROMPT_NO = _("No");
//     PROMPT_CANCEL = _("Cancel");
//     PROMPT_OK = _("OK");
//     PROMPT_BROWSE = _("Browse");
//   }
// 
//   public static String _(String s) {
//     String res;
//     try {
//       res = i18n.getString(s);
//     } catch (MissingResourceException e) {
//       res = s;
//     }
// 
//     // The single % is the arguments selector in .PO files.
//     // We must put double %% inside the translations to avoid
//     // getting .PO processing in the way.
//     res = res.replace("%%", "%");
// 
//     return res;
//   }
// 
//   public static String format(String fmt, Object... args) {
//     // Single quote is used to escape curly bracket arguments.
// 
//     // - Prevents strings fixed at translation time to be fixed again
//     fmt = fmt.replace("''", "'");
//     // - Replace ' with the escaped version ''
//     fmt = fmt.replace("'", "''");
// 
//     return MessageFormat.format(fmt, args);
//   }
// 
//   /**
//    * Does nothing.
//    * <p/>
//    * This method is an hack to extract words with gettext tool.
//    */
//   protected static void unusedStrings() {
//     // These phrases are defined in the "platform.txt".
//     _("Arduino AVR Boards");
//     _("Arduino ARM (32-bits) Boards");
// 
//     // This word is defined in the "boards.txt".
//     _("Processor");
//   }
// }


import processing.app.I18n;
import processing.app.helpers.filefilters.OnlyDirs;
import static processing.app.I18n._;
import java.io.File;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
 TargetPackage - Represents a hardware package
 Part of the Arduino project - http://www.arduino.cc/

 Copyright (c) 2011 Cristian Maglie

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 $Id$
 */
package processing.app.debug;




public class TargetPackage {

  private String id;

  Map<String, TargetPlatform> platforms = new LinkedHashMap<String, TargetPlatform>();

  public TargetPackage(String _id, File _folder) throws TargetPlatformException {
    id = _id;

    File[] folders = _folder.listFiles(new OnlyDirs());
    if (folders == null)
      return;

    for (File subFolder : folders) {
      if (!subFolder.exists() || !subFolder.canRead())
        continue;
      String arch = subFolder.getName();
      try {
        TargetPlatform platform = new TargetPlatform(arch, subFolder, this);
        platforms.put(arch, platform);
      } catch (TargetPlatformException e) {
        System.out.println(e.getMessage());
      }
    }

    if (platforms.size() == 0) {
      throw new TargetPlatformException(I18n
// Path: app/src/processing/app/I18n.java
// public static String _(String s) {
//   String res;
//   try {
//     res = i18n.getString(s);
//   } catch (MissingResourceException e) {
//     res = s;
//   }
// 
//   // The single % is the arguments selector in .PO files.
//   // We must put double %% inside the translations to avoid
//   // getting .PO processing in the way.
//   res = res.replace("%%", "%");
// 
//   return res;
// }
// 
// Path: app/src/processing/app/I18n.java
// public class I18n {
//   // start using current locale but still allow using the dropdown list later
//   private static ResourceBundle i18n;
// 
//   // prompt text stuff
// 
//   static String PROMPT_YES;
//   static String PROMPT_NO;
//   static String PROMPT_CANCEL;
//   static String PROMPT_OK;
//   static String PROMPT_BROWSE;
// 
//   static protected void init(String language) throws MissingResourceException {
//     String[] languageParts = language.split("_");
//     Locale locale = Locale.getDefault();
//     // both language and country
//     if (languageParts.length == 2) {
//       locale = new Locale(languageParts[0], languageParts[1]);
//       // just language
//     } else if (languageParts.length == 1 && !"".equals(languageParts[0])) {
//       locale = new Locale(languageParts[0]);
//     }
//     // there might be a null pointer exception ... most likely will never happen but the jvm gets mad
//     Locale.setDefault(locale);
//     i18n = ResourceBundle.getBundle("processing.app.i18n.Resources", Locale.getDefault());
//     PROMPT_YES = _("Yes");
//     PROMPT_NO = _("No");
//     PROMPT_CANCEL = _("Cancel");
//     PROMPT_OK = _("OK");
//     PROMPT_BROWSE = _("Browse");
//   }
// 
//   public static String _(String s) {
//     String res;
//     try {
//       res = i18n.getString(s);
//     } catch (MissingResourceException e) {
//       res = s;
//     }
// 
//     // The single % is the arguments selector in .PO files.
//     // We must put double %% inside the translations to avoid
//     // getting .PO processing in the way.
//     res = res.replace("%%", "%");
// 
//     return res;
//   }
// 
//   public static String format(String fmt, Object... args) {
//     // Single quote is used to escape curly bracket arguments.
// 
//     // - Prevents strings fixed at translation time to be fixed again
//     fmt = fmt.replace("''", "'");
//     // - Replace ' with the escaped version ''
//     fmt = fmt.replace("'", "''");
// 
//     return MessageFormat.format(fmt, args);
//   }
// 
//   /**
//    * Does nothing.
//    * <p/>
//    * This method is an hack to extract words with gettext tool.
//    */
//   protected static void unusedStrings() {
//     // These phrases are defined in the "platform.txt".
//     _("Arduino AVR Boards");
//     _("Arduino ARM (32-bits) Boards");
// 
//     // This word is defined in the "boards.txt".
//     _("Processor");
//   }
// }


// Path: app/src/processing/app/debug/TargetPackage.java
import processing.app.I18n;
import processing.app.helpers.filefilters.OnlyDirs;
import static processing.app.I18n._;
import java.io.File;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;

/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
 TargetPackage - Represents a hardware package
 Part of the Arduino project - http://www.arduino.cc/

 Copyright (c) 2011 Cristian Maglie

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 $Id$
 */
package processing.app.debug;




public class TargetPackage {

  private String id;

  Map<String, TargetPlatform> platforms = new LinkedHashMap<String, TargetPlatform>();

  public TargetPackage(String _id, File _folder) throws TargetPlatformException {
    id = _id;

    File[] folders = _folder.listFiles(new OnlyDirs());
    if (folders == null)
      return;

    for (File subFolder : folders) {
      if (!subFolder.exists() || !subFolder.canRead())
        continue;
      String arch = subFolder.getName();
      try {
        TargetPlatform platform = new TargetPlatform(arch, subFolder, this);
        platforms.put(arch, platform);
      } catch (TargetPlatformException e) {
        System.out.println(e.getMessage());
      }
    }

    if (platforms.size() == 0) {
      throw new TargetPlatformException(I18n
          .format(_("No valid hardware definitions found in folder {0}."),