Package com.eteks.sweethome3d.model

Examples of com.eteks.sweethome3d.model.RecorderException


  /**
   * Throws an exception because applet user preferences can't manage language libraries.
   */
  @Override
  public void addLanguageLibrary(String languageLibraryName) throws RecorderException {
    throw new RecorderException("No language libraries");
  }
View Full Code Here


  /**
   * Throws an exception because applet user preferences can't manage additional language libraries.
   */
  @Override
  public boolean languageLibraryExists(String languageLibraryName) throws RecorderException {
    throw new RecorderException("No language libraries");
  }
View Full Code Here

  /**
   * Throws an exception because applet user preferences can't manage furniture libraries.
   */
  @Override
  public boolean furnitureLibraryExists(String name) throws RecorderException {
    throw new RecorderException("No furniture libraries");
  }
View Full Code Here

   
    try {
      // Write preferences
      preferences.flush();
    } catch (BackingStoreException ex) {
      throw new RecorderException("Couldn't write preferences", ex);
    }
  }
View Full Code Here

          // this copy and the entry name
          copiedContent = copyToPreferencesURLContent(new URLContent(urlContent.getJAREntryURL()), contentPrefix);
          copiedContent = new URLContent(new URL("jar:" + copiedContent.getURL() + "!/" + urlContent.getJAREntryName()));
        } catch (MalformedURLException ex) {
          // Shouldn't happen
          throw new RecorderException("Can't build URL", ex);
        }
      } else {
        copiedContent = copyToPreferencesURLContent(urlContent, contentPrefix);
      }
      putContent(preferences, key, copiedContent, contentPrefix, furnitureContentURLs);
    } else if (content instanceof URLContent) {
      URLContent urlContent = (URLContent)content;
      try {
        preferences.put(key, urlContent.getURL().toString()
            .replace(getPreferencesFolder().toURI().toURL().toString(), "file:"));
      } catch (IOException ex) {
        throw new RecorderException("Can't save content", ex);
      }
      // Add to furnitureContentURLs the URL to the application file
      if (urlContent.isJAREntry()) {
        furnitureContentURLs.add(urlContent.getJAREntryURL());
      } else {
View Full Code Here

      while ((size = tempIn.read(buffer)) != -1) {
        tempOut.write(buffer, 0, size);
      }
      return new URLContent(preferencesFile.toURI().toURL());
    } catch (IOException ex) {
      throw new RecorderException("Can't save content", ex);
    } finally {
      try {
        if (tempIn != null) {
          tempIn.close();
        }
        if (tempOut != null) {
          tempOut.close();
        }
      } catch (IOException ex) {
        throw new RecorderException("Can't close files", ex);
      }
    }
  }
View Full Code Here

    // Search obsolete contents
    File applicationFolder;
    try {
      applicationFolder = getPreferencesFolder();
    } catch (IOException ex) {
      throw new RecorderException("Can't access to application folder");
    }
    File [] obsoleteContentFiles = applicationFolder.listFiles(
        new FileFilter() {
          public boolean accept(File applicationFile) {
            try {
View Full Code Here

   */
  public boolean languageLibraryExists(String name) throws RecorderException {
    File [] languageLibrariesPluginFolders = getLanguageLibrariesPluginFolders();
    if (languageLibrariesPluginFolders == null
        || languageLibrariesPluginFolders.length == 0) {
      throw new RecorderException("Can't access to language libraries plugin folder");
    } else {
      String libraryFileName = new File(name).getName();
      return new File(languageLibrariesPluginFolders [0], libraryFileName).exists();
    }
  }
View Full Code Here

  public void addLanguageLibrary(String languageLibraryName) throws RecorderException {
    try {
      File [] languageLibrariesPluginFolders = getLanguageLibrariesPluginFolders();
      if (languageLibrariesPluginFolders == null
          || languageLibrariesPluginFolders.length == 0) {
        throw new RecorderException("Can't access to language libraries plugin folder");
      }
      File languageLibraryFile = new File(languageLibraryName);
      copyToLibraryFolder(languageLibraryFile, languageLibrariesPluginFolders [0]);
      updateSupportedLanguages();
      // Switch automatically to the first language contained in library
      Set<String> languages = getLanguages(languageLibraryFile);
      if (!languages.isEmpty()) {
        setLanguage(languages.iterator().next());
      }
    } catch (IOException ex) {
      throw new RecorderException(
          "Can't write " + languageLibraryName +  " in language libraries plugin folder", ex);
    }
  }
View Full Code Here

  @Override
  public boolean furnitureLibraryExists(String name) throws RecorderException {
    File [] furnitureLibrariesPluginFolders = getFurnitureLibrariesPluginFolders();
    if (furnitureLibrariesPluginFolders == null
        || furnitureLibrariesPluginFolders.length == 0) {
      throw new RecorderException("Can't access to furniture libraries plugin folder");
    } else {
      String libraryFileName = new File(name).getName();
      return new File(furnitureLibrariesPluginFolders [0], libraryFileName).exists();
    }
  }
View Full Code Here

TOP

Related Classes of com.eteks.sweethome3d.model.RecorderException

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.