app/src/main/java/com/oracle/javafx/scenebuilder/app/preferences/PreferencesRecordDocument.java
private String generateKey(String name) throws BackingStoreException {

    String key = name;
    if (key.length() > Preferences.MAX_KEY_LENGTH) {
      key = name.substring(0, Preferences.MAX_KEY_LENGTH);
    }

    int prefix = 1, max = 20; // Allow up to 20 files with same name
    while (documentsRootPreferences.nodeExists(key) && prefix < max) {
      key = prefix++ + "_" + name; // NOI18N
      if (key.length() > Preferences.MAX_KEY_LENGTH) {
        key = key.substring(0, Preferences.MAX_KEY_LENGTH);
      }
    }
    return key;
  }
/**
   * Generates a document node key for the specified document file name. Preferences keys are
   * limited to 80 chars so we cannot use the document path.
   *
   * <p>If there is no document key matching the specified document file name, we use it as this
   * document key. Otherwise, we prepend the document file name with an index.
   *
   * @param name The document file name
   * @return
   */
Generates a document node key for the specified document file name. Preferences keys are
limited to 80 chars so we cannot use the document path.

If there is no document key matching the specified document file name, we use it as this
document key. Otherwise, we prepend the document file name with an index.

@param name The document file name
@return
Generates a document node key for the specified document file name . Preferences keys are limited to 80 chars so we cannot use the document path . If there is no document key matching the specified document file name we use it as this document key . Otherwise we prepend the document file name with an index . @param name The document file name @return
private String generateKey(String name) throws BackingStoreException {
    String key = name;
    if (key.length() > Preferences.MAX_KEY_LENGTH) {
      key = name.substring(0, Preferences.MAX_KEY_LENGTH);
    }
    int prefix = 1, max = 20; 
    while (documentsRootPreferences.nodeExists(key) && prefix < max) {
      key = prefix++ + "_" + name; 
      if (key.length() > Preferences.MAX_KEY_LENGTH) {
        key = key.substring(0, Preferences.MAX_KEY_LENGTH);
      }
    }
    return key;
  }
private String generateKey ( String name ) throws BackingStoreException { String key = name ; if ( key . length ( ) > Preferences . MAX_KEY_LENGTH ) { key = name . substring ( 0 , Preferences . MAX_KEY_LENGTH ) ; } int prefix = 1 , max = 20 ; while ( documentsRootPreferences . nodeExists ( key ) && prefix < max ) { key = prefix ++ + "_" + name ; if ( key . length ( ) > Preferences . MAX_KEY_LENGTH ) { key = key . substring ( 0 , Preferences . MAX_KEY_LENGTH ) ; } } return key ; }
Generates a document node key for the specified document file name.
Generates a document node key for the specified document file name .
// Allow up to 20 files with same name // NOI18N