Program: 96400
Project: 96400
Buggy source:
@Override protected ISourceViewer createSourceViewer(Composite parent,IVerticalRuler ruler,int styles){
  sourceViewerConfiguration.initializeDefaultFonts();
  tabFolder=new CTabFolder(parent,SWT.BOTTOM);
{
    sourceTab=new CTabItem(tabFolder,SWT.NONE);
    updateSourceTabLabel();
    viewer=new MarkupProjectionViewer(tabFolder,ruler,getOverviewRuler(),isOverviewRulerVisible(),styles | SWT.WRAP);
    sourceTab.setControl(((Viewer)viewer).getControl());
  }
  try {
    previewTab=new CTabItem(tabFolder,SWT.NONE);
    previewTab.setText(Messages.MarkupEditor_preview);
    previewTab.setToolTipText(Messages.MarkupEditor_preview_tooltip);
    browser=new Browser(tabFolder,SWT.NONE);
    browser.addLocationListener(new LocationListener(){
      public void changed(      LocationEvent event){
        event.doit=false;
      }
      private boolean tryToOpenAsWorkspaceFile(      String location){
        if (getEditorInput() instanceof IURIEditorInput) {
          try {
            IURIEditorInput uriInput=(IURIEditorInput)getEditorInput();
            URI locationURI=uriInput.getURI().resolve(location);
            if (locationURI != null) {
              IFile[] files=ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(locationURI);
              if (files.length > 0) {
                IEditorPart editor=IDE.openEditor(getEditorSite().getPage(),files[0]);
                if (editor instanceof MarkupEditor) {
                  MarkupEditor markupEditor=(MarkupEditor)editor;
                  markupEditor.showPreview(null);
                }
                return true;
              }
            }
          }
 catch (          Exception e) {
            logErrorOpeningAsWorkspaceFile(e);
          }
        }
        return false;
      }
      public void changing(      LocationEvent event){
        if (event.location.matches("String_Node_Str")) {
          int idxOfSlashHash=event.location.indexOf("String_Node_Str");
          if (idxOfSlashHash != -1) {
            if (!event.location.startsWith("String_Node_Str")) {
              event.doit=false;
            }
            return;
          }
          event.doit=false;
          if (tryToOpenAsWorkspaceFile(event.location)) {
            return;
          }
          try {
            PlatformUI.getWorkbench().getBrowserSupport().createBrowser("String_Node_Str").openURL(new URL(event.location));
          }
 catch (          Exception e) {
            new URLHyperlink(new Region(0,1),event.location).open();
          }
        }
 else {
          tryToOpenAsWorkspaceFile(event.location);
        }
      }
    }
);
    previewTab.setControl(browser);
  }
 catch (  SWTError e) {
    if (previewTab != null) {
      previewTab.dispose();
      previewTab=null;
    }
    logPreviewTabUnavailable(e);
  }
  IEditorInput ei=getEditorInput();
  if (previewTab != null && ei instanceof IURIEditorInput) {
    String previewFileNamePattern=WikiTextUiPlugin.getDefault().getPreferences().getPreviewFileNamePattern();
    IURIEditorInput editorInput=(IURIEditorInput)ei;
    File file=new File(editorInput.getURI());
    if (previewFileNamePattern != null && file.getName().matches(previewFileNamePattern)) {
      tabFolder.setSelection(previewTab);
    }
 else {
      tabFolder.setSelection(sourceTab);
    }
  }
 else {
    tabFolder.setSelection(sourceTab);
  }
  tabFolder.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent selectionevent){
      widgetSelected(selectionevent);
    }
    public void widgetSelected(    SelectionEvent selectionevent){
      if (isShowingPreview()) {
        updatePreview();
      }
    }
  }
);
  viewer.getTextWidget().addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      updateOutlineSelection();
    }
  }
);
  viewer.getTextWidget().addKeyListener(new KeyAdapter(){
    @Override public void keyReleased(    KeyEvent e){
      if (isRelevantKeyCode(e.keyCode)) {
        updateOutlineSelection();
      }
    }
    private boolean isRelevantKeyCode(    int keyCode){
switch (keyCode) {
case SWT.ARROW_DOWN:
case SWT.ARROW_LEFT:
case SWT.ARROW_RIGHT:
case SWT.ARROW_UP:
case SWT.PAGE_DOWN:
case SWT.PAGE_UP:
        return true;
    }
    return false;
  }
}
);
viewer.getTextWidget().addMouseListener(new MouseAdapter(){
  @Override public void mouseUp(  MouseEvent e){
    updateOutlineSelection();
  }
}
);
IFocusService focusService=PlatformUI.getWorkbench().getService(IFocusService.class);
if (focusService != null) {
  focusService.addFocusTracker(viewer.getTextWidget(),MarkupEditor.EDITOR_SOURCE_VIEWER);
}
viewer.getTextWidget().setData(MarkupLanguage.class.getName(),getMarkupLanguage());
viewer.getTextWidget().setData(ISourceViewer.class.getName(),viewer);
getSourceViewerDecorationSupport(viewer);
updateDocument();
if (preferencesListener == null) {
  preferencesListener=new IPropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent event){
      if (viewer.getTextWidget() == null || viewer.getTextWidget().isDisposed()) {
        return;
      }
      if (isFontPreferenceChange(event)) {
        viewer.getTextWidget().getDisplay().asyncExec(new Runnable(){
          public void run(){
            reloadPreferences();
          }
        }
);
      }
    }
  }
;
  WikiTextUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(preferencesListener);
}
if (isShowingPreview()) {
  updatePreview();
}
return viewer;
}

