Search in sources :

Example 6 with Filters

use of gen.core.filters.Filters in project omegat by omegat-org.

the class RealProject method loadFilterSettings.

/**
 * Load filter settings, either from the project or from global options
 */
private void loadFilterSettings() {
    // Set project specific file filters if they exist, or defaults otherwise.
    // This MUST happen before calling loadTranslations() because the setting to ignore file context
    // for alt translations is a filter setting, and it affects how alt translations are hashed.
    Filters filters = Optional.ofNullable(config.getProjectFilters()).orElse(Preferences.getFilters());
    Core.setFilterMaster(new FilterMaster(filters));
}
Also used : Filters(gen.core.filters.Filters) FilterMaster(org.omegat.filters2.master.FilterMaster)

Example 7 with Filters

use of gen.core.filters.Filters in project omegat by omegat-org.

the class FilterMaster method createDefaultFiltersConfig.

// ////////////////////////////////////////////////////////////////////////
// Filters
// ////////////////////////////////////////////////////////////////////////
/**
 * Reverts Filter Configuration to Default values. Basically
 * <ul>
 * <li>Sets up built-in filters
 * <li>Reloads the plugins
 * <li>Loads filters from plugins
 * <li>Saves the configuration
 * </ul>
 */
public static Filters createDefaultFiltersConfig() {
    Filters c = new Filters();
    addNewFiltersToConfig(c);
    return c;
}
Also used : Filters(gen.core.filters.Filters)

Example 8 with Filters

use of gen.core.filters.Filters in project omegat by omegat-org.

the class FilterMaster method cloneConfig.

/**
 * Clone config for editing
 *
 * @return new config instance
 */
public static Filters cloneConfig(Filters orig) {
    Filters c = new Filters();
    c.setRemoveTags(orig.isRemoveTags());
    c.setRemoveSpacesNonseg(orig.isRemoveSpacesNonseg());
    c.setPreserveSpaces(orig.isPreserveSpaces());
    c.setIgnoreFileContext(orig.isIgnoreFileContext());
    for (Filter f : orig.getFilters()) {
        c.getFilters().add(cloneFilter(f));
    }
    return c;
}
Also used : Filters(gen.core.filters.Filters) IFilter(org.omegat.filters2.IFilter) Filter(gen.core.filters.Filter) AbstractFilter(org.omegat.filters2.AbstractFilter)

Aggregations

Filters (gen.core.filters.Filters)8 IOException (java.io.IOException)3 Files (gen.core.filters.Files)2 Filter (gen.core.filters.Filter)2 File (java.io.File)2 BeanInfo (java.beans.BeanInfo)1 PropertyDescriptor (java.beans.PropertyDescriptor)1 XMLDecoder (java.beans.XMLDecoder)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Serializable (java.io.Serializable)1 JAXBContext (javax.xml.bind.JAXBContext)1 Marshaller (javax.xml.bind.Marshaller)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 Test (org.junit.Test)1 AbstractFilter (org.omegat.filters2.AbstractFilter)1 IFilter (org.omegat.filters2.IFilter)1 TranslationException (org.omegat.filters2.TranslationException)1 FilterMaster (org.omegat.filters2.master.FilterMaster)1