Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Compositeruler and Sourceviewerconfiguration(Sourceviewerconfiguration failed)
icon5.gif  Compositeruler and Sourceviewerconfiguration [message #1001734] Thu, 17 January 2013 09:52
wijanarto wijanarto is currently offline wijanarto wijanartoFriend
Messages: 1
Registered: January 2013
Junior Member
Hi All,
i have strange code here (from net),

private IVerticalRuler createVerticalRuler() {
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
lineCol.setBackground(c.getDisplay().getSystemColor( SWT.COLOR_GRAY ) );
lineCol.setForeground(c.getDisplay().getSystemColor( SWT.COLOR_BLUE ) );
ruler.addDecorator(0, lineCol );
return ruler;
}

public SourceViewer insertViewer(Composite c) {
//1
viewer.add(te.getSelectionIndex(),
new SourceViewer(c,createVerticalRuler(),
SWT.BORDER|SWT.V_SCROLL | SWT.H_SCROLL));

//2
viewer.get(te.getSelectionIndex()).configure(
new NCEditorSourceViewerConfiguration());

viewer.get(te.getSelectionIndex()).setDocument(NCEditor.getApp().getDocument());
viewer.get(te.getSelectionIndex()).getTextWidget().setFocus();
buildControls(viewer.get(te.getSelectionIndex()));
return viewer.get(te.getSelectionIndex());
}


note : te : CTabFolder
My Question is :
a. when i configure and set the document (2 on above code), my application wont run
correctly but when delete line //2, everything running well, except no syntax
coloring
b. when i change line //1 with code below, and line //2 stay like before
viewer.add(te.getSelectionIndex(),new SourceViewer(c, new
VerticalRuler(30),SWT.BORDER|SWT.V_SCROLL | SWT.H_SCROLL));
my application run corrrectly, except no line number
c. How to add Line Number based on my code above ??
Please help ...!!!
Previous Topic:ICelleditor: show error and do not allow to loose focus until valid data is inserted
Next Topic:TreeViewer Databinding issues
Goto Forum:
  


Current Time: Fri Nov 21 12:28:10 GMT 2014

Powered by FUDForum. Page generated in 0.03396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software