projectviewer.importer
Class ImportUtils

java.lang.Object
  extended by projectviewer.importer.ImportUtils

public final class ImportUtils
extends java.lang.Object

A collection of functions useful when dealing with importing files.

Since:
PV 3.0.0
Author:
Marcelo Vanzin

Method Summary
static void cleanConfig(java.util.Properties p, java.lang.String propRoot)
          Cleans the configuration related to filters from the given object.
static boolean getAddHiddenFiles(java.util.Properties p, java.lang.String propRoot)
          Returns the "add hidden files" option for the given properties.
static java.util.List<ImporterFileFilter> getFilters(VPTProject p)
          Return the list of filters available for importing files.
static java.lang.String getImportFilterId(VPTProject p)
          Returns the String id of the last used import filter.
static ImporterFileFilter loadFilter(java.util.Properties p, java.util.List<ImporterFileFilter> filters, java.lang.String propRoot)
          Loads the filter information from the project, and tries to identify a matching filter in the given list.
static void saveFilter(java.util.Properties p, ImporterFileFilter filter, boolean addHidden, java.lang.String propRoot)
          Saves the configuration about the selected filter to the project.
static void saveFilter(java.util.Properties p, ImporterFileFilter filter, java.lang.String propRoot)
          Saves the configuration about the selected filter to the project.
static void setImportFilterId(VPTProject p, java.lang.String id)
          Sets the import filter which will be default for next import.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFilters

public static java.util.List<ImporterFileFilter> getFilters(VPTProject p)
Return the list of filters available for importing files.

Returns:
A list with all the filters known to PV.

saveFilter

public static void saveFilter(java.util.Properties p,
                              ImporterFileFilter filter,
                              java.lang.String propRoot)
Saves the configuration about the selected filter to the project.

Parameters:
p - Properties object.
filter - The filter instance.
propRoot - Root of the configuration property names.

saveFilter

public static void saveFilter(java.util.Properties p,
                              ImporterFileFilter filter,
                              boolean addHidden,
                              java.lang.String propRoot)
Saves the configuration about the selected filter to the project.

Parameters:
p - Properties object.
filter - The filter instance.
addHidden - The "add hidden files" option.
propRoot - Root of the configuration property names.
Since:
PV 3.0.1

loadFilter

public static ImporterFileFilter loadFilter(java.util.Properties p,
                                            java.util.List<ImporterFileFilter> filters,
                                            java.lang.String propRoot)
Loads the filter information from the project, and tries to identify a matching filter in the given list.

Parameters:
p - Properties object.
filters - List of filters to search.
propRoot - Root of the configuration property names.
Returns:
The filter that matches the project config, or null if not found.

getImportFilterId

public static java.lang.String getImportFilterId(VPTProject p)
Returns the String id of the last used import filter.

Returns:
String value to be used in setImportFilterId
Since:
3.4.2

setImportFilterId

public static void setImportFilterId(VPTProject p,
                                     java.lang.String id)
Sets the import filter which will be default for next import.

Parameters:
id - Returned from getImportFilterId. This equals to a String returned by ImporterFileFilter.getId().
Since:
3.4.2

cleanConfig

public static void cleanConfig(java.util.Properties p,
                               java.lang.String propRoot)
Cleans the configuration related to filters from the given object.

Parameters:
p - Properties object.
propRoot - Root of the configuration property names.

getAddHiddenFiles

public static boolean getAddHiddenFiles(java.util.Properties p,
                                        java.lang.String propRoot)
Returns the "add hidden files" option for the given properties.

Returns:
Whether the "add hidden files" option is set.
Since:
PV 3.0.1