public SourceLevelComboBoxModel(
     JCProjectProperties props,
     String initialSourceLevel,
     String initialTargetLevel,
     SpecificationVersion minimalSpecificationVersion) {
   activePlatform = props.getPlatform();
   this.props = props;
   if (initialSourceLevel != null && initialSourceLevel.length() > 0) {
     try {
       originalSourceLevel = new SpecificationVersion(initialSourceLevel);
     } catch (NumberFormatException nfe) {
       // if the javac.source has invalid value, do not preselect and log it.
       LOGGER.warning("Invalid javac.source: " + initialSourceLevel); // NOI18N
     }
   }
   if (initialTargetLevel != null && initialTargetLevel.length() > 0) {
     try {
       SpecificationVersion originalTargetLevel = new SpecificationVersion(initialTargetLevel);
       if (originalSourceLevel == null || originalSourceLevel.compareTo(originalTargetLevel) < 0) {
         originalSourceLevel = originalTargetLevel;
       }
     } catch (NumberFormatException nfe) {
       // if the javac.target has invalid value, do not preselect and log it
       LOGGER.warning("Invalid javac.target: " + initialTargetLevel); // NOI18N
     }
   }
   selectedSourceLevel = originalSourceLevel;
   this.minimalSpecificationVersion = minimalSpecificationVersion;
 }
 public String getDisplayName() {
   String tmp = sourceLevel.toString();
   if (JDK_1_5.compareTo(sourceLevel) <= 0) {
     tmp = tmp.replaceFirst("^1\\.([5-9]|\\d\\d+)$", "$1"); // NOI18N
   }
   return NbBundle.getMessage(PlatformUiSupport.class, "LBL_JDK", tmp); // NOI18N
 }
 public void platformChanged() {
   if (inPlatformChanged) {
     return;
   }
   inPlatformChanged = true;
   try {
     JavacardPlatform platform = activePlatform;
     if (platform != null) {
       SpecificationVersion version = platform.getSpecification().getVersion();
       if (selectedSourceLevel != null
           && selectedSourceLevel.compareTo(version) > 0
           && !shouldChangePlatform(selectedSourceLevel, version)) {
         props.setPlatformName(platform.getSystemName());
         // restore original
         return;
       } else {
         originalSourceLevel = null;
       }
     }
     activePlatform = props.getPlatform();
     resetCache();
   } finally {
     inPlatformChanged = false;
   }
 }
 private int getMinimalIndex(SpecificationVersion platformVersion) {
   int index = INITIAL_VERSION_MINOR;
   if (minimalSpecificationVersion != null) {
     SpecificationVersion min = new SpecificationVersion(VERSION_PREFIX + Integer.toString(index));
     while (min.compareTo(platformVersion) <= 0) {
       if (min.equals(minimalSpecificationVersion)) {
         return index;
       }
       min = new SpecificationVersion(VERSION_PREFIX + Integer.toString(++index));
     }
   }
   return index;
 }