Ejemplo n.º 1
0
  /**
   * Gets the data from the <tt>ConfigurationService</tt> that will construct the
   * <tt>PropsTableModel</tt> for the properties table.
   *
   * @return The data necessary to initialize the <tt>PropsTableModel</tt>
   */
  private Object[][] initTableModel() {
    ConfigurationService confService = PropertiesEditorActivator.getConfigurationService();
    java.util.List<String> properties = confService.getAllPropertyNames();
    Object[][] data = new Object[properties.size()][];
    int i = 0;

    for (String property : properties) {
      data[i++] = new Object[] {property, confService.getProperty(property)};
    }

    return data;
  }
  /**
   * Gets the max allowed size value in bytes from Configuration service and sets the value to
   * <tt>imgMaxSize</tt> if succeed. If the configuration property isn't available or the value
   * can't be parsed correctly the value of <tt>imgMaxSize</tt> isn't changed.
   */
  private void setMaxImgSizeFromConf() {
    ConfigurationService configService = DirectImageActivator.getConfigService();

    if (configService != null) {
      String confImgSizeStr = (String) configService.getProperty(MAX_IMG_SIZE);
      try {
        if (confImgSizeStr != null) {
          imgMaxSize = Long.parseLong(confImgSizeStr);
        } else {
          configService.setProperty(MAX_IMG_SIZE, imgMaxSize);
        }
      } catch (NumberFormatException e) {
        if (logger.isDebugEnabled())
          logger.debug(
              "Failed to parse max image size: " + confImgSizeStr + ". Going for default.");
      }
    }
  }