Program: 17581
Project: 17581
Buggy source:
/** 
 * Gets the selected item parses it, and adds the defined stuff to the editor
 */
protected void insertItem(){
  IEditorPart iep=this.getViewSite().getWorkbenchWindow().getActivePage().getActiveEditor();
  tmpAction.setActiveEditor(null,iep);
  File selectedfile=null;
  if (treeViewer.getSelection().isEmpty()) {
    return;
  }
 else {
    IStructuredSelection selection=(IStructuredSelection)treeViewer.getSelection();
    selectedfile=(File)selection.getFirstElement();
  }
  if (selectedfile.isDirectory())   return;
  String f=selectedfile.getAbsolutePath();
  snipReader.read(f);
  try {
    IFile activeFile=null;
    if (iep.getEditorInput() instanceof IFileEditorInput) {
      activeFile=((IFileEditorInput)iep.getEditorInput()).getFile();
    }
    String startBlock=SnipVarParser.parse(snipReader.getSnipStartBlock(),activeFile);
    String endBlock=SnipVarParser.parse(snipReader.getSnipEndBlock(),activeFile);
    while (startBlock.indexOf("String_Node_Str") > 0) {
      int expressionStart=startBlock.indexOf("String_Node_Str") + 3;
      int expressionEnd=startBlock.indexOf("String_Node_Str",expressionStart);
      String expression=startBlock.substring(expressionStart,expressionEnd);
      InputDialog replacementDialog=new InputDialog(this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + expression + "String_Node_Str","String_Node_Str",null);
      if (replacementDialog.open() == org.eclipse.jface.window.Window.OK) {
        String replacement=replacementDialog.getValue();
        String pattern="String_Node_Str" + expression + "String_Node_Str";
        startBlock=startBlock.replaceAll(pattern,replacement);
      }
    }
    while (endBlock.indexOf("String_Node_Str") > 0) {
      int expressionStart=endBlock.indexOf("String_Node_Str") + 3;
      int expressionEnd=endBlock.indexOf("String_Node_Str",expressionStart);
      String expression=endBlock.substring(expressionStart,expressionEnd);
      InputDialog replacementDialog=new InputDialog(this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + expression + "String_Node_Str","String_Node_Str",null);
      if (replacementDialog.open() == org.eclipse.jface.window.Window.OK) {
        String replacement=replacementDialog.getValue();
        String pattern="String_Node_Str" + expression + "String_Node_Str";
        endBlock=endBlock.replaceAll(pattern,replacement);
      }
    }
    tmpAction.setEnclosingStrings(startBlock,endBlock);
    tmpAction.run(null);
  }
 catch (  Exception e) {
    e.printStackTrace(System.err);
  }
}

Fixed version (ground truth):
/** 
 * Gets the selected item parses it, and adds the defined stuff to the editor
 */
protected void insertItem(){
  IEditorPart iep=this.getViewSite().getWorkbenchWindow().getActivePage().getActiveEditor();
  tmpAction.setActiveEditor(null,iep);
  File selectedfile=null;
  if (treeViewer.getSelection().isEmpty()) {
    return;
  }
 else {
    IStructuredSelection selection=(IStructuredSelection)treeViewer.getSelection();
    selectedfile=(File)selection.getFirstElement();
  }
  if (selectedfile.isDirectory())   return;
  String f=selectedfile.getAbsolutePath();
  snipReader.read(f);
  try {
    IFile activeFile=null;
    if (iep.getEditorInput() instanceof IFileEditorInput) {
      activeFile=((IFileEditorInput)iep.getEditorInput()).getFile();
    }
    String startBlock=SnipVarParser.parse(snipReader.getSnipStartBlock(),activeFile);
    String endBlock=SnipVarParser.parse(snipReader.getSnipEndBlock(),activeFile);
    while (startBlock.indexOf("String_Node_Str") > 0) {
      int expressionStart=startBlock.indexOf("String_Node_Str") + 3;
      int expressionEnd=startBlock.indexOf("String_Node_Str",expressionStart);
      String expression=startBlock.substring(expressionStart,expressionEnd);
      InputDialog replacementDialog=new InputDialog(this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + expression + "String_Node_Str","String_Node_Str",null);
      if (replacementDialog.open() == org.eclipse.jface.window.Window.OK) {
        String replacement=replacementDialog.getValue();
        String pattern="String_Node_Str" + expression + "String_Node_Str";
        startBlock=startBlock.replaceAll(pattern,replacement);
      }
 else {
        break;
      }
    }
    while (endBlock.indexOf("String_Node_Str") > 0) {
      int expressionStart=endBlock.indexOf("String_Node_Str") + 3;
      int expressionEnd=endBlock.indexOf("String_Node_Str",expressionStart);
      String expression=endBlock.substring(expressionStart,expressionEnd);
      InputDialog replacementDialog=new InputDialog(this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + expression + "String_Node_Str","String_Node_Str",null);
      if (replacementDialog.open() == org.eclipse.jface.window.Window.OK) {
        String replacement=replacementDialog.getValue();
        String pattern="String_Node_Str" + expression + "String_Node_Str";
        endBlock=endBlock.replaceAll(pattern,replacement);
      }
 else {
        break;
      }
    }
    tmpAction.setEnclosingStrings(startBlock,endBlock);
    tmpAction.run(null);
  }
 catch (  Exception e) {
    e.printStackTrace(System.err);
  }
}