use of org.omegat.filters2.master.FilterMaster in project omegat by omegat-org.
the class Searcher method searchFiles.
private void searchFiles() throws IOException {
Path root = Paths.get(searchExpression.rootDir);
FilterMaster fm = Core.getFilterMaster();
final SearchCallback searchCallback = new SearchCallback(m_project.getProjectProperties());
int depth = searchExpression.recursive ? Integer.MAX_VALUE : 0;
Files.walk(root, depth, FileVisitOption.FOLLOW_LINKS).forEach(path -> {
String filename = path.toString();
FileInfo fi = new FileInfo();
// determine actual file name w/ no root path info
fi.filePath = root.relativize(path).toString();
searchCallback.setCurrentFile(fi);
try {
fm.loadFile(filename, new FilterContext(m_project.getProjectProperties()), searchCallback);
} catch (TranslationException | IOException ex) {
Log.log(ex);
}
searchCallback.fileFinished();
checkStop.checkInterrupted();
});
}
use of org.omegat.filters2.master.FilterMaster in project omegat by omegat-org.
the class AlignFilePickerController method getSupportedFiles.
private static List<File> getSupportedFiles(List<?> files) {
List<File> result = new ArrayList<File>(files.size());
FilterMaster fm = Core.getFilterMaster();
for (Object o : files) {
File file = (File) o;
if (fm.isFileSupported(file, true)) {
result.add(file);
}
}
return result;
}
use of org.omegat.filters2.master.FilterMaster in project omegat by omegat-org.
the class Core method initializeGUI.
/**
* Initialize application components.
*/
public static void initializeGUI(final Map<String, String> params) throws Exception {
cmdLineParams = params;
// 1. Initialize project
currentProject = new NotLoadedProject();
// 2. Initialize application frame
MainWindow me = new MainWindow();
mainWindow = me;
// Load recent used projects
RecentProjects.updateMenu();
Core.registerMarker(new ProtectedPartsMarker());
Core.registerMarker(new RemoveTagMarker());
Core.registerMarker(new NBSPMarker());
Core.registerMarker(new TransTipsMarker());
Core.registerMarker(new WhitespaceMarkerFactory.SpaceMarker());
Core.registerMarker(new WhitespaceMarkerFactory.TabMarker());
Core.registerMarker(new WhitespaceMarkerFactory.LFMarker());
Core.registerMarker(new BidiMarkerFactory.RLMMarker());
Core.registerMarker(new BidiMarkerFactory.LRMMarker());
Core.registerMarker(new BidiMarkerFactory.PDFMarker());
Core.registerMarker(new BidiMarkerFactory.LROMarker());
Core.registerMarker(new BidiMarkerFactory.RLOMarker());
Core.registerMarker(new ReplaceMarker());
Core.registerMarker(new ComesFromAutoTMMarker());
Core.registerMarker(new FontFallbackMarker());
LanguageToolWrapper.init();
segmenter = new Segmenter(Preferences.getSRX());
filterMaster = new FilterMaster(Preferences.getFilters());
// 3. Initialize other components. They add themselves to the main window.
editor = new EditorController(me);
tagValidation = new TagValidationTool();
issuesWindow = new IssuesPanelController(me);
matcher = new MatchesTextArea(me);
GlossaryTextArea glossaryArea = new GlossaryTextArea(me);
glossary = glossaryArea;
glossaryManager = new GlossaryManager(glossaryArea);
notes = new NotesTextArea(me);
comments = new CommentsTextArea(me);
machineTranslatePane = new MachineTranslateTextArea(me);
dictionaries = new DictionariesTextArea(me);
spellChecker = new SpellChecker();
multiple = new MultipleTransPane(me);
new SegmentPropertiesArea(me);
SaveThread th = new SaveThread();
saveThread = th;
th.start();
}
use of org.omegat.filters2.master.FilterMaster in project omegat by omegat-org.
the class ExternalTMFactoryTest method setUp.
@Before
public final void setUp() {
Core.setSegmenter(new Segmenter(SRX.getDefault()));
FilterMaster.setFilterClasses(Arrays.asList(PoFilter.class, MozillaLangFilter.class));
Core.setFilterMaster(new FilterMaster(FilterMaster.createDefaultFiltersConfig()));
ProjectProperties props = new ProjectProperties() {
public Language getSourceLanguage() {
return sourceLang;
}
public Language getTargetLanguage() {
return targetLang;
}
@Override
public boolean isSentenceSegmentingEnabled() {
return true;
}
};
Core.setProject(new NotLoadedProject() {
@Override
public ProjectProperties getProjectProperties() {
return props;
}
});
}
use of org.omegat.filters2.master.FilterMaster in project omegat by omegat-org.
the class TmxComplianceBase method setUp.
@Before
public final void setUp() throws Exception {
Core.setFilterMaster(new FilterMaster(FilterMaster.createDefaultFiltersConfig()));
Core.setSegmenter(new Segmenter(SRX.getDefault()));
TestPreferencesInitializer.init();
outFile = new File("build/testdata/" + getClass().getSimpleName() + "-" + name.getMethodName() + ".out");
outFile.getParentFile().mkdirs();
if (outFile.exists()) {
if (!outFile.delete()) {
throw new IOException("Can't remove " + outFile.getAbsolutePath());
}
}
}
Aggregations