/** Compute and update main area height */ public void updateMainHeight() { LeafElement elem = (LeafElement)getElement(); // need leaf element try { int lineDiff = (elem.getEndMark().getLine() - elem.getStartMark().getLine() + 1); mainHeight = lineDiff * getEditorUI().getLineHeight(); } catch (InvalidMarkException e) { Utilities.annotateLoggable(e); mainHeight = 0; } }
public boolean addLayer(DrawLayer layer, int visibility) { if (drawLayerList.add(layer, visibility)) { BaseDocumentEvent evt = createDocumentEvent(0, 0, DocumentEvent.EventType.CHANGE); evt.addEdit(new BaseDocumentEvent.DrawLayerChange(layer.getName(), visibility)); fireChangedUpdate(evt); return true; } else { return false; } }
/** Get finder depending on find properties */ public FinderFactory.StringFinder getStringFinder(BaseDocument doc, Map props) { FinderFactory.StringFinder stringFinder = (FinderFactory.StringFinder) doc.getProperty(BaseDocument.STRING_FINDER_PROP); if (stringFinder == null) { stringFinder = getFinderCreator().createFinder(doc, getValidFindProperties(props)); doc.putProperty(BaseDocument.STRING_FINDER_PROP, stringFinder); } return stringFinder; }
/** Notify view that it is necessary to redraw the line of the document */ protected void refreshLine(int line) { fireChangedLine(line); int start = Utilities.getRowStartFromLineOffset(doc, line); int end = Utilities.getRowStartFromLineOffset(doc, line+1); if (end == -1) end = doc.getLength(); doc.repaintBlock(start, end); }
/** Get position pairs finder depending on find properties */ public FinderFactory.BlocksFinder getBlocksFinder(BaseDocument doc, Map props) { FinderFactory.BlocksFinder blocksFinder = (FinderFactory.BlocksFinder) doc.getProperty(BaseDocument.BLOCKS_FINDER_PROP); if (blocksFinder == null) { blocksFinder = getFinderCreator().createBlocksFinder(doc, getValidFindProperties(props)); } return blocksFinder; }
public static void setStatusText(JTextComponent c, String text) { StatusBar sb = getEditorUI(c).getStatusBar(); if (sb != null) { sb.setText(StatusBar.CELL_MAIN, text); } }
public void init(DrawContext ctx) { JTextComponent c = ctx.getEditorUI().getComponent(); // initialize reference to annotations annos = ctx.getEditorUI().getDocument().getAnnotations(); drawTextLimitLine = ctx.getEditorUI().textLimitLineVisible; textLimitWidth = ctx.getEditorUI().textLimitWidth; defaultSpaceWidth = ctx.getEditorUI().defaultSpaceWidth; textLimitLineColor = ctx.getEditorUI().textLimitLineColor; absoluteX = ctx.getEditorUI().getTextMargin().left; maxWidth = ctx.getEditorUI().getExtentBounds().width; }
public void updateContext(DrawContext ctx) { int pos = ctx.getFragmentOffset(); if (pos >= blocks[curInd] && pos < blocks[curInd + 1]) { if (coloring == null) { coloring = ctx.getEditorUI().getColoring(SettingsNames.HIGHLIGHT_SEARCH_COLORING); } if (coloring != null) { coloring.apply(ctx); } } }
protected Coloring getMethodColoring(DrawContext ctx) { TokenContextPath path = ctx.getTokenContextPath().replaceStart( JavaLayerTokenContext.contextPath); return ctx.getEditorUI().getColoring( path.getFullTokenName(JavaLayerTokenContext.METHOD)); }
/** * Move annotation in front of others. The activated annotation is moved in * front of other annotations on the same line */ public void frontAnnotation(AnnotationDesc anno) { int line = anno.getLine(); LineAnnotations annos = getLineAnnotations(line); if (annos == null) return; annos.activate(anno); refreshLine(line); }
synchronized void insertEdit(ModifyUndoEdit undoEdit) throws BadLocationException { int offset = undoEdit.getOffset(); checkEOLMark(offset); if (undoEdit.isTextValid()) { cache.insertString(offset, undoEdit.getText(), null); } else { // chars buffer valid cache.insert(offset, undoEdit.getChars(), null); } insertUpdate(undoEdit); // always done to update line cache }
public void release(){ drawInfo.drawGraphics.setBuffer(null); drawInfo.drawGraphics.finish(); if (drawInfo.syntax != null) { drawInfo.doc.releaseSyntax(drawInfo.syntax); } DocumentUtilities.SEGMENT_CACHE.releaseSegment(drawInfo.text); }
public void updateContext(DrawContext ctx) { if (coloring == null) { coloring = ctx.getEditorUI().getColoring(SettingsNames.INC_SEARCH_COLORING); } if (coloring != null) { coloring.apply(ctx); } }
static void invalidateAllSyntaxStateInfos(BaseDocument doc) { LineRootElement lineRoot = getLineRoot(doc); int elemCount = lineRoot.getElementCount(); for (int i = elemCount - 1; i >= 0; i--) { LineElement line = (LineElement)lineRoot.getElement(i); line.clearSyntaxStateInfo(); } }
protected MarkFactory.ChainDrawMark createAndInsertNewMark(int pos) throws BadLocationException { MarkFactory.ChainDrawMark mark = createMark(); try { mark.insert(doc, pos); } catch (InvalidMarkException e) { Utilities.annotateLoggable(e); } return mark; }
/** Get position pairs finder depending on find properties */ public FinderFactory.BlocksFinder getBlocksFinder(BaseDocument doc, Map props) { FinderFactory.BlocksFinder blocksFinder = (FinderFactory.BlocksFinder)doc.getProperty(BaseDocument.BLOCKS_FINDER_PROP); if (blocksFinder == null) { blocksFinder = getFinderCreator().createBlocksFinder(doc, getValidFindProperties(props)); } return blocksFinder; }
public static void setStatusText(JTextComponent c, String text) { StatusBar sb = getEditorUI(c).getStatusBar(); if (sb != null) { sb.setText(StatusBar.CELL_MAIN, text); } }
/** Compute and update main area height */ public void updateMainHeight() { LeafElement elem = (LeafElement) getElement(); // need leaf element try { int lineDiff = (elem.getEndMark().getLine() - elem.getStartMark().getLine() + 1); mainHeight = lineDiff * getEditorUI().getLineHeight(); } catch (InvalidMarkException e) { mainHeight = 0; } }
public boolean addLayer(DrawLayer layer, int visibility) { if (drawLayerList.add(layer, visibility)) { BaseDocumentEvent evt = createDocumentEvent(0, 0, DocumentEvent.EventType.CHANGE); evt.addEdit(new BaseDocumentEvent.DrawLayerChange(layer.getName(), visibility)); fireChangedUpdate(evt); return true; } else { return false; } }
/** Move annotation in front of others. The activated annotation * is moved in front of other annotations on the same line */ public void frontAnnotation(AnnotationDesc anno) { int line = anno.getLine(); LineAnnotations annos = getLineAnnotations(line); if (annos == null) return; annos.activate(anno); refreshLine(line); }