Examples of EditorCookie


Examples of org.openide.cookies.EditorCookie

               //check if there is any selected text.
               //if not then just indent the one line
               Node[] n = TopComponent.getRegistry().getActivatedNodes();
               if (n.length == 1) {
                  EditorCookie ec = n[0].getCookie(EditorCookie.class);
                  if (ec != null) {
                     JEditorPane[] panes = ec.getOpenedPanes();
                     if (panes.length > 0) {
                        if (panes[0].getSelectedText() == null || panes[0].getSelectedText().trim() == "") {
                           int nLineStart = _ctx.lineStartOffset(panes[0].getCaretPosition());
                           String codeAbove = doc.getText(java.lang.Math.max(0, nLineStart - PREV_CONTEXT_COUNT),
                                   java.lang.Math.min(nLineStart, PREV_CONTEXT_COUNT));
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        }
    }

    public static Project GetProjectFromActivatedNodes(Node[] activatedNodes)
    {
        EditorCookie ec = activatedNodes[0].getLookup().lookup(EditorCookie.class);
        return GetProjectFromDocument(ec.getDocument());
    }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

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

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

Examples of org.openide.cookies.EditorCookie

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


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

Examples of org.openide.cookies.EditorCookie

public final class GotoDeclaration extends CookieAction {

    final Var gotoDeclarationFn = RT.var("org.enclojure.ide.nb.actions.action-handler", "goto-declaration-action");
    protected void performAction(Node[] activatedNodes) {
        try {
            EditorCookie editCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
            gotoDeclarationFn.invoke();
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

public final class ToggleComment extends CookieAction {

    final Var toggleCommentFn = RT.var("org.enclojure.ide.nb.actions.CljComment", "perform-action");
    protected void performAction(Node[] activatedNodes) {
        try {
            EditorCookie editCookie = activatedNodes[0].getLookup().lookup(EditorCookie.class);
            toggleCommentFn.invoke(editCookie);
        } catch (Exception ex) {
            Exceptions.printStackTrace(ex);
        }
    }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

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


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

Examples of org.openide.cookies.EditorCookie

            File f = new File( pathLocal );
            if (f.exists()) {
                FileObject fo = FileUtil.toFileObject( f );
                try {
                    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) {
View Full Code Here

Examples of org.openide.cookies.EditorCookie

     *
     * @return
     */
    private boolean isAvailableWithEditor() {
        Lookup context = Utilities.actionsGlobalContext();
        EditorCookie ec = context.lookup(EditorCookie.class);
        StyledDocument document = ec.getDocument();
        return document != null;
    }
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        int offset = item.getOffset();
        if (fileObject != null && offset >= 0) {
            if (offset == 0) {
                try {
                    DataObject dataObject = DataObject.find(fileObject);
                    EditorCookie ec = dataObject.getLookup().lookup(EditorCookie.class);
                    ec.open();
                } catch (DataObjectNotFoundException ex) {
                    Exceptions.printStackTrace(ex);
                }
            } else {
                UiUtils.open(fileObject, offset);
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.