Examples of Preferences


Examples of org.eclipse.core.runtime.Preferences

  /*
   * Update eclipse preferences from old preferences.
   */
   private void updatePreferences(IEclipsePreferences preferences) {
    
     Preferences oldPreferences = loadPreferences();
     if (oldPreferences != null) {
       String[] propertyNames = oldPreferences.propertyNames();
      for (int i = 0; i < propertyNames.length; i++){
        String propertyName = propertyNames[i];
          String propertyValue = oldPreferences.getString(propertyName);
          if (!"".equals(propertyValue)) { //$NON-NLS-1$
            preferences.put(propertyName, propertyValue);
          }
      }
      try {
View Full Code Here

Examples of org.jboss.errai.workspaces.client.framework.Preferences

            }

            // init by preferences
            if(null==initialToolSet)
            {
              Preferences prefs = GWT.create(Preferences.class);
              String preferedTool = prefs.has(Preferences.DEFAULT_TOOL) ?
                  Workspace.encode(prefs.get(Preferences.DEFAULT_TOOL)) : null;

              if(preferedTool!=null && workspace.hasToolSet(preferedTool))
              {
                initialToolSet = preferedTool;
              }
View Full Code Here

Examples of org.jboss.ide.eclipse.freemarker.preferences.Preferences

    return sb.toString();
  }

  public static String propose(StyleRange[] actual, IDocument document) {
    Map<Color, PreferenceKey> reverse = new HashMap<Color, PreferenceKey>();
    Preferences prefs = Preferences.getInstance();
    for (PreferenceKey k : PreferenceKey.values()) {
      if (k.name().startsWith("COLOR_")) { //$NON-NLS-1$
        Color c = prefs.getColor(k);
        reverse.put(c, k);
      }
    }

    StringBuilder out = new StringBuilder();
View Full Code Here

Examples of org.nb.Preferences

    public blogView(blogUser user, String prefPath) throws blogException
    {
        this.user = user;       //set active user
        try
        {
            pref = new Preferences(prefPath);
        }
        catch (ParserConfigurationException e) { throw new blogException("Cannot load preferences file. Message: " + e.getMessage()); }
        catch (SAXException e) { throw new blogException("Cannot load preferences file. Message: " + e.getMessage()); }
        catch (IOException e) { throw new blogException("Cannot load preferences file. Message: " + e.getMessage()); }
    }
View Full Code Here

Examples of org.olat.core.id.Preferences

  protected void formOK(UserRequest ureq) {
    UserManager um = UserManager.getInstance();
    Manager secMgr = ManagerFactory.getManager();
    // Refresh user from DB to prevent stale object issues
    tobeChangedIdentity = secMgr.loadIdentityByKey(tobeChangedIdentity.getKey());
    Preferences prefs = tobeChangedIdentity.getUser().getPreferences();
    prefs.setLanguage(language.getSelectedKey());
    prefs.setFontsize(fontsize.getSelectedKey());
    if (notificationInterval != null) {
      // only read notification interval if available, could be disabled by configuration
      prefs.setNotificationInterval(notificationInterval.getSelectedKey());     
    }

    // Maybe the user changed the font size
    if (ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) {
      int fontSize = Integer.parseInt(fontsize.getSelectedKey());
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

   
    // expand pathes from last time
    Set<String> expandedPathes = null;
    if (treeID != null) {
      guiPrefsKey = GUI_PREFS_KEY_PREFIX + treeID;
      Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
      expandedPathes = (Set<String>) guiPrefs.get(TreeController.class, guiPrefsKey);
      mainVC.contextPut("presistPathes", Boolean.TRUE);
    } else {
      mainVC.contextPut("presistPathes", Boolean.FALSE);
    }
    if (expandedPathes == null) {
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

        String newValue = uriHelper.getParameter(PARAM_VALUE);
        TreeNodeModifiedEvent editedEvent = new TreeNodeModifiedEvent(node, newValue);
        fireEvent(ureq, editedEvent);

      } else if (event.getCommand().equals(CMD_EXPAND)) {
        Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
        String expandedPath = uriHelper.getParameter(PARAM_PATH);
        Set<String> oldPathes = (Set<String>) guiPrefs.get(TreeController.class, guiPrefsKey);
        if (oldPathes == null) oldPathes = new HashSet<String>();
        Set<String> newPathes = new HashSet();
        for (String oldPath : oldPathes) {
          // remove all parent pathes to reduce redundancy
          if (!expandedPath.startsWith(oldPath)) newPathes.add(oldPath);
        }
        // add newly expaned node
        newPathes.add(expandedPath);
        guiPrefs.putAndSave(TreeController.class, guiPrefsKey, newPathes);
        // return empty resource
        ureq.getDispatchResult().setResultingMediaResource(okMediaResource);
       
      } else if (event.getCommand().equals(CMD_COLLAPSE)) {
        Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
        String collapsedPath = uriHelper.getParameter(PARAM_PATH);
        Set<String> oldPathes = (Set<String>) guiPrefs.get(TreeController.class, guiPrefsKey);
        if (oldPathes == null) oldPathes = new HashSet<String>();
        Set<String> newPathes = new HashSet();
        for (String oldPath : oldPathes) {
          // remove all child pathes
          if (!oldPath.startsWith(collapsedPath)) newPathes.add(oldPath);
        }
        guiPrefs.putAndSave(TreeController.class, guiPrefsKey, newPathes);
        // return empty resource
        ureq.getDispatchResult().setResultingMediaResource(okMediaResource);

      } else if (event.getCommand().equals(CMD_PING)) {
        // Nothing special to do. If any component is dirty, the framework has
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

    // Inline translation interceptor. when the translation tool is enabled it
    // will start the translation tool in translation mode, if the overlay
    // feature is enabled it will start in customizing mode
    if (ureq.getUserSession().isAuthenticated() && ureq.getUserSession().getRoles().isOLATAdmin() && (I18nModule.isTransToolEnabled() || I18nModule.isOverlayEnabled())) {
      inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
      Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
      Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
      I18nManager.getInstance().setMarkLocalizedStringsEnabled(ureq.getUserSession(), isInlineTranslationEnabled);     
      mainvc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
    }   

    // debug info if debugging
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

   */
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    FormUIFactory formFactory = FormUIFactory.getInstance();
    I18nManager i18nMgr = I18nManager.getInstance();
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    this.flc.contextPut("referenceLanguageKey", referenceLocale.toString());
    this.flc.contextPut("referenceLanguage", i18nMgr.getLanguageTranslated(referenceLocale.toString(), false));
    // Add bundles and keys selection
    List<String> bundlesList = new ArrayList<String>();
    List<String> keysList = new ArrayList<String>();
    for (I18nItem item : i18nItems) {
      if (!bundlesList.contains(item.getBundleName())) {
        bundlesList.add(item.getBundleName());
      }
      if (currentItem.getBundleName().equals(item.getBundleName())) {
        keysList.add(item.getKey());
      }
    }
    String[] bundlesListArray = ArrayHelper.toArray(bundlesList);
    String[] keysListArray = ArrayHelper.toArray(keysList);
    bundlesSelection = formFactory.addDropdownSingleselect("bundlesSelection", this.flc, bundlesListArray, bundlesListArray, null);
    bundlesSelection.addActionListener(this, FormEvent.ONCHANGE);
    bundlesSelection.select(currentItem.getBundleName(), true);
    keysSelection = formFactory.addDropdownSingleselect("keysSelection", this.flc, keysListArray, keysListArray, null);
    keysSelection.addActionListener(this, FormEvent.ONCHANGE);
    keysSelection.select(currentItem.getKey(), true);
    // Add reference box
    referenceArea = formFactory.addTextAreaElement("referenceArea", "edit.referenceArea", -1, 1, -1, true, null, this.flc);
    referenceArea.setEnabled(false); // read only
    // Add compare box
    Boolean compareEnabledPrefs = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_COMPARE_LANG_ENABLED, Boolean.FALSE);
    compareArea = formFactory.addTextAreaElement("compareArea", "edit.compareArea", -1, 1, -1, true, null, this.flc);
    compareArea.setEnabled(false); // read only
    compareArea.setVisible(compareEnabledPrefs.booleanValue());
    compareSwitch = formFactory.addCheckboxesHorizontal("compareSwitch", null, this.flc, new String[] { KEYS_ENABLED },
        new String[] { KEYS_EMPTY }, null);//i18nLabel set to null -> disabled label
    compareSwitch.select(KEYS_ENABLED, compareEnabledPrefs.booleanValue());
    compareSwitch.addActionListener(listener, FormEvent.ONCLICK);
    formLayout.add(compareSwitch);
    this.flc.contextPut("compareSwitchEnabled", compareEnabledPrefs);
    // Add compare language selection
    Set<String> availableLangKeys = I18nModule.getAvailableLanguageKeys();
    String[] comparelangKeys = ArrayHelper.toArray(availableLangKeys);
    String[] compareLangValues = new String[comparelangKeys.length];
    for (int i = 0; i < comparelangKeys.length; i++) {
      String key = comparelangKeys[i];
      String explLang = i18nMgr.getLanguageInEnglish(key, customizingMode);
      String all = explLang;
      if (explLang != null && !explLang.equals(key)) all += " (" + key + ")";
      compareLangValues[i] = all;
    }
    ArrayHelper.sort(comparelangKeys, compareLangValues, false, true, false);
    // Build css classes for comparison languages
    String[] compareLangCssClasses = i18nMgr.createLanguageFlagsCssClasses(comparelangKeys, "b_with_small_icon_left");
    String comparePrefs = (String) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_PREFERRED_COMPARE_LANG, I18nModule
        .getDefaultLocale().toString());
    compareLocale = i18nMgr.getLocaleOrNull(comparePrefs);
    if (compareLocale == null) compareLocale = I18nModule.getDefaultLocale();
    compareLangSelection = formFactory.addDropdownSingleselect("compareLangSelection", this.flc, comparelangKeys, compareLangValues,
        compareLangCssClasses);
View Full Code Here

Examples of org.olat.core.util.prefs.Preferences

    this.flc.contextPut("hasPrevious", (currentItemPosition == 0 ? Boolean.FALSE : Boolean.TRUE));
    this.flc.contextPut("hasNext", (currentItemPosition + 1 == i18nItems.size() ? Boolean.FALSE : Boolean.TRUE));
  }

  private void updateCompareArea(UserRequest ureq) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    if (compareSwitch.isSelected(0)) {
      I18nManager i18nMgr = I18nManager.getInstance();
      // Add target value
      String compareValue = i18nMgr.getLocalizedString(currentItem.getBundleName(), currentItem.getKey(), null, compareLocale, customizingMode, false,
          false, false, 0);
      compareArea.setValue(compareValue);
      // save settings as gui prefs
      guiPrefs.put(I18nModule.class, I18nModule.GUI_PREFS_PREFERRED_COMPARE_LANG, compareLocale.toString());
      guiPrefs.putAndSave(I18nModule.class, I18nModule.GUI_PREFS_COMPARE_LANG_ENABLED, Boolean.TRUE);
    } else {
      guiPrefs.putAndSave(I18nModule.class, I18nModule.GUI_PREFS_COMPARE_LANG_ENABLED, Boolean.FALSE);
    }
    // update GUI
    this.flc.contextPut("compareSwitchEnabled", Boolean.valueOf(compareSwitch.isSelected(0)));
    this.flc.contextPut("compareLanguageKey", compareLocale.toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.