| 
| Editor Plugin problem when folding is enabled. (in M9) [message #250004] | Mon, 07 June 2004 03:16 |  | 
| Eclipse User  |  |  |  |  | Originally posted by: mravi.web.de 
 Hi,
 
 I have a editor plugin which is running into problems when folding is
 enabled. If I disable folding, its working fine.
 
 I'm trying to capture the keystore ARROW_DOWN to go to next line.
 
 The code is as follows.
 
 public int goToLine (int linenum) { /* I call this with linenum
 (presentline no + 1) */
 try {
 // see that the line is in the document and get the line
 IRegion line = thisdocument.getLineInformation(linenum);
 
 int cursorPosition = getSelection().getOffset() -
 getLine().getOffset();
 if (line.getLength() < cursorPosition) {
 cursorPosition = line.getLength();
 }
 mySelection = new TextSelection( myDocument,
 cursorPosition , 0);
 if ( myTextViewer != null) {
 
 myTextViewer.getTextWidget().setCaretOffset(cursorPosition );
 myTextViewer.getTextWidget().showSelection();
 }
 return getSelection().getOffset();
 }
 }
 catch (LocationException e) {
 return -1;
 }
 }
 
 This code works fine when there are no hidden lines. But with folding,
 not all the lines are visible. As a result, the cursor movement goes
 haywire.
 
 Any clues on how this has to be handled?
 
 Rgds,
 Ravi.
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.04214 seconds