Lines 272-277
Link Here
|
272 |
CompilationUnitEditorAdapter editor= (CompilationUnitEditorAdapter)fEditor.get(sourceViewer); |
272 |
CompilationUnitEditorAdapter editor= (CompilationUnitEditorAdapter)fEditor.get(sourceViewer); |
273 |
try { |
273 |
try { |
274 |
editor.init((IEditorSite)editor.getSite(), editorInput); |
274 |
editor.init((IEditorSite)editor.getSite(), editorInput); |
|
|
275 |
editor.createPartControl(sourceViewer); |
275 |
editor.createActions(); |
276 |
editor.createActions(); |
276 |
configuration= new JavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, editor, getDocumentPartitioning()); |
277 |
configuration= new JavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, editor, getDocumentPartitioning()); |
277 |
} catch (PartInitException e) { |
278 |
} catch (PartInitException e) { |
Lines 468-477
Link Here
|
468 |
protected ISourceViewer createSourceViewer(Composite parent, int textOrientation) { |
469 |
protected ISourceViewer createSourceViewer(Composite parent, int textOrientation) { |
469 |
ISourceViewer sourceViewer; |
470 |
ISourceViewer sourceViewer; |
470 |
if (getSite() != null) { |
471 |
if (getSite() != null) { |
471 |
CompilationUnitEditorAdapter editor= new CompilationUnitEditorAdapter(textOrientation); |
472 |
CompilationUnitEditorAdapter editor= new CompilationUnitEditorAdapter(); |
472 |
editor.createPartControl(parent); |
473 |
sourceViewer = editor.createJavaSourceViewer(parent, textOrientation); |
473 |
|
|
|
474 |
sourceViewer= editor.getViewer(); |
475 |
|
474 |
|
476 |
if (fEditor == null) |
475 |
if (fEditor == null) |
477 |
fEditor= new HashMap(3); |
476 |
fEditor= new HashMap(3); |
Lines 520-534
Link Here
|
520 |
|
519 |
|
521 |
private class CompilationUnitEditorAdapter extends CompilationUnitEditor { |
520 |
private class CompilationUnitEditorAdapter extends CompilationUnitEditor { |
522 |
private boolean fInputSet = false; |
521 |
private boolean fInputSet = false; |
523 |
private int fTextOrientation; |
|
|
524 |
private boolean fEditable; |
522 |
private boolean fEditable; |
525 |
|
523 |
|
526 |
CompilationUnitEditorAdapter(int textOrientation) { |
|
|
527 |
super(); |
528 |
fTextOrientation = textOrientation; |
529 |
// TODO: has to be set here |
530 |
setPreferenceStore(createChainedPreferenceStore(null)); |
531 |
} |
532 |
private void setEditable(boolean editable) { |
524 |
private void setEditable(boolean editable) { |
533 |
fEditable= editable; |
525 |
fEditable= editable; |
534 |
} |
526 |
} |
Lines 546-556
Link Here
|
546 |
} |
538 |
} |
547 |
// else do nothing, we will create actions later, when input is available |
539 |
// else do nothing, we will create actions later, when input is available |
548 |
} |
540 |
} |
549 |
public void createPartControl(Composite composite) { |
541 |
/** |
550 |
SourceViewer sourceViewer= createJavaSourceViewer(composite, new CompositeRuler(), null, false, fTextOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null)); |
542 |
* Tries to mimic what takes place in |
|
|
543 |
* <code>AbstractTextEditor#createPartControl(Composite)</code>. Instead of creating an |
544 |
* editor part it sets previously created source viewer and configures it. |
545 |
* |
546 |
* @param sourceViewer the source viewer to set |
547 |
* @see org.eclipse.ui.texteditor.AbstractTextEditor#createPartControl(Composite) |
548 |
* @see #createJavaSourceViewer(Composite, int) |
549 |
*/ |
550 |
public void createPartControl(SourceViewer sourceViewer) { |
551 |
setSourceViewer(this, sourceViewer); |
551 |
setSourceViewer(this, sourceViewer); |
|
|
552 |
getSourceViewer().configure(getSourceViewerConfiguration()); |
552 |
getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener()); |
553 |
getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener()); |
553 |
} |
554 |
} |
|
|
555 |
protected ISourceViewer createJavaSourceViewer(Composite parent, int textOrientation) { |
556 |
return createJavaSourceViewer(parent, new CompositeRuler(), null, false, textOrientation | SWT.H_SCROLL | SWT.V_SCROLL, createChainedPreferenceStore(null)); |
557 |
} |
554 |
protected void doSetInput(IEditorInput input) throws CoreException { |
558 |
protected void doSetInput(IEditorInput input) throws CoreException { |
555 |
super.doSetInput(input); |
559 |
super.doSetInput(input); |
556 |
// the editor input has been explicitly set |
560 |
// the editor input has been explicitly set |