public void install(JEditorPane pane) { super.install(pane); TextUI ui = pane.getUI(); if (ui instanceof BaseTextUI) { ((BaseTextUI)ui).getEditorUI().addLayer(new LexerLayer(pane), LexerLayer.VISIBILITY); } }
/** * The change in document notification. * * @param evt * The change notification from the currently associated * document. */ public void changedUpdate(DocumentEvent evt) { if (evt instanceof BaseDocumentEvent) { BaseDocumentEvent bdevt = (BaseDocumentEvent) evt; BaseDocument doc = (BaseDocument) bdevt.getDocument(); String layerName = bdevt.getDrawLayerName(); if (layerName != null) { getEditorUI().addLayer(doc.findLayer(layerName), bdevt.getDrawLayerVisibility()); } else { // some other type of change, propagate to root view rootView.changedUpdate(evt, null, rootView.getViewFactory()); } } }
/** Called when UI is being installed into JTextComponent */ public void install(JTextComponent c) { component = c; component.addPropertyChangeListener(this); focusListener = new FocusHandler(this); component.addFocusListener(focusListener); component.addMouseListener(this); component.addMouseMotionListener(this); EditorUI editorUI = Utilities.getEditorUI(component); editorUI.addLayer(new DrawLayerFactory.CaretLayer(), DrawLayerFactory.CARET_LAYER_VISIBILITY); caretMark.setEditorUI(editorUI); selectionMark.setEditorUI(editorUI); editorUI.addPropertyChangeListener(this); BaseDocument doc = Utilities.getDocument(c); if (doc != null) { modelChanged(null, doc); } if (component.hasFocus()) { focusGained(null); // emulate focus gained if (debugCaretFocus) { System.err.println("Component has focus, calling focusGained() on doc=" + component.getDocument().getProperty(Document.TitleProperty)); } } }
if (incLayer == null) { incLayer = new DrawLayerFactory.IncSearchLayer(); if (!editorUI.addLayer(incLayer, DrawLayerFactory.INC_SEARCH_LAYER_VISIBILITY) ) {
if (incLayer == null) { incLayer = new DrawLayerFactory.IncSearchLayer(); if (!editorUI.addLayer(incLayer, DrawLayerFactory.INC_SEARCH_LAYER_VISIBILITY)) { return false; // couldn't add layer
editorUI.addLayer(new DrawLayerFactory.CaretLayer(), DrawLayerFactory.CARET_LAYER_VISIBILITY); caretMark.setEditorUI(editorUI);
/** The change in document notification. * * @param evt The change notification from the currently associated document. */ public void changedUpdate(DocumentEvent evt) { if (evt instanceof BaseDocumentEvent) { BaseDocumentEvent bdevt = (BaseDocumentEvent)evt; BaseDocument doc = (BaseDocument)bdevt.getDocument(); String layerName = bdevt.getDrawLayerName(); if (layerName != null) { getEditorUI().addLayer(doc.findLayer(layerName), bdevt.getDrawLayerVisibility()); }else{ //temp try { JTextComponent comp = getComponent(); if (comp!=null && comp.isShowing()) { getEditorUI().repaintBlock(evt.getOffset(), evt.getOffset() + evt.getLength()); } } catch (BadLocationException ex) { Utilities.annotateLoggable(ex); } } } }