Search in sources :

Example 1 with Segmenter

use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.

the class RealProject method createProject.

/**
 * Create new project.
 */
public void createProject() {
    Log.logInfoRB("LOG_DATAENGINE_CREATE_START");
    UIThreadsUtil.mustNotBeSwingThread();
    try {
        if (!lockProject()) {
            throw new KnownException("PROJECT_LOCKED");
        }
        createDirectory(config.getProjectRoot(), null);
        createDirectory(config.getProjectInternal(), OConsts.DEFAULT_INTERNAL);
        createDirectory(config.getSourceRoot(), OConsts.DEFAULT_SOURCE);
        createDirectory(config.getGlossaryRoot(), OConsts.DEFAULT_GLOSSARY);
        createDirectory(config.getTMRoot(), OConsts.DEFAULT_TM);
        createDirectory(config.getTMAutoRoot(), OConsts.AUTO_TM);
        createDirectory(config.getDictRoot(), OConsts.DEFAULT_DICT);
        createDirectory(config.getTargetRoot(), OConsts.DEFAULT_TARGET);
        // createDirectory(m_config.getTMOtherLangRoot(), OConsts.DEFAULT_OTHERLANG);
        saveProjectProperties();
        // Set project specific segmentation rules if they exist, or
        // defaults otherwise.
        SRX srx = config.getProjectSRX();
        Core.setSegmenter(new Segmenter(srx == null ? Preferences.getSRX() : srx));
        loadTranslations();
        setProjectModified(true);
        saveProject(false);
        loadSourceFiles();
        allProjectEntries = Collections.unmodifiableList(allProjectEntries);
        importHandler = new ImportFromAutoTMX(this, allProjectEntries);
        importTranslationsFromSources();
        loadTM();
        loadOtherLanguages();
        loaded = true;
        // clear status message
        Core.getMainWindow().showStatusMessageRB(null);
    } catch (Exception e) {
        // trouble in tinsletown...
        Log.logErrorRB(e, "CT_ERROR_CREATING_PROJECT");
        Core.getMainWindow().displayErrorRB(e, "CT_ERROR_CREATING_PROJECT");
    }
    Log.logInfoRB("LOG_DATAENGINE_CREATE_END");
}
Also used : KnownException(org.omegat.core.KnownException) SRX(org.omegat.core.segmentation.SRX) Segmenter(org.omegat.core.segmentation.Segmenter) KnownException(org.omegat.core.KnownException) IOException(java.io.IOException) SAXParseException(org.xml.sax.SAXParseException)

Example 2 with Segmenter

use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.

the class TestTeamIntegration method main.

public static void main(String[] args) throws Exception {
    String startVersion = prepareRepo();
    Run[] runs = new Run[THREADS.length];
    for (int i = 0; i < THREADS.length; i++) {
        runs[i] = new Run(THREADS[i], new File(DIR, THREADS[i]), MAX_DELAY_SECONDS);
    }
    for (int i = 0; i < THREADS.length; i++) {
        runs[i].start();
    }
    boolean alive;
    do {
        alive = false;
        for (int i = 0; i < THREADS.length; i++) {
            if (runs[i].finished) {
                if (runs[i].result != 200) {
                    for (Run r : runs) {
                        r.end();
                    }
                    System.err.println("==================== EXIT BY ERROR ====================");
                    System.exit(1);
                }
            } else {
                alive = true;
            }
        }
        Thread.sleep(500);
    } while (alive);
    repo = createRepo2(REPO, new File(DIR, "repo"));
    repo.update();
    System.err.println("Check repo");
    TestPreferencesInitializer.init();
    Core.setSegmenter(new Segmenter(SRX.getDefault()));
    checkRepo(startVersion);
    System.err.println("Processed successfully");
}
Also used : Segmenter(org.omegat.core.segmentation.Segmenter) File(java.io.File)

Example 3 with Segmenter

use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.

the class AutoTmxTest method setUp.

@Before
public final void setUp() throws Exception {
    TestPreferencesInitializer.init();
    Core.setSegmenter(new Segmenter(SRX.getDefault()));
}
Also used : Segmenter(org.omegat.core.segmentation.Segmenter) Before(org.junit.Before)

Example 4 with Segmenter

use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.

the class TmxSegmentationTest method setUp.

@Before
public final void setUp() throws Exception {
    TestPreferencesInitializer.init();
    Core.setSegmenter(new Segmenter(SRX.getDefault()));
}
Also used : Segmenter(org.omegat.core.segmentation.Segmenter) Before(org.junit.Before)

Example 5 with Segmenter

use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.

the class AlignerTest method setUp.

@Before
public final void setUp() {
    FilterMaster.setFilterClasses(Arrays.asList(TextFilter.class, ResourceBundleFilter.class));
    Core.setFilterMaster(new FilterMaster(FilterMaster.createDefaultFiltersConfig()));
    Core.setSegmenter(new Segmenter(SRX.getDefault()));
    assertTrue(Core.getFilterMaster().isFileSupported(new File("blah.txt"), true));
    assertTrue(Core.getFilterMaster().isFileSupported(new File("blah.properties"), true));
}
Also used : TextFilter(org.omegat.filters2.text.TextFilter) FilterMaster(org.omegat.filters2.master.FilterMaster) ResourceBundleFilter(org.omegat.filters2.text.bundles.ResourceBundleFilter) Segmenter(org.omegat.core.segmentation.Segmenter) File(java.io.File) Before(org.junit.Before)

Aggregations

Segmenter (org.omegat.core.segmentation.Segmenter)12 FilterMaster (org.omegat.filters2.master.FilterMaster)6 File (java.io.File)5 Before (org.junit.Before)5 IOException (java.io.IOException)4 SRX (org.omegat.core.segmentation.SRX)3 Language (org.omegat.util.Language)3 Filters (gen.core.filters.Filters)1 Color (java.awt.Color)1 Component (java.awt.Component)1 Cursor (java.awt.Cursor)1 Font (java.awt.Font)1 Rectangle (java.awt.Rectangle)1 Toolkit (java.awt.Toolkit)1 DataFlavor (java.awt.datatransfer.DataFlavor)1 Transferable (java.awt.datatransfer.Transferable)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ComponentAdapter (java.awt.event.ComponentAdapter)1