/** inserts the source text of a segment at cursor position */
  public void editInsertSourceMenuItemActionPerformed() {
    if (!Core.getProject().isProjectLoaded()) return;

    String toInsert = Core.getEditor().getCurrentEntry().getSrcText();
    if (Preferences.isPreference(Preferences.GLOSSARY_REPLACE_ON_INSERT)) {
      toInsert = EditorUtils.replaceGlossaryEntries(toInsert);
    }
    Core.getEditor().insertText(toInsert);
  }
示例#2
0
 private String getTrimmedSelectedTextInMainWindow() {
   String selection = null;
   Component component = mainWindow.getMostRecentFocusOwner();
   if (component instanceof JTextComponent) {
     selection = ((JTextComponent) component).getSelectedText();
     if (!StringUtil.isEmpty(selection)) {
       selection = EditorUtils.removeDirectionChars(selection);
       selection = selection.trim();
     }
   }
   return selection;
 }