public String getHighlightTestData() { int lineStart = NbDocument.findLineNumber((StyledDocument) doc, start); int columnStart = NbDocument.findLineColumn((StyledDocument) doc, start); int lineEnd = NbDocument.findLineNumber((StyledDocument) doc, end); int columnEnd = NbDocument.findLineColumn((StyledDocument) doc, end); return coloringsToString() + ", " + lineStart + ":" + columnStart + "-" + lineEnd + ":" + columnEnd; }
protected int getSelectionEndLine(final JTextComponent c) { if (c == null || !(c.getDocument() instanceof StyledDocument)) return 0; final int i = NbDocument.findLineNumber((StyledDocument)c.getDocument(), c.getSelectionEnd()); return c.getSelectionStart() == c.getSelectionEnd() || NbDocument.findLineColumn((StyledDocument)c.getDocument(), c.getSelectionEnd()) > 0 ? i + 1 : i; }
private String getPosition(TokenItem<TokenId> offset, CsmFile file) { BaseDocument document = CsmReferenceRepository.getDocument(file); StringBuilder out = new StringBuilder(); out.append("offset=").append(offset.offset()); // NOI18N if (document instanceof StyledDocument) { int line = NbDocument.findLineNumber((StyledDocument) document, offset.offset()) + 1; out.append(", line=").append(line); // NOI18N int col = NbDocument.findLineColumn((StyledDocument) document, offset.offset()) + 1; out.append(", column=").append(col); // NOI18N TokenItem<TokenId> jumpToken; document.readLock(); try { jumpToken = CndTokenUtilities.getTokenCheckPrev(document, offset.offset()); } finally { document.readUnlock(); } out.append(", tok=").append(jumpToken); // NOI18N } return out.toString(); }
int col = NbDocument.findLineColumn(doc, offset); try { javax.swing.text.Element lineElem =
public static boolean isScriptlet(StyledDocument doc, JEditorPane ep, int offset) { String t; int line = NbDocument.findLineNumber(doc, offset); int col = NbDocument.findLineColumn(doc, offset); try { while (line > 0) {
doc, offset); int col = NbDocument.findLineColumn( doc, offset);
offset ); int col = NbDocument.findLineColumn ( doc, offset
int col = NbDocument.findLineColumn(doc, offset); try { javax.swing.text.Element lineElem =
offset ); int col = NbDocument.findLineColumn ( doc, offset
offset ); int col = NbDocument.findLineColumn ( doc, offset
offset ); int col = NbDocument.findLineColumn ( doc, offset
offset ); int col = NbDocument.findLineColumn ( doc, offset
offset ); int col = NbDocument.findLineColumn ( doc, offset
public void run () { int definitionOffset = definition.getOffset (); try { DataObject dobj = DataObject.find (fo); EditorCookie ec = dobj.getCookie (EditorCookie.class); StyledDocument doc2 = ec.openDocument (); LineCookie lc = dobj.getCookie (LineCookie.class); Line.Set lineSet = lc.getLineSet (); Line line = lineSet.getCurrent (NbDocument.findLineNumber (doc2, definitionOffset)); int column = NbDocument.findLineColumn (doc2, definitionOffset); line.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column); } catch (IOException ex) { ex.printStackTrace (); } } };
void show () { DataObject dataObject = NbEditorUtilities.getDataObject (document); LineCookie lineCookie = dataObject.getCookie (LineCookie.class); Line.Set lineSet = lineCookie.getLineSet (); Line line = lineSet.getCurrent (NbDocument.findLineNumber (document, item.getOffset ())); int column = NbDocument.findLineColumn (document, item.getOffset ()); line.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column); }
private void addAnnotation( CdiAnalysisResult result, Element element , CDIAnnotaitonType type ) { if ( element == null ){ return; } Tree var = result.getInfo().getTrees().getTree( element ); if ( var == null ){ return; } List<Integer> position = CdiEditorAnalysisFactory.getElementPosition( result.getInfo(), var ); Document document; try { document = result.getInfo().getDocument(); if ( !( document instanceof StyledDocument) ){ return; } } catch (IOException e) { return; } int start = position.get(0); Line line = NbEditorUtilities.getLine( document , start, false); Part part = line.createPart( NbDocument.findLineColumn((StyledDocument) document, start), position.get( 1 ) -start); result.addAnnotation( new CDIAnnotation( type, part)); }
int column = NbDocument.findLineColumn(doc, offset);
Line.Set lineSet = lc.getLineSet(); Line line = lineSet.getCurrent(NbDocument.findLineNumber(docToGo, offset)); int column = NbDocument.findLineColumn(docToGo, offset); line.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
if (doc != null) { int line = NbDocument.findLineNumber(doc, (int)offset); int col = NbDocument.findLineColumn(doc, (int)offset);
Line.Set lineSet = lc.getLineSet(); Line line = lineSet.getCurrent(NbDocument.findLineNumber(docToGo, offset)); int column = NbDocument.findLineColumn (docToGo, offset); line.show (ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);