Advertisement
KosIvantsov

insert_source_no_tags.groovy

Jun 26th, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.64 KB | None | 0 0
  1. /*
  2.  * #Purpose: Insert tag-free source into current target
  3.  * #Details: http: // wp.me/p3fHEs-4W
  4.  *
  5.  * @author   Kos Ivantsov
  6.  * @date     2013-06-26
  7.  * @version  0.1
  8.  */
  9.  
  10. import static javax.swing.JOptionPane.*
  11. import static org.omegat.util.Platform.*
  12.  
  13. // abort if a project is not opened yet
  14. def prop = project.projectProperties
  15. if (!prop) {
  16.   final def title = 'Insert source (no tags)'
  17.   final def msg   = 'Please try again after you open a project.'
  18.   showMessageDialog null, msg, title, INFORMATION_MESSAGE
  19.   return
  20. }
  21.  
  22. def stext = editor.currentEntry.getSrcText().replaceAll(/<\/?[a-z]+[0-9]* ?\/?>/, '')
  23. editor.insertText(stext)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement