@Override public List<CsmReference> getFunctionCalls(StyledDocument document, int line) { if (line < 0 || document == null) { return Collections.emptyList(); } CsmFile csmFile = CsmUtilities.getCsmFile(document, false, false); if (csmFile == null || !csmFile.isParsed()) { return Collections.emptyList(); } final Element lineRootElement = NbDocument.findLineRootElement(document); return getFunctionCalls(csmFile, lineRootElement, line); }
public void run() { switch (opCode) { case FIND_LINE_NUMBER: { Element paragraphsParent = findLineRootElement(doc); retInt = paragraphsParent.getElementIndex(argInt); // argInt is offset break; } case FIND_LINE_COLUMN: { Element paragraphsParent = findLineRootElement(doc); int indx = paragraphsParent.getElementIndex(argInt); // argInt is offset retInt = argInt - paragraphsParent.getElement(indx).getStartOffset(); break; } case FIND_LINE_OFFSET: { Element paragraphsParent = findLineRootElement(doc); Element line = paragraphsParent.getElement(argInt); // argInt is lineNumber if (line == null) { throw new IndexOutOfBoundsException("Index=" + argInt + " is out of bounds."); // NOI18N } retInt = line.getStartOffset(); break; } default: throw new IllegalStateException(); } } }
public void run() { switch (opCode) { case FIND_LINE_NUMBER: { Element paragraphsParent = findLineRootElement (doc); retInt = paragraphsParent.getElementIndex (argInt); // argInt is offset break; } case FIND_LINE_COLUMN: { Element paragraphsParent = findLineRootElement (doc); int indx = paragraphsParent.getElementIndex (argInt); // argInt is offset retInt = argInt - paragraphsParent.getElement (indx).getStartOffset (); break; } case FIND_LINE_OFFSET: { Element paragraphsParent = findLineRootElement (doc); Element line = paragraphsParent.getElement (argInt); // argInt is lineNumber if(line == null) { throw new IndexOutOfBoundsException( "Index=" + argInt + " is out of bounds."); // NOI18N } retInt = line.getStartOffset (); break; } default: throw new IllegalStateException(); } } }
public void run() { switch (opCode) { case FIND_LINE_NUMBER: { Element paragraphsParent = findLineRootElement (doc); retInt = paragraphsParent.getElementIndex (argInt); // argInt is offset break; } case FIND_LINE_COLUMN: { Element paragraphsParent = findLineRootElement (doc); int indx = paragraphsParent.getElementIndex (argInt); // argInt is offset retInt = argInt - paragraphsParent.getElement (indx).getStartOffset (); break; } case FIND_LINE_OFFSET: { Element paragraphsParent = findLineRootElement (doc); Element line = paragraphsParent.getElement (argInt); // argInt is lineNumber if(line == null) { throw new IndexOutOfBoundsException( "Index=" + argInt + " is out of bounds."); // NOI18N } retInt = line.getStartOffset (); break; } default: throw new IllegalStateException(); } } }
public void run() { // Part of #33165 - the following code is wrapped by doc.render() int lineNumber = getLineNumber(); int lineStart = NbDocument.findLineOffset(doc, lineNumber); // #24434: Check whether the next line exists // (the current one could be the last one). int lineEnd; if ((lineNumber + 1) >= NbDocument.findLineRootElement(doc).getElementCount()) { lineEnd = doc.getLength(); } else { lineEnd = NbDocument.findLineOffset(doc, lineNumber + 1); } try { retStringArray[0] = doc.getText(lineStart, lineEnd - lineStart); } catch (BadLocationException ex) { Logger.getLogger(DocumentLine.class.getName()).log(Level.WARNING, null, ex); retStringArray[0] = null; } // End of the code wrapped by doc.render() } }
/** Creates new LineListener */ public LineListener(StyledDocument doc, CloneableEditorSupport support) { this.struct = new LineStruct(); root = NbDocument.findLineRootElement(doc); orig = lines = root.getElementCount(); this.support = support; doc.addDocumentListener(WeakListeners.document(this, doc)); }
/** Creates new LineListener */ public LineListener (StyledDocument doc, CloneableEditorSupport support) { this.doc = doc; this.struct = new LineStruct (); root = NbDocument.findLineRootElement (doc); orig = lines = root.getElementCount (); this.support = support; doc.addDocumentListener(org.openide.util.WeakListeners.document (this, doc)); }
/** Creates new LineListener */ public LineListener (StyledDocument doc, CloneableEditorSupport support) { this.doc = doc; this.struct = new LineStruct (); root = NbDocument.findLineRootElement (doc); orig = lines = root.getElementCount (); this.support = support; doc.addDocumentListener(org.openide.util.WeakListeners.document (this, doc)); }
try { javax.swing.text.Element lineElem = org.openide.text.NbDocument.findLineRootElement (doc). getElement (line);
while (line > 0) { javax.swing.text.Element lineElem = org.openide.text.NbDocument.findLineRootElement(doc).getElement(line); if (lineElem == null) { continue;
try { javax.swing.text.Element lineElem = org.openide.text.NbDocument.findLineRootElement(doc). getElement(line);
try { javax.swing.text.Element lineElem = org.openide.text.NbDocument.findLineRootElement(doc). getElement(line); if (lineElem == null) {
public void run() { // XXX: why is this not done by LineParser ? final OffsetsBag bag = new OffsetsBag(document, true); Element root = NbDocument.findLineRootElement((StyledDocument) document); int count = root.getElementCount(); try { for (int i = 0; i < count; i++) { Element elm = root.getElement(i); if (BLOCK_HEADER_PATTERN.matcher(document.getText(elm.getStartOffset(), elm.getEndOffset() - elm.getStartOffset()).trim()).find()) { bag.addHighlight(elm.getStartOffset(), elm.getEndOffset(), commandHighlight); } } } catch (BadLocationException ex) { //ignore return; } headersBag.setHighlights(bag); } });
public void run() { List<PPBlockInfo> blockList = (List<PPBlockInfo>) document.getProperty(DocumentPreprocessor.PREPROCESSOR_BLOCK_LIST); if (blockList == null) { return; } final OffsetsBag bag = new OffsetsBag(document, true); LOG.log(Level.FINE, "Dumping lineset({0})", blockList.size()); //NOI18N for (PPBlockInfo b : blockList) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "lineBlock: type={0}, startLine={1}, endLine={2}, active={3}", //NOI18N new Object[]{b.getType(), b.getStartLine(), b.getEndLine(), b.isActive()}); } StyledDocument doc = (StyledDocument) document; bag.addHighlight( NbDocument.findLineRootElement(doc).getElement(b.getStartLine() - 1).getStartOffset(), NbDocument.findLineRootElement(doc).getElement(b.getEndLine() - 1).getEndOffset(), b.isActive() ? activeBlockHighlight : inactiveBlockHighlight); } LOG.log(Level.FINE, "-------------------"); //NOI18N blocksBag.setHighlights(bag); } });
try { Element lineElem = NbDocument.findLineRootElement (doc). getElement (line);
try { javax.swing.text.Element lineElem = org.openide.text.NbDocument.findLineRootElement (doc). getElement (line);
final Element lineRootElement = NbDocument.findLineRootElement(document);
doc.render(new Runnable() { public void run() { // Part of #33165 - the following code is wrapped by doc.render() int lineNumber = getLineNumber(); int lineStart = NbDocument.findLineOffset(doc, lineNumber); // #24434: Check whether the next line exists // (the current one could be the last one). int lineEnd; if((lineNumber + 1) >= NbDocument.findLineRootElement(doc).getElementCount()) { lineEnd = doc.getLength(); } else { lineEnd = NbDocument.findLineOffset(doc, lineNumber + 1); } try { retStringArray[0] = doc.getText(lineStart, lineEnd - lineStart); } catch (BadLocationException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); retStringArray[0] = null; } // End of the code wrapped by doc.render() }}); return retStringArray[0];
doc.render(new Runnable() { public void run() { // Part of #33165 - the following code is wrapped by doc.render() int lineNumber = getLineNumber(); int lineStart = NbDocument.findLineOffset(doc, lineNumber); // #24434: Check whether the next line exists // (the current one could be the last one). int lineEnd; if((lineNumber + 1) >= NbDocument.findLineRootElement(doc).getElementCount()) { lineEnd = doc.getLength(); } else { lineEnd = NbDocument.findLineOffset(doc, lineNumber + 1); } try { retStringArray[0] = doc.getText(lineStart, lineEnd - lineStart); } catch (BadLocationException ex) { ErrorManager.getDefault ().notify ( ErrorManager.EXCEPTION, ex); retStringArray[0] = null; } // End of the code wrapped by doc.render() }}); return retStringArray[0];
if (expr == null && DebuggerOption.BALLOON_EVAL.isEnabled(NativeDebuggerManager.get().globalOptions())) { Element lineElem = NbDocument.findLineRootElement(doc). getElement(line.getLineNumber());