Package com.mucommander.commons.conf

Examples of com.mucommander.commons.conf.Configuration


  /**
   * Prevents instantiation of this class from outside of this package.
   */
  MuPreferences() {
    configuration = new Configuration(MuPreferencesFile.getPreferencesFile(), new VersionedXmlConfigurationReaderFactory(),
        new VersionedXmlConfigurationWriterFactory(ROOT_ELEMENT));
  }
View Full Code Here


   * @throws ConfigurationException if a CONFIGURATION related error occurs.
   */
  void write() throws IOException, ConfigurationException {
    if(configurationVersion != null && !configurationVersion.equals(RuntimeConstants.VERSION)) {
      // Clear the configuration before saving to drop preferences which are unused anymore
      Configuration conf = new Configuration(MuPreferencesFile.getPreferencesFile(), new VersionedXmlConfigurationReaderFactory(),
          new VersionedXmlConfigurationWriterFactory(ROOT_ELEMENT));

      for (MuPreference preference : MuPreference.values())
        conf.setVariable(preference.toString(), configuration.getVariable(preference.toString()));
     
      // Remove preferences which are not relevant if we're not using MAC
      if (!OsFamily.MAC_OS_X.isCurrent()) {
        conf.removeVariable(USE_BRUSHED_METAL);
        conf.removeVariable(USE_SCREEN_MENU_BAR);
      }

      configuration = conf;
    }

View Full Code Here

    /**
     * Prevents instantiation of this class from outside of this package.
     */
    MuSnapshot() {
      configuration = new Configuration(MuSnapshotFile.getSnapshotFile(), new VersionedXmlConfigurationReaderFactory(),
          new VersionedXmlConfigurationWriterFactory(ROOT_ELEMENT));
   
    try {
      screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    }
View Full Code Here

    protected AbstractFile[] getInitialPaths(FolderPanelType folderPanelType, int window) {
        boolean       isCustom;    // Whether the initial path is a custom one or the last used folder.
        String[]      folderPaths; // Paths to the initial folders.
       
        // Snapshot configuration
        Configuration snapshot = MuConfigurations.getSnapshot();
        // Preferences configuration
        MuPreferencesAPI preferences = MuConfigurations.getPreferences();
       
        // Checks which kind of initial path we're dealing with.
        isCustom = preferences.getVariable(MuPreference.STARTUP_FOLDERS, MuPreferences.DEFAULT_STARTUP_FOLDERS).equals(MuPreferences.STARTUP_FOLDERS_CUSTOM);

        // Handles custom initial paths.
        if (isCustom) {
          folderPaths = new String[] {(folderPanelType == FolderPanelType.LEFT ? preferences.getVariable(MuPreference.LEFT_CUSTOM_FOLDER) :
            preferences.getVariable(MuPreference.RIGHT_CUSTOM_FOLDER))};
        }
        // Handles "last folder" initial paths.
        else {
          // Set initial path to each tab
          int nbFolderPaths = snapshot.getIntegerVariable(MuSnapshot.getTabsCountVariable(window, folderPanelType == FolderPanelType.LEFT));
          folderPaths = new String[nbFolderPaths];
          for (int i=0; i<nbFolderPaths;++i)
            folderPaths[i] = snapshot.getVariable(MuSnapshot.getTabLocationVariable(window, folderPanelType == FolderPanelType.LEFT, i));
        }

        List<AbstractFile> initialFolders = new LinkedList<AbstractFile>(); // Initial folders
        AbstractFile folder;
       
View Full Code Here

 
  /**
   * Private Constructor
   */
  private GlobalLocationHistory() {
    Configuration snapshot = MuConfigurations.getSnapshot();

    // Restore the global history from last run
    int nbLocations = snapshot.getIntegerVariable(MuSnapshot.getRecentLocationsCountVariable());
      for (int i=0; i<nbLocations; ++i) {
        String filePath = snapshot.getVariable(MuSnapshot.getRecentLocationVariable(i));
      try {
        history.add(FileURL.getFileURL(filePath));
      } catch (MalformedURLException e) {
        LOGGER.debug("Got invalid URL from the snapshot file: " + filePath, e);
      }
View Full Code Here

TOP

Related Classes of com.mucommander.commons.conf.Configuration

Copyright © 2018 www.massapicom. 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.