jEdit宏,使它像GroovyConsole一样
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jEdit宏,使它像GroovyConsole一样相关的知识,希望对你有一定的参考价值。
bind it to ctrl+enter and everything that GroovyConsole do jEdit will do too.Uses groovy installation.
buffer.setMode("groovy"); buffers = jEdit.getBuffers(); for(i = 0; i < buffers.length; i++) { gsh = buffers[i].getProperty("GroovyShell"); if(gsh != null) { break; } } if(gsh == null) { cl = this.getClass().getClassLoader(); for(i = 0; i < libfiles.length; i++) gsh = new groovy.lang.GroovyShell(cl); } for(i = 0; i < buffers.length; i++) buffers[i].setProperty("GroovyShell", gsh); outbuffer = buffer.getProperty("outbuffer"); if((outbuffer == null) || outbuffer.isClosed()) { outbuffer = jEdit.newFile(view); buffer.setProperty("outbuffer", outbuffer); } gsh.setProperty("out", out); view.showBuffer(buffer); res = textArea.getSelectedText(); if(res == null || res.length() == 0) { res = buffer.getText(); } return res; } result = gsh.evaluate(text()); outbuffer.remove(0, outbuffer.getLength()); outbuffer.insert(0, out.toString()); outbuffer.insert(outbuffer.getLength()," Result: " + result); if(result != null) { view.showBuffer(outbuffer); }
以上是关于jEdit宏,使它像GroovyConsole一样的主要内容,如果未能解决你的问题,请参考以下文章
隐藏状态栏android时的白条一瞥(如何使它像Whatsapp状态)