[jVi-cvs] nbvi/src/org/netbeans/modules/jvi NbBuffer.java, 1.4, 1.5 NbTextView.java, 1.23, 1.24 NbF
Brought to you by:
err
From: Ernie R. <er...@us...> - 2007-04-23 06:48:15
|
Update of /cvsroot/jvi/nbvi/src/org/netbeans/modules/jvi In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1449/nbvi/src/org/netbeans/modules/jvi Modified Files: NbBuffer.java NbTextView.java NbFactory.java Module.java Log Message: - Allow cursor movement during insert mode. - Implement kludge/hack so that multiple editors into the same file works with visual select and highlight search. Problems because closing an editor might strand a highlight layer. Eventually the highlight layers need to be associated with Buffer, not TextView. Index: NbBuffer.java =================================================================== RCS file: /cvsroot/jvi/nbvi/src/org/netbeans/modules/jvi/NbBuffer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NbBuffer.java 3 Apr 2007 20:46:07 -0000 1.4 --- NbBuffer.java 23 Apr 2007 06:48:01 -0000 1.5 *************** *** 13,16 **** --- 13,17 ---- import com.raelity.jvi.ViTextView; import java.util.List; + import javax.swing.text.Document; import org.netbeans.api.editor.mimelookup.MimeLookup; import org.netbeans.editor.Settings; *************** *** 28,32 **** /** Creates a new instance of NbBuffer */ ! public NbBuffer() { } --- 29,34 ---- /** Creates a new instance of NbBuffer */ ! public NbBuffer(Document doc) { ! super(doc); } Index: NbTextView.java =================================================================== RCS file: /cvsroot/jvi/nbvi/src/org/netbeans/modules/jvi/NbTextView.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** NbTextView.java 21 Apr 2007 02:46:17 -0000 1.23 --- NbTextView.java 23 Apr 2007 06:48:01 -0000 1.24 *************** *** 72,77 **** } ! public void startup() { ! super.startup(); // NEEDSWORK: the layer stuff should be in Buffer --- 72,77 ---- } ! public void startup(Buffer buf) { ! super.startup(buf); // NEEDSWORK: the layer stuff should be in Buffer *************** *** 89,93 **** dl = (HighlightBlocksLayer) doc.findLayer(VISUAL_SELECT_LAYER); if(dl == null) { ! dl = new VisualSelectLayer(); doc.addLayer(dl, VI_VISUAL_SELECT_LAYER_VISIBILITY); } --- 89,93 ---- dl = (HighlightBlocksLayer) doc.findLayer(VISUAL_SELECT_LAYER); if(dl == null) { ! dl = new VisualSelectLayer(buf); doc.addLayer(dl, VI_VISUAL_SELECT_LAYER_VISIBILITY); } *************** *** 96,100 **** dl = (HighlightBlocksLayer) doc.findLayer(HIGHLIGHT_SEARCH_LAYER); if(dl == null) { ! dl = new HighlightSearchLayer(); doc.addLayer(dl, VI_HIGHLIGHT_SEARCH_LAYER_VISIBILITY); } --- 96,100 ---- dl = (HighlightBlocksLayer) doc.findLayer(HIGHLIGHT_SEARCH_LAYER); if(dl == null) { ! dl = new HighlightSearchLayer(buf); doc.addLayer(dl, VI_HIGHLIGHT_SEARCH_LAYER_VISIBILITY); } *************** *** 105,110 **** public void shutdown() { Buffer buf = ViManager.getBuffer(getEditorComponent()); ! if(buf.getShare() == 1 ! && editorPane.getDocument() instanceof BaseDocument) { BaseDocument doc = (BaseDocument) editorPane.getDocument(); --- 105,114 ---- public void shutdown() { Buffer buf = ViManager.getBuffer(getEditorComponent()); ! if(editorPane.getDocument() instanceof BaseDocument) { ! // this alternate text view is a real kludge ! // NEEDSWORK: move draw layer stuff to buffer ! // Note: returned tv may be null, if this is last tv with buf ! NbTextView tv ! = (NbTextView) ViManager.getAlternateTextView(this, buf); BaseDocument doc = (BaseDocument) editorPane.getDocument(); *************** *** 115,123 **** dl = (HighlightBlocksLayer) doc.findLayer(VISUAL_SELECT_LAYER); if(dl != null) ! dl.setTextView(null); dl = (HighlightBlocksLayer) doc.findLayer(HIGHLIGHT_SEARCH_LAYER); if(dl != null) ! dl.setTextView(null); } super.shutdown(); --- 119,127 ---- dl = (HighlightBlocksLayer) doc.findLayer(VISUAL_SELECT_LAYER); if(dl != null) ! dl.setTextView(tv); dl = (HighlightBlocksLayer) doc.findLayer(HIGHLIGHT_SEARCH_LAYER); if(dl != null) ! dl.setTextView(tv); } super.shutdown(); *************** *** 464,469 **** private Coloring selectColoring; ! VisualSelectLayer() { ! super(VISUAL_SELECT_LAYER); selectColorOption = (ColorOption)Options.getOption(Options.selectColor); --- 468,473 ---- private Coloring selectColoring; ! VisualSelectLayer(Buffer buf) { ! super(VISUAL_SELECT_LAYER, buf); selectColorOption = (ColorOption)Options.getOption(Options.selectColor); *************** *** 531,536 **** // private Coloring selectColoring; ! HighlightSearchLayer() { ! super(HIGHLIGHT_SEARCH_LAYER); /* selectColorOption = (ColorOption) --- 535,540 ---- // private Coloring selectColoring; ! HighlightSearchLayer(Buffer buf) { ! super(HIGHLIGHT_SEARCH_LAYER, buf); /* selectColorOption = (ColorOption) *************** *** 612,615 **** --- 616,620 ---- protected NbTextView tv; + protected Buffer buf; /** Pairs of start and end position */ *************** *** 635,640 **** private boolean enabled; ! protected HighlightBlocksLayer(String layerName) { super(layerName); } --- 640,646 ---- private boolean enabled; ! protected HighlightBlocksLayer(String layerName, Buffer buf) { super(layerName); + this.buf = buf; } *************** *** 645,648 **** --- 651,656 ---- private void setTextView(NbTextView tv) { this.tv = tv; + if(tv == null) + buf = null; setEnabled(false); } Index: Module.java =================================================================== RCS file: /cvsroot/jvi/nbvi/src/org/netbeans/modules/jvi/Module.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Module.java 21 Apr 2007 02:46:17 -0000 1.32 --- Module.java 23 Apr 2007 06:48:01 -0000 1.33 *************** *** 376,384 **** } }); - ColonCommands.register("jviDump", "jviDump", new ActionListener() { - public void actionPerformed(ActionEvent e) { - ViManager.dump(System.err); - } - }); ColonCommands.register("optionsDump", "optionsDump", new ActionListener() { public void actionPerformed(ActionEvent e) { --- 376,379 ---- Index: NbFactory.java =================================================================== RCS file: /cvsroot/jvi/nbvi/src/org/netbeans/modules/jvi/NbFactory.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NbFactory.java 21 Apr 2007 02:46:17 -0000 1.19 --- NbFactory.java 23 Apr 2007 06:48:01 -0000 1.20 *************** *** 91,95 **** protected Buffer createBuffer(JEditorPane editorPane) { ! return new NbBuffer(); } --- 91,95 ---- protected Buffer createBuffer(JEditorPane editorPane) { ! return new NbBuffer(editorPane.getDocument()); } *************** *** 129,135 **** if(o instanceof TopComponent) return ((TopComponent)o).getDisplayName(); return ""; } ! /** Find a TopComponent that has been activated as an editor */ public static TopComponent getEditorTopComponent(JEditorPane editorPane) { --- 129,140 ---- if(o instanceof TopComponent) return ((TopComponent)o).getDisplayName(); + if(o instanceof Document) { + Document doc = (Document) o; + FileObject fo = NbEditorUtilities.getFileObject(doc); + return fo.getNameExt(); + } return ""; } ! /** Find a TopComponent that has been activated as an editor */ public static TopComponent getEditorTopComponent(JEditorPane editorPane) { |