Пример #1
0
 static {
   Locale locale = Locale.getDefault();
   COUNTRY = locale == null ? DEFAULT_COUNTRY : locale.getCountry();
   String language = locale == null ? DEFAULT_LANGUAGE : locale.getLanguage();
   // Special case Chinese
   if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(language)) {
     language += "-r" + COUNTRY;
   }
   LANGUAGE = language;
 }
Пример #2
0
 private static String getSystemLanguage() {
   Locale locale = Locale.getDefault();
   if (locale == null) {
     return DEFAULT_LANGUAGE;
   }
   String language = locale.getLanguage();
   // Special case Chinese
   if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(language)) {
     return language + "-r" + getSystemCountry();
   }
   return language;
 }
  /**
   * @see
   *     org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
   */
  @Override
  public void initializeDefaultPreferences() {

    IEclipsePreferences node =
        new DefaultScope().getNode(CorePlugin.getDefault().getBundle().getSymbolicName());

    // Building temporary files directory path
    IPath tempPath =
        new Path(System.getProperty("user.dir"))
            .append("temp"); // NON-NLS-1$// NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-2$
    File tempFile = tempPath.toFile();
    if (!tempFile.exists()) {
      tempFile.mkdirs();
    }
    node.put(ITalendCorePrefConstants.FILE_PATH_TEMP, tempPath.toOSString());

    String os = Platform.getOS();
    String javaPath = System.getProperty("java.home"); // NON-NLS-1$ //$NON-NLS-1$
    if (os.equals(Platform.OS_WIN32)) {
      node.put(ITalendCorePrefConstants.JAVA_INTERPRETER, javaPath + JAVA_WIN32_INTERPRETER);
    } else if (os.equals(Platform.OS_LINUX)) {
      node.put(ITalendCorePrefConstants.JAVA_INTERPRETER, javaPath + JAVA_LINUX_INTERPRETER_PATH);
    }

    // Sets default language
    node.put(ITalendCorePrefConstants.LANGUAGE_SELECTOR, Locale.getDefault().getLanguage());

    node.put(ITalendCorePrefConstants.PREVIEW_LIMIT, "50"); // $NON-NLS-1$

    node.putBoolean(ITalendCorePrefConstants.ALWAYS_WELCOME, true);

    String languageType = Locale.getDefault().getLanguage();
    if (Locale.getDefault().equals(Locale.CHINA)) {
      languageType = Locale.SIMPLIFIED_CHINESE.toString();
    }

    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.LANGUAGE_SELECTOR, languageType);
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.SQL_ADD_QUOTE, false);

    // As default, sets the choice which automatic generate corresponding documentation files if job
    // is saved to
    // true:
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.DOC_GENERATION, false);
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.USE_CSS_TEMPLATE, false);
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.CONTEXT_GROUP_BY_SOURCE, true);
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.DOC_GENERATESOURCECODE, false);
    // CorePlugin.getDefault().getPreferenceStore().setDefault(ITalendCorePrefConstants.DOC_HIDEPASSWORDS, true);

    //
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.SQL_ADD_WARNING, true);

    CorePlugin.getDefault()
        .getPreferenceStore()
        .setDefault(ITalendCorePrefConstants.FORBIDDEN_MAPPING_LENGTH_PREC_LOGIC, false);
  }