Examples of EditorCookie


Examples of org.openide.cookies.EditorCookie

    cssMinify(activatedNodes);
    }
   
 
    protected final void cssMinify(final Node[] activatedNodes){
        final EditorCookie editorCookie =
                Utilities.actionsGlobalContext().lookup(EditorCookie.class);
       
        for(final JEditorPane pane : editorCookie.getOpenedPanes()){
            if (pane.isShowing() &&
                    pane.getSelectionEnd() > pane.getSelectionStart() ){
                try{
                    StringSelection content = new StringSelection(selectedSourceAsMinify(pane));
                    Toolkit.getDefaultToolkit().getSystemClipboard().
View Full Code Here

Examples of org.openide.cookies.EditorCookie

     @Override
    protected final void performAction(final Node[] activatedNodes){
    jsMinify(activatedNodes);
     }
     protected final void jsMinify(final Node[] activatedNodes){
        final EditorCookie editorCookie =
                Utilities.actionsGlobalContext().lookup(EditorCookie.class);
       
        for(final JEditorPane pane : editorCookie.getOpenedPanes()){
            if (pane.isShowing() &&
                    pane.getSelectionEnd() > pane.getSelectionStart() ){
                try{
                    StringSelection content = new StringSelection(selectedSourceAsMinify(pane));
                    Toolkit.getDefaultToolkit().getSystemClipboard().
View Full Code Here

Examples of org.openide.cookies.EditorCookie

            dobj = DataObject.find(fobj);
        } catch (DataObjectNotFoundException ex) {
            Exceptions.printStackTrace(ex);
        }
        if (dobj != null) {
            EditorCookie ec = (EditorCookie) dobj.getLookup().lookup(EditorCookie.class);
            if (ec != null) {
                ec.open();
                Line.Set lineSet = ec.getLineSet();
                int index = lineNumber-1;
                assert !lineSet.getLines().isEmpty();
                /* Go to last line of file if issue line does not exist */
                if(lineSet.getLines().size() <= index) {
                    index=lineSet.getLines().size()-1;
View Full Code Here

Examples of org.openide.cookies.EditorCookie

      // Find editor
      DataObject dObj = DataObject.find(file);
      LineCookie cLine = null;
      StyledDocument currentDocument = null;
      if (null != dObj) {
    EditorCookie cEditor = dObj.getCookie(EditorCookie.class);
    cLine = dObj.getCookie(LineCookie.class);
    currentDocument = cEditor.getDocument();
    // Get text
    if (null != currentDocument) {
        text = currentDocument.getText(0, currentDocument.getLength());
    } else {
        text = getContent(file);
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new RTFTransferable(bais), null);
    }

    @Override
    public void action() {
        final EditorCookie editorCookie =
                Utilities.actionsGlobalContext().lookup(EditorCookie.class);
        if (editorCookie != null) {
            for (final JEditorPane pane : editorCookie.getOpenedPanes()) {
                if (pane != null && pane.isShowing()) {
                    try {
                        RTFConverter converter = new SwapCurrentProfileRTFConverter();
                        String formattedText = converter.convertContentToRTF(pane);
                        setRtfContest(new ByteArrayInputStream(formattedText.getBytes()));
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        JalopySettings settings = (JalopySettings) SystemOption.findObject(JalopySettings.class, true);
        final File rule = settings.getRuleFile();
        DataObject c = (DataObject) activatedNodes[0].getCookie(DataObject.class);
       
       
        EditorCookie editor = (EditorCookie) c.getCookie(EditorCookie.class);
        final StyledDocument doc = editor.getDocument();
       
        NbDocument.runAtomic(doc,new Runnable(){
            public void run() {
                try {
                    String input = doc.getText(0,doc.getLength());
View Full Code Here

Examples of org.openide.cookies.EditorCookie

    /** Add the line offset into the jump history */
    private void addPositionToJumpList(String url, Line l, int column) {
        DataObject dataObject = getDataObject(url);
        if (dataObject != null) {
            EditorCookie ec = dataObject.getLookup().lookup(EditorCookie.class);
            if (ec != null) {
                try {
                    StyledDocument doc = ec.openDocument();
                    JEditorPane[] eps = ec.getOpenedPanes();
                    if (eps != null && eps.length > 0) {
                        JumpList.addEntry(eps[0], NbDocument.findLineOffset(doc, l.getLineNumber()) + column);
                    }
                } catch (java.io.IOException ioex) {
                    ErrorManager.getDefault().notify(ioex);
View Full Code Here

Examples of org.openide.cookies.EditorCookie

             * @see org.netbeans.modules.debugger.jpda.EditorContextBridge#CompoundContextProvider#getClassName
             * @notice this has been fixed in main's rev: 30100e497ae4
             */
            return null;
        }
        EditorCookie ec = (EditorCookie) dataObject.getLookup().lookup(EditorCookie.class);
        if (ec == null) {
            return "";
        }
        StyledDocument doc;
        try {
            doc = ec.openDocument();
        } catch (IOException ex) {
            ErrorManager.getDefault().notify(ex);
            return "";
        }
        try {
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        final Operation ops[][] = new Operation[1][];
        Source source = Source.create(dataObject.getPrimaryFile());
        if (source == null) {
            return ops[0];
        }
        EditorCookie ec = (EditorCookie) dataObject.getLookup().lookup(EditorCookie.class);
        if (ec == null) {
            return ops[0];
        }
        final StyledDocument doc;
        try {
            doc = ec.openDocument();
        } catch (IOException ex) {
            ErrorManager.getDefault().notify(ex);
            return ops[0];
        }
        final int offset = findLineOffset(doc, (int) lineNumber);
View Full Code Here

Examples of org.openide.cookies.EditorCookie

        }
        Source source = Source.create(fo);
        if (source == null) {
            return null;
        }
        EditorCookie ec = (EditorCookie) dataObject.getLookup().lookup(EditorCookie.class);
        if (ec == null) {
            return null;
        }
        final StyledDocument doc;
        try {
            doc = ec.openDocument();
        } catch (IOException ex) {
            ErrorManager.getDefault().notify(ex);
            return null;
        }
        final int offset = findLineOffset(doc, methodLineNumber);
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.