Package org.openide.text

Examples of org.openide.text.Line


    public void actionPerformed(ActionEvent e) {
        JTextComponent ed = org.netbeans.api.editor.EditorRegistry.lastFocusedComponent();
        Document document = ed.getDocument();
        FileObject currentDocFo = NbEditorUtilities.getFileObject(document);
        Element el = document.getDefaultRootElement();
        Line myLine = NbEditorUtilities.getLine(document, ed.getCaretPosition(), false);

        File currentDocFile = org.openide.filesystems.FileUtil.toFile(currentDocFo);
        if (currentDocFile == null) {
            return;
        }
        String currentFile = currentDocFile.getAbsolutePath();


        String key = generateBreakpointKey(myLine.getLineNumber(), currentDocFo);
        BreakpointListener change = new BreakpointListener();
        change.originalLine = myLine.getLineNumber();
        change.key = key;
        change.currentDocFo = currentDocFo;
        change.caret = ed.getCaretPosition();
        myLine.addPropertyChangeListener(change);
       
        String addRemove = "";
        if (TextToSpeechOptions.isScreenReading()) {
            speech.speak(addRemove + " Breakpoint at line " + myLine.getLineNumber(), SpeechPriority.HIGHEST);
        }
    }
View Full Code Here


        public void propertyChange(PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if (propertyName.compareTo(Line.PROP_LINE_NUMBER) == 0) {
                Object source = evt.getSource();
                if (source instanceof Line) {
                    Line line = (Line) source;
                    if (line.getAnnotationCount() > 0) {
                        int num = line.getLineNumber();
                        String newKey = generateBreakpointKey(num, currentDocFo);
                    }
                }
            }
        }
View Full Code Here

        TODSessionFactory.getDefault().getJVMHandler().removeAllBreakpoints();
        for (int i = 0; i < breakpoints.length; i++) {
            Breakpoint bp = breakpoints[i];
            if (bp instanceof QuorumBreakpoint) {
                QuorumBreakpoint qb = (QuorumBreakpoint)bp;
                Line line = qb.getLine();
                FileObject fo = qb.getFileObject();
                if (compiler != null) {
                    CompilerFileDescriptor fileDescriptor = compiler.getFileDescriptor(fo);
                    int targetLine = line.getLineNumber() + 1;
                    String name = TODCompilerUtils.findJVMClassName(fileDescriptor, targetLine);
                    if (name != null) {
                        QuorumDebuggerUtils.addLineBreakpoint(name, targetLine);
                    }
                }
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

                            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();
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.runBackToCursor(fo, line.getLineNumber());
                            } else {
                                String jvmName = TODCompilerUtils.findJVMClassName(cfd, line.getLineNumber() + 1);
                                TODSessionFactory.getDefault().getActionHandler().runBackToLine(jvmName, line.getLineNumber() + 1, false);
                            }
                        }
                    }
                }
            }
View Full Code Here

        }
        return fo;
    }

    public static QuorumBreakpoint getBreakpointAtLine() {
        Line line = getCurrentLine();
        FileObject fo = getFileInEditor();
       
        QuorumBreakpoint breakpoint = new QuorumBreakpoint(line, fo);
        return breakpoint;
    }
View Full Code Here

        }
        return actions;
    }

    private static void goToSource(QuorumBreakpoint breakpoint) {
        Line line = breakpoint.getLine();
        if (line != null) {
            line.show(Line.ShowOpenType.REUSE, Line.ShowVisibilityType.FOCUS);
        }
    }
View Full Code Here

    @Override
    public Object read(String typeID, Properties properties) {
        if (typeID.equals(QuorumBreakpoint.class.getName())) {
            String url = properties.getString(URL, null);
            Line line = getLine(url, properties
                    .getInt(LINE_NUMBER, 1));

            if (line == null) {
                return null;
            }
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);
                                updateLine(myLine);
                            }
                        }
                    }
                } catch (Exception exception) {
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.