Search in sources :

Example 1 with ExternalFinderConfiguration

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);
    }
}
Also used : ExternalFinderConfiguration(org.omegat.externalfinder.item.ExternalFinderConfiguration) File(java.io.File) IProject(org.omegat.core.data.IProject)

Example 2 with ExternalFinderConfiguration

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);
}
Also used : ExternalFinderItem(org.omegat.externalfinder.item.ExternalFinderItem) ArrayList(java.util.ArrayList) ExternalFinderConfiguration(org.omegat.externalfinder.item.ExternalFinderConfiguration)

Example 3 with ExternalFinderConfiguration

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());
    }
}
Also used : ExternalFinderConfiguration(org.omegat.externalfinder.item.ExternalFinderConfiguration)

Aggregations

ExternalFinderConfiguration (org.omegat.externalfinder.item.ExternalFinderConfiguration)3 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IProject (org.omegat.core.data.IProject)1 ExternalFinderItem (org.omegat.externalfinder.item.ExternalFinderItem)1