1.在编辑器里显示行号:
CompositeRuler ruler
=
new
CompositeRuler();
SourceViewer sv = new SourceViewer(composite,ruler,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
SourceViewer sv = new SourceViewer(composite,ruler,SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
LineNumberRulerColumn lineCol
=
new
LineNumberRulerColumn();
ruler.addDecorator( 0 , lineCol);
Document doc = new Document(“第一行/n第二行/n第三行/n”);
sv.setDocument(doc);
ruler.addDecorator( 0 , lineCol);
Document doc = new Document(“第一行/n第二行/n第三行/n”);
sv.setDocument(doc);
2.打开编辑器:
IEditorInput editorInput
=
null
;
String editorID = null ;
editorInput = mapEditorInput;
editorID = " test.editors.MapEditor " ;
if (editorInput == null || editorID == null )
return ;
IWorkbenchPage workbenchPage = getViewSite().getPage();
IEditorPart editor = workbenchPage.findEditor(editorInput);
try {
workbenchPage.openEditor(editorInput, editorID);
} catch (PartInitException e2){
e2.printStackTrace();
}
String editorID = null ;
editorInput = mapEditorInput;
editorID = " test.editors.MapEditor " ;
if (editorInput == null || editorID == null )
return ;
IWorkbenchPage workbenchPage = getViewSite().getPage();
IEditorPart editor = workbenchPage.findEditor(editorInput);
try {
workbenchPage.openEditor(editorInput, editorID);
} catch (PartInitException e2){
e2.printStackTrace();
}