本文整理了Java中org.mozilla.javascript.tools.shell.Global.setOut()
方法的一些代码示例,展示了Global.setOut()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Global.setOut()
方法的具体详情如下:
包路径:org.mozilla.javascript.tools.shell.Global
类名称:Global
方法名:setOut
暂无
代码示例来源:origin: ro.isdc.wro4j/rhino
public static void setOut(PrintStream out) {
getGlobal().setOut(out);
}
代码示例来源:origin: com.github.tntim96/rhino
public static void setOut(PrintStream out) {
getGlobal().setOut(out);
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
public static void setOut(PrintStream out) {
getGlobal().setOut(out);
}
代码示例来源:origin: biz.gabrys.lesscss/compiler
private void initialize() throws InitializationException {
InputStreamReader reader = null;
try {
final Context context = Context.enter();
context.setLanguageVersion(Context.VERSION_1_8);
final Global global = new Global();
global.init(context);
scope = context.initStandardObjects(global);
console = new ByteArrayOutputStream();
global.setOut(new PrintStream(console, false, CHARSET));
final URL lessFile = LessCompilerImpl.class.getResource("/less/less-rhino-1.7.5.js");
final URL lesscFile = LessCompilerImpl.class.getResource("/less/lessc-rhino-1.7.5.js");
final Collection<InputStream> streams = new ArrayList<InputStream>();
streams.add(lessFile.openConnection().getInputStream());
streams.add(lesscFile.openConnection().getInputStream());
reader = new InputStreamReader(new SequenceInputStream(Collections.enumeration(streams)), CHARSET);
compiler = (Function) context.compileReader(reader, lessFile.toString(), 1, null);
} catch (final Exception e) {
throw new InitializationException("Failed to initialize Less compiler", e);
} finally {
IOUtils.closeQuietly(reader);
Context.exit();
}
}
代码示例来源:origin: cn.dreampie/lesscss
global.setOut(new PrintStream(out));
代码示例来源:origin: org.lesscss/lesscss
global.setOut(new PrintStream(out));
代码示例来源:origin: lsc-project/lsc
public void initContext(Context cx, Scriptable scope, Script script) {
this.cx = cx;
this.scope = scope;
this.script = script;
if (global == null || !global.isInitialized()) {
global = new Global(cx);
global.setIn(System.in);
global.setOut(System.out);
global.setErr(System.err);
}
// dim.setScopeProvider(new LscScopeProvider(global));
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
this.setOut(new PrintStream(out));
this.setErr(new PrintStream(err));
String resultString = "";
ToolErrorReporter.reportException(cx.getErrorReporter(), e);
} finally {
this.setOut(savedOut);
this.setErr(savedErr);
cx.setErrorReporter(savedErrorReporter);
代码示例来源:origin: ro.isdc.wro4j/rhino
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
this.setOut(new PrintStream(out));
this.setErr(new PrintStream(err));
String resultString = "";
ToolErrorReporter.reportException(cx.getErrorReporter(), e);
} finally {
this.setOut(savedOut);
this.setErr(savedErr);
cx.setErrorReporter(savedErrorReporter);
代码示例来源:origin: com.github.tntim96/rhino
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
this.setOut(new PrintStream(out));
this.setErr(new PrintStream(err));
String resultString = "";
ToolErrorReporter.reportException(cx.getErrorReporter(), e);
} finally {
this.setOut(savedOut);
this.setErr(savedErr);
cx.setErrorReporter(savedErrorReporter);
代码示例来源:origin: com.github.tntim96/rhino
/**
* Main entry point. Creates a debugger attached to a Rhino
* {@link org.mozilla.javascript.tools.shell.Main} shell session.
*/
public static void main(String[] args) {
Main main = new Main("Rhino JavaScript Debugger");
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
System.setIn(main.getIn());
System.setOut(main.getOut());
System.setErr(main.getErr());
Global global = org.mozilla.javascript.tools.shell.Main.getGlobal();
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
main.attachTo(
org.mozilla.javascript.tools.shell.Main.shellContextFactory);
main.setScope(global);
main.pack();
main.setSize(600, 460);
main.setVisible(true);
org.mozilla.javascript.tools.shell.Main.exec(args);
}
代码示例来源:origin: org.alfresco.surf/spring-webscripts
/**
* Activate the Debugger
*/
public synchronized void activate()
{
factory = ContextFactory.getGlobal();
Global global = new Global();
global.init(factory);
global.setIn(System.in);
global.setOut(System.out);
global.setErr(System.err);
initDebugger();
ScopeProvider sp = new AlfrescoScopeProvider((Scriptable)global);
dim.setScopeProvider(sp);
gui = new AlfrescoGui(dim, getTitle(), this);
gui.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
gui.setExitAction(this);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Main entry point. Creates a debugger attached to a Rhino
* {@link org.mozilla.javascript.tools.shell.Main} shell session.
*/
public static void main(String[] args) {
Main main = new Main("Rhino JavaScript Debugger");
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
System.setIn(main.getIn());
System.setOut(main.getOut());
System.setErr(main.getErr());
Global global = org.mozilla.javascript.tools.shell.Main.getGlobal();
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
main.attachTo(
org.mozilla.javascript.tools.shell.Main.shellContextFactory);
main.setScope(global);
main.pack();
main.setSize(600, 460);
main.setVisible(true);
org.mozilla.javascript.tools.shell.Main.exec(args);
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
/**
* Main entry point. Creates a debugger attached to a Rhino
* {@link org.mozilla.javascript.tools.shell.Main} shell session.
*/
public static void main(String[] args) {
Main main = new Main("Rhino JavaScript Debugger");
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
System.setIn(main.getIn());
System.setOut(main.getOut());
System.setErr(main.getErr());
Global global = org.mozilla.javascript.tools.shell.Main.getGlobal();
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
main.attachTo(
org.mozilla.javascript.tools.shell.Main.shellContextFactory);
main.setScope(global);
main.pack();
main.setSize(600, 460);
main.setVisible(true);
org.mozilla.javascript.tools.shell.Main.exec(args);
}
代码示例来源:origin: deas/alfresco
/**
* Activate the Debugger
*/
public synchronized void activate()
{
factory = ContextFactory.getGlobal();
Global global = new Global();
global.init(factory);
global.setIn(System.in);
global.setOut(System.out);
global.setErr(System.err);
initDebugger();
ScopeProvider sp = new AlfrescoScopeProvider((Scriptable)global);
dim.setScopeProvider(sp);
gui = new AlfrescoGui(dim, getTitle(), this);
gui.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
gui.setExitAction(this);
}
代码示例来源:origin: org.springframework.extensions.surf/spring-webscripts
/**
* Activate the Debugger
*/
public synchronized void activate()
{
factory = ContextFactory.getGlobal();
Global global = new Global();
global.init(factory);
global.setIn(System.in);
global.setOut(System.out);
global.setErr(System.err);
initDebugger();
ScopeProvider sp = new AlfrescoScopeProvider((Scriptable)global);
dim.setScopeProvider(sp);
gui = new AlfrescoGui(dim, getTitle(), this);
gui.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
gui.setExitAction(this);
}
代码示例来源:origin: ro.isdc.wro4j/rhino
/**
* Helper method for {@link #mainEmbedded(String)}, etc.
*/
private static Main mainEmbeddedImpl(ContextFactory factory,
Object scopeProvider,
String title) {
if (title == null) {
title = "Rhino JavaScript Debugger (embedded usage)";
}
Main main = new Main(title);
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
main.attachTo(factory);
if (scopeProvider instanceof ScopeProvider) {
main.setScopeProvider((ScopeProvider)scopeProvider);
} else {
Scriptable scope = (Scriptable)scopeProvider;
if (scope instanceof Global) {
Global global = (Global)scope;
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
}
main.setScope(scope);
}
main.pack();
main.setSize(600, 460);
main.setVisible(true);
return main;
}
代码示例来源:origin: com.github.tntim96/rhino
/**
* Helper method for {@link #mainEmbedded(String)}, etc.
*/
private static Main mainEmbeddedImpl(ContextFactory factory,
Object scopeProvider,
String title) {
if (title == null) {
title = "Rhino JavaScript Debugger (embedded usage)";
}
Main main = new Main(title);
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
main.attachTo(factory);
if (scopeProvider instanceof ScopeProvider) {
main.setScopeProvider((ScopeProvider)scopeProvider);
} else {
Scriptable scope = (Scriptable)scopeProvider;
if (scope instanceof Global) {
Global global = (Global)scope;
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
}
main.setScope(scope);
}
main.pack();
main.setSize(600, 460);
main.setVisible(true);
return main;
}
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
/**
* Helper method for {@link #mainEmbedded(String)}, etc.
*/
private static Dim mainEmbeddedImpl(ContextFactory factory,
Object scopeProvider,
String title) {
if (title == null) {
title = "Rhino JavaScript Debugger (embedded usage)";
}
Main main = new Main(title);
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
main.attachTo(factory);
if (scopeProvider instanceof ScopeProvider) {
main.setScopeProvider((ScopeProvider)scopeProvider);
} else {
Scriptable scope = (Scriptable)scopeProvider;
if (scope instanceof Global) {
Global global = (Global)scope;
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
}
main.setScope(scope);
}
main.pack();
main.setSize(600, 460);
main.setVisible(true);
return main.dim;
}
内容来源于网络,如有侵权,请联系作者删除!