return text;
}
private SourceViewer createEditor(Composite parent) {
SourceViewer viewer= new SourceViewer(parent, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
IDocument document= new Document(fTemplate.getPattern());
new PerlPartitioner(PerlEditorPlugin.getDefault().getLog(), document);
viewer.configure(new SimpleJavaSourceViewerConfiguration(fProcessor));
viewer.setEditable(true);
viewer.setDocument(document);
Font font= JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
viewer.getTextWidget().setFont(font);
Control control= viewer.getControl();
GridData data= new GridData(GridData.FILL_BOTH);
data.widthHint= convertWidthInCharsToPixels(60);
data.heightHint= convertHeightInCharsToPixels(5);
control.setLayoutData(data);
viewer.addTextListener(new ITextListener() {
public void textChanged(TextEvent event) {
try {
fTranslator.translate(event.getDocumentEvent().getDocument().get());
} catch (CoreException e) {
e.printStackTrace();
//PHPeclipsePlugin.log(e);
}
updateUndoAction();
updateButtons();
}
});
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
updateSelectionDependentActions();
}
});
if (viewer instanceof ITextViewerExtension) {
((ITextViewerExtension) viewer).prependVerifyKeyListener(new VerifyKeyListener() {
public void verifyKey(VerifyEvent event) {
handleVerifyKeyPressed(event);
}
});
} else {
viewer.getTextWidget().addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
handleKeyPressed(e);
}
public void keyReleased(KeyEvent e) {}