Fixed version (ground truth):
@Override protected ISourceViewer createSourceViewer(Composite parent,IVerticalRuler ruler,int styles){
  sourceViewerConfiguration.initializeDefaultFonts();
  tabFolder=new CTabFolder(parent,SWT.BOTTOM);
{
    sourceTab=new CTabItem(tabFolder,SWT.NONE);
    updateSourceTabLabel();
    viewer=new MarkupProjectionViewer(tabFolder,ruler,getOverviewRuler(),isOverviewRulerVisible(),styles | SWT.WRAP);
    sourceTab.setControl(((Viewer)viewer).getControl());
  }
  try {
    previewTab=new CTabItem(tabFolder,SWT.NONE);
    previewTab.setText(Messages.MarkupEditor_preview);
    previewTab.setToolTipText(Messages.MarkupEditor_preview_tooltip);
    browser=new Browser(tabFolder,SWT.NONE);
    browser.addLocationListener(new LocationListener(){
      public void changed(      LocationEvent event){
        event.doit=false;
      }
      private boolean tryToOpenAsWorkspaceFile(      String location){
        if (getEditorInput() instanceof IURIEditorInput) {
          try {
            IURIEditorInput uriInput=(IURIEditorInput)getEditorInput();
            URI locationURI=uriInput.getURI().resolve(location);
            if (locationURI != null && "String_Node_Str".equals(locationURI.getScheme())) {
              IFile[] files=ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(locationURI);
              if (files.length > 0) {
                IEditorPart editor=IDE.openEditor(getEditorSite().getPage(),files[0]);
                if (editor instanceof MarkupEditor) {
                  MarkupEditor markupEditor=(MarkupEditor)editor;
                  markupEditor.showPreview(null);
                }
                return true;
              }
            }
          }
 catch (          Exception e) {
            logErrorOpeningAsWorkspaceFile(e);
          }
        }
        return false;
      }
      public void changing(      LocationEvent event){
        if (event.location.matches("String_Node_Str")) {
          int idxOfSlashHash=event.location.indexOf("String_Node_Str");
          if (idxOfSlashHash != -1) {
            if (!event.location.startsWith("String_Node_Str")) {
              event.doit=false;
            }
            return;
          }
          event.doit=false;
          if (tryToOpenAsWorkspaceFile(event.location)) {
            return;
          }
          try {
            PlatformUI.getWorkbench().getBrowserSupport().createBrowser("String_Node_Str").openURL(new URL(event.location));
          }
 catch (          Exception e) {
            new URLHyperlink(new Region(0,1),event.location).open();
          }
        }
 else {
          tryToOpenAsWorkspaceFile(event.location);
        }
      }
    }
);
    previewTab.setControl(browser);
  }
 catch (  SWTError e) {
    if (previewTab != null) {
      previewTab.dispose();
      previewTab=null;
    }
    logPreviewTabUnavailable(e);
  }
  IEditorInput ei=getEditorInput();
  if (previewTab != null && ei instanceof IURIEditorInput) {
    String previewFileNamePattern=WikiTextUiPlugin.getDefault().getPreferences().getPreviewFileNamePattern();
    IURIEditorInput editorInput=(IURIEditorInput)ei;
    File file=new File(editorInput.getURI());
    if (previewFileNamePattern != null && file.getName().matches(previewFileNamePattern)) {
      tabFolder.setSelection(previewTab);
    }
 else {
      tabFolder.setSelection(sourceTab);
    }
  }
 else {
    tabFolder.setSelection(sourceTab);
  }
  tabFolder.addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent selectionevent){
      widgetSelected(selectionevent);
    }
    public void widgetSelected(    SelectionEvent selectionevent){
      if (isShowingPreview()) {
        updatePreview();
      }
    }
  }
);
  viewer.getTextWidget().addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      updateOutlineSelection();
    }
  }
);
  viewer.getTextWidget().addKeyListener(new KeyAdapter(){
    @Override public void keyReleased(    KeyEvent e){
      if (isRelevantKeyCode(e.keyCode)) {
        updateOutlineSelection();
      }
    }
    private boolean isRelevantKeyCode(    int keyCode){
switch (keyCode) {
case SWT.ARROW_DOWN:
case SWT.ARROW_LEFT:
case SWT.ARROW_RIGHT:
case SWT.ARROW_UP:
case SWT.PAGE_DOWN:
case SWT.PAGE_UP:
        return true;
    }
    return false;
  }
}
);
viewer.getTextWidget().addMouseListener(new MouseAdapter(){
  @Override public void mouseUp(  MouseEvent e){
    updateOutlineSelection();
  }
}
);
IFocusService focusService=PlatformUI.getWorkbench().getService(IFocusService.class);
if (focusService != null) {
  focusService.addFocusTracker(viewer.getTextWidget(),MarkupEditor.EDITOR_SOURCE_VIEWER);
}
viewer.getTextWidget().setData(MarkupLanguage.class.getName(),getMarkupLanguage());
viewer.getTextWidget().setData(ISourceViewer.class.getName(),viewer);
getSourceViewerDecorationSupport(viewer);
updateDocument();
if (preferencesListener == null) {
  preferencesListener=new IPropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent event){
      if (viewer.getTextWidget() == null || viewer.getTextWidget().isDisposed()) {
        return;
      }
      if (isFontPreferenceChange(event)) {
        viewer.getTextWidget().getDisplay().asyncExec(new Runnable(){
          public void run(){
            reloadPreferences();
          }
        }
);
      }
    }
  }
;
  WikiTextUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(preferencesListener);
}
if (isShowingPreview()) {
  updatePreview();
}
return viewer;
}