Source:
public void setInput(ChangePreviewViewerInput input) { Change change= input.getChange(); if (change != null) { Object element= change.getModifiedElement(); if (element instanceof IAdaptable) { IAdaptable adaptable= (IAdaptable) element; IWorkbenchAdapter workbenchAdapter= adaptable.getAdapter(IWorkbenchAdapter.class); if (workbenchAdapter != null) { fPane.setImageDescriptor(workbenchAdapter.getImageDescriptor(element)); } else { fPane.setImageDescriptor(null); } } else { fPane.setImageDescriptor(null); } } if (!(change instanceof CreateTextFileChange)) { fSourceViewer.setInput(null); fPane.setText(""); return; } CreateTextFileChange textFileChange= (CreateTextFileChange) change; fPane.setText(textFileChange.getName()); IDocument document= new Document(textFileChange.getPreview()); fSourceViewer.unconfigure(); String textType= textFileChange.getTextType(); JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools(); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); if (null == textType) { fSourceViewer.configure(new SourceViewerConfiguration()); fSourceViewer.getTextWidget().setOrientation(fSourceViewer.getTextWidget().getParent().getOrientation()); } else switch (textType) { case "java": textTools.setupJavaDocumentPartitioner(document); fSourceViewer.configure(new JavaSourceViewerConfiguration(textTools.getColorManager(), store, null, null)); fSourceViewer.getTextWidget().setOrientation(SWT.LEFT_TO_RIGHT); break; case "properties": PropertiesFileDocumentSetupParticipant.setupDocument(document); fSourceViewer.configure(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, null, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING)); fSourceViewer.getTextWidget().setOrientation(SWT.LEFT_TO_RIGHT); break; default: fSourceViewer.configure(new SourceViewerConfiguration()); fSourceViewer.getTextWidget().setOrientation(fSourceViewer.getTextWidget().getParent().getOrientation()); break; } fSourceViewer.setInput(document); }

Target:
public void setInput(ChangePreviewViewerInput input) { Change change= input.getChange(); if (change != null) { Object element= change.getModifiedElement(); if (element instanceof IAdaptable) { IAdaptable adaptable= (IAdaptable) element; IWorkbenchAdapter workbenchAdapter= adaptable.getAdapter(IWorkbenchAdapter.class); if (workbenchAdapter != null) { fPane.setImageDescriptor(workbenchAdapter.getImageDescriptor(element)); } else { fPane.setImageDescriptor(null); } } else { fPane.setImageDescriptor(null); } } if (!(change instanceof CreateTextFileChange)) { fSourceViewer.setInput(null); fPane.setText(""); return; } CreateTextFileChange textFileChange= (CreateTextFileChange) change; fPane.setText(textFileChange.getName()); IDocument document= new Document(textFileChange.getPreview()); fSourceViewer.unconfigure(); String textType= textFileChange.getTextType(); JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools(); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); boolean nomatch= false; if (textType != null) switch (textType) { case "java": textTools.setupJavaDocumentPartitioner(document); fSourceViewer.configure(new JavaSourceViewerConfiguration(textTools.getColorManager(), store, null, null)); fSourceViewer.getTextWidget().setOrientation(SWT.LEFT_TO_RIGHT); break; case "properties": PropertiesFileDocumentSetupParticipant.setupDocument(document); fSourceViewer.configure(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, null, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING)); fSourceViewer.getTextWidget().setOrientation(SWT.LEFT_TO_RIGHT); break; default: nomatch= true; break; } if (nomatch) { fSourceViewer.configure(new SourceViewerConfiguration()); fSourceViewer.getTextWidget().setOrientation(fSourceViewer.getTextWidget().getParent().getOrientation()); } fSourceViewer.setInput(document); }