org.mozilla.javascript.tools.shell.Global.init()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 JavaScript  
字(7.2k)|赞(0)|评价(0)|浏览(232)

本文整理了Java中org.mozilla.javascript.tools.shell.Global.init()方法的一些代码示例,展示了Global.init()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Global.init()方法的具体详情如下:
包路径:org.mozilla.javascript.tools.shell.Global
类名称:Global
方法名:init

Global.init介绍

[英]Set the action to call from quit().
[中]

代码示例

代码示例来源:origin: com.github.tntim96/rhino

public Object run(Context cx)
  {
    init(cx);
    return null;
  }
});

代码示例来源:origin: ro.isdc.wro4j/rhino

public Object run(Context cx)
  {
    init(cx);
    return null;
  }
});

代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger

public Object run(Context cx)
  {
    init(cx);
    return null;
  }
});

代码示例来源:origin: com.github.tntim96/rhino

public Global(Context cx)
{
  init(cx);
}

代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger

public Global(Context cx)
{
  init(cx);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

public Global(Context cx)
{
  init(cx);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 * Entry point for embedded applications.  This method attaches
 * to the global {@link ContextFactory} with a scope of a newly
 * created {@link Global} object.  No I/O redirection is performed
 * as with {@link #main(String[])}.
 */
public static Main mainEmbedded(String title) {
  ContextFactory factory = ContextFactory.getGlobal();
  Global global = new Global();
  global.init(factory);
  return mainEmbedded(factory, global, title);
}

代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger

/**
 * Entry point for embedded applications.  This method attaches
 * to the global {@link ContextFactory} with a scope of a newly
 * created {@link Global} object.  No I/O redirection is performed
 * as with {@link #main(String[])}.
 */
public static Dim mainEmbedded(String title) {
  ContextFactory factory = ContextFactory.getGlobal();
  Global global = new Global();
  global.init(factory);
  return mainEmbedded(factory, global, title);
}

代码示例来源:origin: com.github.tntim96/rhino

/**
 * Entry point for embedded applications.  This method attaches
 * to the global {@link ContextFactory} with a scope of a newly
 * created {@link Global} object.  No I/O redirection is performed
 * as with {@link #main(String[])}.
 */
public static Main mainEmbedded(String title) {
  ContextFactory factory = ContextFactory.getGlobal();
  Global global = new Global();
  global.init(factory);
  return mainEmbedded(factory, global, title);
}

代码示例来源:origin: net.sourceforge.purrpackage/purrpackage

synchronized void init() {
  if ( ! inited ) {
    Context c = Context.enter();
    c.setOptimizationLevel( -1 );
    Global g = Main.getGlobal();
    g.init( c );
    inited = true;
  }
}

代码示例来源:origin: com.asual.lesscss/lesscss-servlet

protected void compress() throws IOException {
  URL cssmin = getClass().getClassLoader().getResource(
      "META-INF/cssmin.js");
  Context cx = Context.enter();
  cx.setOptimizationLevel(9);
  Global global = new Global();
  global.init(cx);
  Scriptable scope = cx.initStandardObjects(global);
  cx.evaluateString(scope, "var exports = {};", "exports", 1, null);
  cx.evaluateReader(scope, new InputStreamReader(cssmin.openConnection()
      .getInputStream()), cssmin.getFile(), 1, null);
  Scriptable exports = (Scriptable) scope.get("exports", scope);
  Scriptable compressor = (Scriptable) exports.get("compressor", exports);
  Function fn = (Function) compressor.get("cssmin", compressor);
  content = ((String) Context.call(null, fn, compressor, compressor,
      new Object[] { new String(content, charset).replaceFirst(
          "^/\\*", "/*!") })).getBytes(charset);
  Context.exit();
}

代码示例来源:origin: org.juzu/juzu-plugins-less

public Rhino1_7R3Context()
{
 Context ctx = Context.enter();
 try
 {
  ctx.setOptimizationLevel(1);
  ctx.setLanguageVersion(Context.VERSION_1_7);
  //
  Global global = new Global();
  global.init(ctx);
  this.global = global;
  this.ctx = ctx;
  this.scope = ctx.initStandardObjects(global);
  this.classCache = new HashMap<String, Class<?>>();
  this.codeCache = new HashMap<String, byte[]>();
 }
 finally
 {
  Context.exit();
 }
}

代码示例来源:origin: juzu/juzu

public Rhino1_7R3Context()
{
 Context ctx = Context.enter();
 try
 {
  ctx.setOptimizationLevel(1);
  ctx.setLanguageVersion(Context.VERSION_1_7);
  //
  Global global = new Global();
  global.init(ctx);
  this.global = global;
  this.ctx = ctx;
  this.scope = ctx.initStandardObjects(global);
  this.classCache = new HashMap<String, Class<?>>();
  this.codeCache = new HashMap<String, byte[]>();
 }
 finally
 {
  Context.exit();
 }
}

代码示例来源:origin: ro.isdc.wro4j/rhino

/**
 *  Execute the given arguments, but don't System.exit at the end.
 */
public static int exec(String origArgs[])
{
  errorReporter = new ToolErrorReporter(false, global.getErr());
  shellContextFactory.setErrorReporter(errorReporter);
  String[] args = processOptions(origArgs);
  if (processStdin) {
    fileList.add(null);
  }
  if (!global.initialized) {
    global.init(shellContextFactory);
  }
  IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
  iproxy.args = args;
  shellContextFactory.call(iproxy);
  return exitCode;
}

代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger

/**
 *  Execute the given arguments, but don't System.exit at the end.
 */
public static int exec(String origArgs[])
{
  errorReporter = new ToolErrorReporter(false, global.getErr());
  shellContextFactory.setErrorReporter(errorReporter);
  String[] args = processOptions(origArgs);
  if (processStdin)
    fileList.add(null);
  if (!global.initialized) {
    global.init(shellContextFactory);
  }
  IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
  iproxy.args = args;
  shellContextFactory.call(iproxy);
  return exitCode;
}

代码示例来源:origin: com.github.tntim96/rhino

/**
 *  Execute the given arguments, but don't System.exit at the end.
 */
public static int exec(String origArgs[])
{
  errorReporter = new ToolErrorReporter(false, global.getErr());
  shellContextFactory.setErrorReporter(errorReporter);
  String[] args = processOptions(origArgs);
  if (processStdin) {
    fileList.add(null);
  }
  if (!global.initialized) {
    global.init(shellContextFactory);
  }
  IProxy iproxy = new IProxy(IProxy.PROCESS_FILES);
  iproxy.args = args;
  shellContextFactory.call(iproxy);
  return exitCode;
}

代码示例来源:origin: org.dojotoolkit/dojo-shrinksafe

public static void main(String[] args) {
  errorReporter = new ToolErrorReporter(false, global.getErr());
  shellContextFactory.setErrorReporter(errorReporter);
  IProxy iproxy = new IProxy(IProxy.PROCESS_FILES, processOptions(args));
  global.init(shellContextFactory);
  shellContextFactory.call(iproxy);
}

代码示例来源: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: 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);
}

相关文章