Program: 120705
Project: 120705
Buggy source:
public void refresh(){
  if (selectedNode != null) {
    generatedCode="String_Node_Str";
    boolean isJoblet=AbstractProcessProvider.isExtensionProcessForJoblet(selectedNode.getProcess());
    if (!isJoblet && PluginChecker.isJobLetPluginLoaded()) {
      IJobletProviderService jobletSservice=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
      if (jobletSservice != null && jobletSservice.isJobletComponent(selectedNode)) {
        isJoblet=true;
      }
    }
    if (isJoblet) {
      document.set(generatedCode);
      return;
    }
    generatingNode=null;
    for (    INode node : selectedNode.getProcess().getGeneratingNodes()) {
      if (node.getUniqueName().equals(selectedNode.getUniqueName())) {
        generatingNode=node;
      }
    }
    if (generatingNode == null) {
      document.set(Messages.getString("String_Node_Str"));
      return;
    }
    if (codeGenerator == null) {
      ICodeGeneratorService service=DesignerPlugin.getDefault().getCodeGeneratorService();
      codeGenerator=service.createCodeGenerator();
    }
    viewStartAction.setChecked(false);
    viewMainAction.setChecked(false);
    viewEndAction.setChecked(false);
    viewAllAction.setChecked(false);
switch (codeView) {
case CODE_START:
      viewStartAction.setChecked(true);
    break;
case CODE_MAIN:
  viewMainAction.setChecked(true);
break;
case CODE_END:
viewEndAction.setChecked(true);
break;
case CODE_ALL:
viewAllAction.setChecked(true);
break;
default :
}
synchronized (this) {
Job job=new Job(Messages.getString("String_Node_Str")){
@Override protected IStatus run(IProgressMonitor monitor){
switch (codeView) {
case CODE_START:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.BEGIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
break;
case CODE_MAIN:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.MAIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
break;
case CODE_END:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.END);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
break;
case CODE_ALL:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.BEGIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
try {
generatedCode+=codeGenerator.generateComponentCode(generatingNode,ECodePart.MAIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
try {
generatedCode+=codeGenerator.generateComponentCode(generatingNode,ECodePart.END);
}
 catch (SystemException e) {
e.printStackTrace();
}
break;
default :
}
return org.eclipse.core.runtime.Status.OK_STATUS;
}
}
;
job.setPriority(Job.INTERACTIVE);
job.schedule();
job.addJobChangeListener(new JobChangeAdapter(){
@Override public void done(IJobChangeEvent event){
new UIJob("String_Node_Str"){
@Override public IStatus runInUIThread(IProgressMonitor monitor){
document.set(generatedCode);
return org.eclipse.core.runtime.Status.OK_STATUS;
}
}
.schedule();
}
}
);
}
}
}

Fixed version (ground truth):
public void refresh(){
  ICodeGeneratorService service=DesignerPlugin.getDefault().getCodeGeneratorService();
  if (((ICodeGeneratorService)service).isInitializeJet()) {
    return;
  }
  if (selectedNode != null) {
    generatedCode="String_Node_Str";
    boolean isJoblet=AbstractProcessProvider.isExtensionProcessForJoblet(selectedNode.getProcess());
    if (!isJoblet && PluginChecker.isJobLetPluginLoaded()) {
      IJobletProviderService jobletSservice=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
      if (jobletSservice != null && jobletSservice.isJobletComponent(selectedNode)) {
        isJoblet=true;
      }
    }
    if (isJoblet) {
      document.set(generatedCode);
      return;
    }
    generatingNode=null;
    for (    INode node : selectedNode.getProcess().getGeneratingNodes()) {
      if (node.getUniqueName().equals(selectedNode.getUniqueName())) {
        generatingNode=node;
      }
    }
    if (generatingNode == null) {
      document.set(Messages.getString("String_Node_Str"));
      return;
    }
    if (codeGenerator == null) {
      codeGenerator=service.createCodeGenerator();
    }
    viewStartAction.setChecked(false);
    viewMainAction.setChecked(false);
    viewEndAction.setChecked(false);
    viewAllAction.setChecked(false);
switch (codeView) {
case CODE_START:
      viewStartAction.setChecked(true);
    break;
case CODE_MAIN:
  viewMainAction.setChecked(true);
break;
case CODE_END:
viewEndAction.setChecked(true);
break;
case CODE_ALL:
viewAllAction.setChecked(true);
break;
default :
}
Job job=new Job(Messages.getString("String_Node_Str")){
@Override protected IStatus run(IProgressMonitor monitor){
switch (codeView) {
case CODE_START:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.BEGIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
break;
case CODE_MAIN:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.MAIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
break;
case CODE_END:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.END);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
break;
case CODE_ALL:
try {
generatedCode=codeGenerator.generateComponentCode(generatingNode,ECodePart.BEGIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
try {
generatedCode+=codeGenerator.generateComponentCode(generatingNode,ECodePart.MAIN);
}
 catch (SystemException e) {
ExceptionHandler.process(e);
}
try {
generatedCode+=codeGenerator.generateComponentCode(generatingNode,ECodePart.END);
}
 catch (SystemException e) {
e.printStackTrace();
}
break;
default :
}
return org.eclipse.core.runtime.Status.OK_STATUS;
}
}
;
job.setPriority(Job.INTERACTIVE);
job.schedule();
job.addJobChangeListener(new JobChangeAdapter(){
@Override public void done(IJobChangeEvent event){
new UIJob("String_Node_Str"){
@Override public IStatus runInUIThread(IProgressMonitor monitor){
document.set(generatedCode);
return org.eclipse.core.runtime.Status.OK_STATUS;
}
}
.schedule();
}
}
);
}
}