use of org.omegat.externalfinder.item.ExternalFinderConfiguration in project omegat by omegat-org.
the class ExternalFinder method setProjectConfig.
/**
* Set the project-specific configuration. Has no effect if no project is
* loaded. Any existing configuration file will be overwritten with the new
* one. Pass null to delete the config file.
*/
public static void setProjectConfig(ExternalFinderConfiguration newConfig) {
IProject currentProject = Core.getProject();
if (!currentProject.isProjectLoaded()) {
return;
}
ExternalFinderConfiguration oldConfig = projectConfig;
projectConfig = newConfig;
if (!Objects.equals(newConfig, oldConfig)) {
File projectFile = getProjectFile(currentProject);
writeConfig(newConfig, projectFile);
}
}
use of org.omegat.externalfinder.item.ExternalFinderConfiguration in project omegat by omegat-org.
the class ExternalFinder method getItems.
public static List<ExternalFinderItem> getItems() {
// replace duplicated items based on name
List<ExternalFinderItem> result = new ArrayList<>(getGlobalConfig().getItems());
ExternalFinderConfiguration projectConfig = getProjectConfig();
if (projectConfig != null) {
projectConfig.getItems().forEach(item -> addOrReplaceByName(result, item));
}
return Collections.unmodifiableList(result);
}
use of org.omegat.externalfinder.item.ExternalFinderConfiguration in project omegat by omegat-org.
the class ExternalFinder method setGlobalConfig.
/**
* Set the global configuration. Any existing configuration file will be
* overwritten with the new one. Pass null to delete the config file.
*/
public static void setGlobalConfig(ExternalFinderConfiguration newConfig) {
ExternalFinderConfiguration oldConfig = globalConfig;
globalConfig = newConfig;
if (!Objects.equals(newConfig, oldConfig)) {
writeConfig(newConfig, getGlobalConfigFile());
}
}
Aggregations