Package org.openide.text

Examples of org.openide.text.Line


            if (dobj != null) {
                LineCookie lc = (LineCookie) dobj.getCookie(LineCookie.class);
                if (lc == null) {/* cannot do it */
                    return;
                }
                Line l = lc.getLineSet().getOriginal(line);
                l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
            }
    }
View Full Code Here


                    ex.printStackTrace();
                }
                if (dobj != null) {
                    LineCookie lc = (LineCookie) dobj.getCookie(LineCookie.class);
                    if (lc != null) {
                        Line l = lc.getLineSet().getOriginal(Integer.parseInt(lineNumber));
                        l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
                    }

                }
            }
        }
View Full Code Here

                    DataObject dob = DataObject.find( fo );
                    EditorCookie ck = dob.getLookup().lookup( EditorCookie.class );
                    if (ck != null) {
                        LineCookie l = dob.getLookup().lookup( LineCookie.class );
                        if (l != null) {
                            Line goTo = l.getLineSet().getCurrent( Math.max (0, line -1) );
                            if (goTo == null) {
                                goTo =  l.getLineSet().getOriginal(line -1);
                            }
                            if (goTo != null) {
                                String txt = goTo.getText();
                                int length = txt == null ? -1 : txt.length();
                                int position = charPos >= length && txt != null ? 0 : charPos;
                                goTo.show( ShowOpenType.REUSE_NEW,
                                    ShowVisibilityType.FOCUS, position );
                            } else {
                                Logger.getLogger(LineConvertor.class.getName()).log(
                                        Level.WARNING,
                                        "Could not go to line {0} of {1}",
View Full Code Here

                String filter = "";
                try {
                    final StyledDocument styled = (StyledDocument) document;
                    final int lineStartOffset = getRowFirst(styled, caretOffset);

                    Line myLine = NbEditorUtilities.getLine(document, lineStartOffset, false);
                    final String line = styled.getText(lineStartOffset, caretOffset - lineStartOffset);

                    Object titleProperty = styled.getProperty("title");
                    String title = "";
                    if(titleProperty != null) {
                        title = titleProperty.toString();
                    }

                    if(compiler != null) {
                        CompilerCodeCompletionRequest request = new CompilerCodeCompletionRequest();
                        request.setLine(line);
                        request.setFileKey(title);
                        request.setStartOffset(caretOffset - lineStartOffset);
                        request.setLine(myLine.getText());
                        request.setLineNumber(myLine.getLineNumber());
                        CompilerCodeCompletionResults completionResults = compiler.requestCodeCompletionResult(request);
                        Set<CompilerCodeCompletionResult> results = completionResults.getResults();
                        if(results.size() > 0) {
                            filter = completionResults.getFilter();
                        }
View Full Code Here

            clazz = classes.next();
        }
       
        if(clazz != null) {
            Document document = qpr.getSnapshot().getSource().getDocument(true);
            Line line = NbEditorUtilities.getLine(document, startPosition, false);
            MethodDescriptor methodAtLine = clazz.getMethodAtLine(line.getLineNumber() + 1, 0);
            VariableParameterCommonDescriptor variable = methodAtLine.getVariable(subSequence.toString());
            if(variable != null){
                return true;
            }else{
                return false;
View Full Code Here

                            if (dataObj != null) {
                                LineCookie lc = dataObj.getCookie(LineCookie.class);
                                if (lc == null) {
                                    return;
                                }
                                Line l = lc.getLineSet().getOriginal(line);
                                l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
                            }
                        }

                        //highlight the line
                        StyledDocument document = ck.getDocument();
                        if(document != null) {
                            Element e = document.getDefaultRootElement();
                            if (e != null && line != -1) {
                                e = e.getElement(line);
                                final int startOfLine = e.getStartOffset();
                                Line myLine = NbEditorUtilities.getLine(document, startOfLine, false);
                                update(myLine);
                            }
                        }
                    }
                } catch (Exception exception) {
View Full Code Here

                            if (dataObj != null) {
                                LineCookie lc = dataObj.getCookie(LineCookie.class);
                                if (lc == null) {
                                    return;
                                }
                                Line l = lc.getLineSet().getOriginal(line);
                                l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
                            }
                        }
                    }
                } catch (Exception exception) {
                }
View Full Code Here

                   
                    Element e = document.getDefaultRootElement();
                    if (e != null && lineNumber != -1) {
                        e = e.getElement(lineNumber);
                        final int startOfLine = e.getStartOffset();
                        Line myLine = NbEditorUtilities.getLine(document, startOfLine, false);
                        update(myLine);
                        jumpToLine(dataObject, lineNumber);
                    } else {
                        if (dataObject != null) {
                            openEditor(dataObject);
View Full Code Here

                        LineCookie lc = dob.getCookie(LineCookie.class);
                        if (lc == null) {
                            return;
                        }
                        lineNumber = n.getLine() - 1;
                        Line l = lc.getLineSet().getOriginal(lineNumber);
                        l.show(Line.ShowOpenType.OPEN, Line.ShowVisibilityType.FOCUS);
                       
                        if (TextToSpeechOptions.isScreenReading()) {
                            speech.speak("Focussed to " + fileObjectToOpen.getName()
                                    + " dot " + fileObjectToOpen.getExt() + " "
                                    + n.getShortDescription() + " " + n.getDisplayName(),
View Full Code Here

                    EditorCookie ec = n[0].getCookie(EditorCookie.class);
                    if (ec != null) {
                        JEditorPane[] panes = ec.getOpenedPanes();
                        if (panes.length > 0) {
                            int cursor = panes[0].getCaret().getDot();
                            Line line = NbEditorUtilities.getLine(panes[0].getDocument(), cursor, true);
                            FileObject fo = NbEditorUtilities.getFileObject(panes[0].getDocument());
                            CompilerFileDescriptor cfd = compiler.getFileDescriptor(fo);
                            if (!TODUtils.isTODEnabled()) {
                                compiler.runToCursor(fo, line.getLineNumber());
                            } else {
                                String jvmName = TODCompilerUtils.findJVMClassName(cfd, line.getLineNumber() + 1);
                                TODSessionFactory.getDefault().getActionHandler().runForwardToLine(jvmName, line.getLineNumber() + 1, false);
                            }
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.openide.text.Line

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.