use of org.omegat.externalfinder.item.ExternalFinderXMLLoader in project omegat by omegat-org.
the class ExternalFinder method getProjectConfig.
/**
* Get the project-specific configuration.
*
* @return The configuration, or null if no project is loaded or the project
* has no config file
*/
public static ExternalFinderConfiguration getProjectConfig() {
IProject currentProject = Core.getProject();
if (!currentProject.isProjectLoaded()) {
return null;
}
if (projectConfig == null) {
// load project's xml file
File projectFile = getProjectFile(currentProject);
IExternalFinderItemLoader projectItemLoader = new ExternalFinderXMLLoader(projectFile, SCOPE.PROJECT);
try {
projectConfig = projectItemLoader.load();
} catch (FileNotFoundException e) {
// Ignore
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
return projectConfig;
}
use of org.omegat.externalfinder.item.ExternalFinderXMLLoader in project omegat by omegat-org.
the class ExternalFinder method getGlobalConfig.
/**
* Get the global configuration. This is stored in the user's OmegaT
* configuration directory. If the file does not exist, an empty
* configuration will be created and returned.
*
* @return The configuration (will never be null)
*/
public static ExternalFinderConfiguration getGlobalConfig() {
if (globalConfig == null) {
try {
File globalFile = getGlobalConfigFile();
IExternalFinderItemLoader userItemLoader = new ExternalFinderXMLLoader(globalFile, SCOPE.GLOBAL);
globalConfig = userItemLoader.load();
} catch (FileNotFoundException e) {
// Ignore
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
if (globalConfig == null) {
globalConfig = ExternalFinderConfiguration.empty();
}
}
return globalConfig;
}
Aggregations