use of org.omegat.gui.editor.mark.EntryMarks in project omegat by omegat-org.
the class EditorController method markActiveEntrySource.
/**
* {@inheritDoc}
*/
public void markActiveEntrySource(final SourceTextEntry requiredActiveEntry, final List<Mark> marks, final String markerClassName) {
UIThreadsUtil.mustBeSwingThread();
for (Mark m : marks) {
if (m.entryPart != Mark.ENTRY_PART.SOURCE) {
throw new RuntimeException("Mark must be for source only");
}
}
SourceTextEntry realActive = m_docSegList[displayedEntryIndex].ste;
if (realActive != requiredActiveEntry) {
return;
}
int mi = markerController.getMarkerIndex(markerClassName);
EntryMarks ev = new EntryMarks(m_docSegList[displayedEntryIndex], m_docSegList[displayedEntryIndex].getDisplayVersion(), mi);
ev.result = marks;
markerController.queueMarksOutput(ev);
}
use of org.omegat.gui.editor.mark.EntryMarks in project omegat by omegat-org.
the class MarkerController method reprocessImmediately.
/**
* Reprocess one entry immediately, in current thread. Usually used for
* active entry.
*/
public void reprocessImmediately(SegmentBuilder entryBuilder) {
UIThreadsUtil.mustBeSwingThread();
entryBuilder.resetTextAttributes();
List<EntryMarks> evs = new ArrayList<EntryMarks>();
for (int i = 0; i < markerNames.length; i++) {
remove(entryBuilder, i);
try {
EntryMarks ev = new EntryMarks(entryBuilder, entryBuilder.getDisplayVersion(), i);
ev.result = markerThreads[i].marker.getMarksForEntry(ev.ste, ev.sourceText, ev.translationText, ev.isActive);
if (ev.result != null) {
evs.add(ev);
}
} catch (Throwable ex) {
Log.log(ex);
}
}
marksOutput(evs);
}
use of org.omegat.gui.editor.mark.EntryMarks in project omegat by omegat-org.
the class MarkerController method marksOutput.
/**
* Output marks.
*/
private void marksOutput(List<EntryMarks> evs) {
UIThreadsUtil.mustBeSwingThread();
if (evs.isEmpty()) {
return;
}
Document3 doc = ec.editor.getOmDocument();
doc.trustedChangesInProgress = true;
try {
for (int i = 0; i < evs.size(); i++) {
EntryMarks ev = evs.get(i);
if (!ev.isSegmentChanged()) {
remove(ev.builder, ev.markerIndex);
try {
if (ev.builder.marks == null) {
ev.builder.marks = new MarkInfo[markerNames.length][];
}
ev.builder.marks[ev.markerIndex] = new MarkInfo[ev.result.size()];
for (int j = 0; j < ev.result.size(); j++) {
MarkInfo nm = new MarkInfo(ev.result.get(j), ev.builder, doc, highlighter);
ev.builder.marks[ev.markerIndex][j] = nm;
}
} catch (BadLocationException ex) {
}
}
}
} finally {
doc.trustedChangesInProgress = false;
}
}
Aggregations