Examples of NbEditorDocument


Examples of org.netbeans.modules.editor.NbEditorDocument

        } catch (Exception ex) {
        }
    }

    public boolean checkTest() {
        NbEditorDocument doc = (NbEditorDocument) UpdateNodeTask.getInstance().getLastDocument();//lastResult.getSnapshot().getSource().getDocument(false);//   ElementProvider.getInstance().getEditorCookie();//TopComponent.getRegistry().getActivated().getLookup().lookup(EditorCookie.class);
        LyDataObject o = (LyDataObject) doc.getDocumentProperties().get("stream");
        if (o.getPrimaryFile().getPath().equals("E:/Mutopia/Test.ly")) {
            OutputHandler.clear("Test");
            ListAll all = new ListAll() {

                @Override
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

        try {
            if (checkTest()) {
                return;
            }
            view.pdfPanel.closeFile();
            NbEditorDocument doc = (NbEditorDocument) UpdateNodeTask.getInstance().getLastDocument();//lastResult.getSnapshot().getSource().getDocument(false);//   ElementProvider.getInstance().getEditorCookie();//TopComponent.getRegistry().getActivated().getLookup().lookup(EditorCookie.class);
            LyDataObject o = (LyDataObject) doc.getDocumentProperties().get("stream");

            SaveCookie sv = o.getCookie(SaveCookie.class);
            if (sv != null) {
                sv.save();
            }
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

        }
        return soktave;
    }

    public static NoteEditor create(ASTPitch pitch) {
        NbEditorDocument doc = UpdateNodeTask.getInstance().getLastDocument();
        int pos = NbDocument.findLineOffset(doc, pitch.jjtGetFirstToken().beginLine - 1) + pitch.jjtGetFirstToken().beginColumn - 1;
        int len = NbDocument.findLineOffset(doc, pitch.jjtGetLastToken().endLine - 1) + pitch.jjtGetLastToken().endColumn - pos;
        NoteEditor ret = new NoteEditor();
        try {

            String text = "{" + doc.getText(pos, len).trim() + "}";//"a" is parsed as declaration
            ret.type = TYPE_NOTE;
            ret.node = pitch;
            ByteArrayInputStream in = new ByteArrayInputStream(text.getBytes());
            Parser p = new Parser(in);
            ASTDocument ll = p.Document();
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

        node.jjtGetParent().jjtAddChild(ch, pos);
        node.jjtSetParent(ch);
        String valueneu = "<" + this.getNoteName() + ">" + this.asString().substring(getNoteName().length());
        NetbeansTextEditor.getInstance().editASTItem(node, valueneu);
        node.jjtGetFirstToken().beginColumn++;
        NbEditorDocument doc = UpdateNodeTask.getInstance().getLastDocument();

        node.jjtGetLastToken().endColumn = node.jjtGetFirstToken().beginColumn + getNoteName().length() - 1;


    }
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

        String nr2 = p3 == -1 ? "0" : ln.substring(p2 + 1, p3);

        int line = Integer.parseInt(nr1);
        int pos = Integer.parseInt(nr2);
        //  String allText = ElementProvider.getInstance().getEditorCookie().getOpenedPanes()[0].getText();
        NbEditorDocument doc = (NbEditorDocument) UpdateNodeTask.getInstance().lastResult.getSnapshot().getSource().getDocument(false);
        LyDataObject o = (LyDataObject) doc.getDocumentProperties().get("stream");
        String test = o.getPrimaryFile().getPath();
        if (!o.getPrimaryFile().getPath().equals(file)) {
            //openFIle in Editor
            Executor.openLine(file, line);
         
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

    public void run(Result result, SchedulerEvent event) {

        lastResult = (LyParserResult) result;
        if (event instanceof CursorMovedSchedulerEvent) {
            CursorMovedSchedulerEvent evt = (CursorMovedSchedulerEvent) event;
            NbEditorDocument document = (NbEditorDocument) result.getSnapshot().getSource().getDocument(false);
            String checktab = result.getSnapshot().getText().toString();
            if (checktab.indexOf("\t") >= 0) {
                try {
                    document.remove(0, document.getLength());
                    document.insertString(0, checktab.replace("\t", "        "), null);
                } catch (Exception ex) {
                }
            }
            //if cursor was set with temp then this cursor should not be destroyed
            if (getLastCurrent() != null && (getLastCurrent().id == ParserTreeConstants.JJTTEMPNODE ||getLastCurrent().id==ParserTreeConstants.JJTLINEBEGIN) ) {
                int col = NbDocument.findLineColumn(document, evt.getCaretOffset())+1;
                int line = NbDocument.findLineNumber(document, evt.getCaretOffset())+1;

                if(getLastCurrent().jjtGetFirstToken().beginColumn==col&&getLastCurrent().jjtGetFirstToken().beginLine==line)
                    return;
            }
            SimpleNode ret = find(document, lastResult.getRoot(), evt.getCaretOffset(), evt.getMarkOffset());
            if(ret!=null&&ret.jjtGetParent()!=null&&ret.jjtGetParent().id==ParserTreeConstants.JJTKEY)
                ret=ret.jjtGetParent();
            if (ret == null || (ret.jjtGetNumChildren() > 0 && ret.id!=ParserTreeConstants.JJTKEY)) {
                try {
                    //find last valid node
                    SimpleNode singleNode=ret;
                    int ct=evt.getCaretOffset();
                    while(ct>0&& singleNode.jjtGetNumChildren()!=0){
                        singleNode=find(document, lastResult.getRoot(),ct, 0);
                        ct--;
                    }
                    int col = NbDocument.findLineColumn(document, evt.getCaretOffset())+1;
                    int line = NbDocument.findLineNumber(document, evt.getCaretOffset());
                    ASTTempNode gen = ASTTempNode.create(document.getText(evt.getCaretOffset(), 1), line, col,singleNode);
                    ret = gen;
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

        return (NbEditorDocument) UpdateNodeTask.getInstance().lastResult.getSnapshot().getSource().getDocument(false);// ElementProvider.getInstance().getEditorCookie();
    }

    public void editASTItem(SimpleNode itemToEdit, String textneu) {
        NbEditorDocument doc = UpdateNodeTask.getInstance().getLastDocument();
        int pos = getPositionBegin(itemToEdit.jjtGetFirstToken()) - 1;
        int len = getPositionEnd(itemToEdit.jjtGetLastToken()) - pos;

        try {
            len = doc.getText(pos, len).trim().length();
            if (textneu.equals("") && doc.getText(pos + len, 1).equals(" "))//if delete element also delete the following space
            {
                len = len + 1;
            }
            getDocument().remove(pos, len);
            getDocument().insertString(pos, textneu, null);
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

    public void insertAfterASTItem(SimpleNode afterNode, String textneu, SimpleNode newItemToChange) {
        insertAfterASTItem(afterNode, textneu, true, true, newItemToChange);
    }

    public void insertAfterASTItem(SimpleNode afterNode, String textneu, boolean insertSpaceBefore, boolean insertSpaceAfter, SimpleNode newItemToChange) {
        NbEditorDocument doc = UpdateNodeTask.getInstance().getLastDocument();
        int pos = getPositionEnd(afterNode.jjtGetLastToken());
        String test=getText(pos, 1);
        if (getText(pos, 1).equals(" ")) {
            insertSpaceBefore = false;
            pos = pos + 1;
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

        UpdateNodeTask.getInstance().fireCurrentChanged(item, 99);
        selectPosition(start, end - start);
    }

    private JEditorPane findEditorPane() {
        NbEditorDocument toFind = getDocument();
        Set<TopComponent> comps = TopComponent.getRegistry().getOpened();
        for (TopComponent comp : comps) {
            Node[] arr = comp.getActivatedNodes();
            if (arr != null) {
                for (int j = 0; j < arr.length; j++) {
View Full Code Here

Examples of org.netbeans.modules.editor.NbEditorDocument

                    //   EditorCookie ec = ElementProvider.getInstance().getEditorCookie();//TopComponent.getRegistry().getActivated().getLookup().lookup(EditorCookie.class);
                    FileReader rd = new FileReader(tmpFileName);
                    char buf[] = new char[(int) new File(tmpFileName).length()];
                    rd.read(buf);
                    rd.close();
                    NbEditorDocument doc = UpdateNodeTask.getInstance().getLastDocument();
                    doc.remove(0, doc.getLength());
                    doc.insertString(0, String.valueOf(buf), null);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.