Examples of EditorCookie


Examples of org.openide.cookies.EditorCookie

            this.attrs = attrs;
            this.start = start;
            this.end = end;
            try {
                DataObject dobj = DataObject.find(fo);
                EditorCookie ec = dobj.getCookie(EditorCookie.class);
                doc = ec.getDocument();
            } catch (DataObjectNotFoundException ex) {
            }
        }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        Part lp = (Part) getAttachedAnnotatable();
        if (lp == null) return null;
        Line line = lp.getLine ();
        DataObject dob = DataEditorSupport.findDataObject (line);
        if (dob == null) return null;
        EditorCookie ec = dob.getCookie(EditorCookie.class);
        if (ec == null)
            return null;
            // Only for editable dataobjects

        this.lp = lp;
View Full Code Here

Examples of org.openide.cookies.EditorCookie

            if (file == null) {
                return;
            }
            try {
                DataObject dobj = DataObject.find (file);
                EditorCookie ec = (EditorCookie) dobj.getCookie(EditorCookie.class);
                if (ec == null) {
                    return;
                }
                try {
                    doc = ec.openDocument();
                } catch (IOException ex) {
                    ErrorManager.getDefault().notify(ex);
                    return;
                }
            } catch (DataObjectNotFoundException ex) {
View Full Code Here

Examples of org.openide.cookies.EditorCookie

            Toolkit.getDefaultToolkit().beep();
            return;
        }
        try {
            DataObject dob = DataObject.find(file);
            EditorCookie ed = dob.getLookup().lookup(EditorCookie.class);
            if (ed != null && file == dob.getPrimaryFile()) {
                if (lineNum == -1) {
                    ed.open();
                } else {
                    ed.openDocument();
                    try {
                        Line l = ed.getLineSet().getOriginal(lineNum - 1);
                        if (! l.isDeleted()) {
                            l.show(Line.ShowOpenType.REUSE, Line.ShowVisibilityType.FOCUS);
                        }
                    } catch (IndexOutOfBoundsException ioobe) {
                        // Probably harmless. Bogus line number.
                        ed.open();
                    }
                }
//                attachAllInFile(ed, this);
            } else {
                Toolkit.getDefaultToolkit().beep();
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        try {
            dataObject = DataObject.find (file);
        } catch (DataObjectNotFoundException ex) {
            return 0;
        }
        EditorCookie ec = (EditorCookie) dataObject.getCookie(EditorCookie.class);
        if (ec == null) return 0;
        ec.prepareDocument().waitFinished();
        Document d = ec.getDocument();
        if (!(d instanceof StyledDocument)) return 0;
        StyledDocument sd = (StyledDocument) d;
        return NbDocument.findLineNumber(sd, sd.getLength());
    }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

    return mppost;
  }

  protected void performAction(Node[] activatedNodes) {
    try {
      EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
      FileObject fileobj = activatedNodes[0].getLookup().lookup(FileObject.class);

      JEditorPane focusedPane = editorCookie.getOpenedPanes()[0];
      String selectedText = focusedPane.getSelectedText();

      MysticPastePost mppost = createPost();
      String viewUrl =
              mppost.sendPaste(selectedText, fileobj.getExt().toUpperCase());
View Full Code Here

Examples of org.openide.cookies.EditorCookie

            public void run() {
                Iterator it = TopComponent.getRegistry().getOpened().iterator();
                while (it.hasNext()) {
                    TopComponent tc = (TopComponent) it.next();
                    EditorCookie ec = tc.getLookup().lookup(EditorCookie.class);
                    if (ec == null) {
                        continue;
                    }
                    JEditorPane[] eps = ec.getOpenedPanes();
                    if (eps == null) {
                        continue;
                    }
                    int i, k = eps.length;
                    for (i = 0; i < k; i++) {
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        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++) {
                    EditorCookie ec = arr[j].getCookie(EditorCookie.class);
                    if (ec != null && ec.getDocument() == toFind) {
                        JEditorPane[] panes = ec.getOpenedPanes();
                        if (panes != null) {
                            return panes[0];
                        }
                    }
                }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

    static final Var selectCurrentFormFn =
            RT.var("org.enclojure.ide.navigator.token-nav", "select-current-form");


    protected void performAction(Node[] activatedNodes) {
        EditorCookie editorCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
        if(editorCookie != null)
        {
            JEditorPane pane = editorCookie.getOpenedPanes()[0];
            try {
                selectCurrentFormFn.invoke(pane);
            } catch (Exception ex) {
                Exceptions.printStackTrace(ex);
            }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        Line.Part lp = (Line.Part) getAttachedAnnotatable();
        if (lp != null) {
            Line line = lp.getLine ();
            DataObject dob = DataEditorSupport.findDataObject(line);
            EditorCookie ec = (EditorCookie) dob.getCookie(EditorCookie.class);

            if (ec != null) { // Only for editable dataobjects
                try {
                    doc = ec.openDocument ();                   
                    RequestProcessor.getDefault().post(this);                   
                } catch (IOException e) {
                }
            }
        }
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.