Package groovy.ui

Examples of groovy.ui.Console


        java.util.logging.Logger.getLogger(StackTraceUtils.STACK_LOG_NAME).setUseParentHandlers(true);

        //when starting via main set the look and feel to system
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

        final Console console = new Console(Console.class.getClassLoader());
        console.setBeforeExecution(new Closure(null) {
          public void doCall() {
            console.setShell(new GroovyShell(Console.class.getClassLoader(), new Binding()) {
              public Object run(String scriptText, String fileName, String[] args) throws org.codehaus.groovy.control.CompilationFailedException {
                return super.run(IMPORTS + scriptText, fileName, args);
              };
            });
          }
    });
        console.run();
        if (args.length == 1) {
          console.loadScriptFile(new File(args[0]));
        }
  }
View Full Code Here


    public static Console openConsole(final Component parent, final ClientModel model, final String file) {
        try {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            Console console = new Console(parent.getClass().getClassLoader());
            console.setVariable("session", model.getClientSession().getSession());
            console.setVariable("binding", model.getClientSession().getSession().getBinding());

            console.run();

            JMenu cmisMenu = new JMenu("CMIS");
            console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);

            addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
                    "http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
                    new URI("http://chemistry.apache.org/java/opencmis.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Client API JavaDoc", new URI(
                    "http://chemistry.apache.org/java/0.4.0/maven/apidocs/"));

            console.getInputArea().setText(ClientHelper.readFileAndRemoveHeader(file));

            return console;
        } catch (Exception ex) {
            ClientHelper.showError(null, ex);
            return null;
View Full Code Here

                    Document doc = (Document) getClientModel().getCurrentObject();

                    String name = doc.getName().toLowerCase();
                    if (name.endsWith(".groovy")) {
                        File file = ClientHelper.createTempFileFromDocument(doc, null);
                        Console console = ClientHelper.openConsole(ObjectPanel.this, getClientModel(), null);
                        if (console != null) {
                            console.loadScriptFile(file);
                        }
                    } else {
                        ClientHelper.open(ObjectPanel.this, doc, null);
                    }
                } catch (Exception ex) {
View Full Code Here

    public static Console openConsole(final Component parent, final ClientModel model, final String file) {
        try {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            Console console = new Console(parent.getClass().getClassLoader());
            console.setVariable("session", model.getClientSession().getSession());
            console.setVariable("binding", model.getClientSession().getSession().getBinding());

            console.run();

            JMenu cmisMenu = new JMenu("CMIS");
            console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);

            addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
                    "http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
                    new URI("http://chemistry.apache.org/java/opencmis.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Client API JavaDoc", new URI(
                    "http://chemistry.apache.org/java/0.5.0/maven/apidocs/"));

            console.getInputArea().setText(ClientHelper.readFileAndRemoveHeader(file));

            return console;
        } catch (Exception ex) {
            ClientHelper.showError(null, ex);
            return null;
View Full Code Here

                    Document doc = (Document) getClientModel().getCurrentObject();

                    String name = doc.getName().toLowerCase();
                    if (name.endsWith(".groovy")) {
                        File file = ClientHelper.createTempFileFromDocument(doc, null);
                        Console console = ClientHelper.openConsole(ObjectPanel.this, getClientModel(), null);
                        if (console != null) {
                            console.loadScriptFile(file);
                        }
                    } else {
                        ClientHelper.open(ObjectPanel.this, doc, null);
                    }
                } catch (Exception ex) {
View Full Code Here

                    Document doc = (Document) getClientModel().getCurrentObject();

                    String name = doc.getName().toLowerCase();
                    if (name.endsWith(".groovy")) {
                        File file = ClientHelper.createTempFileFromDocument(doc, null);
                        Console console = ClientHelper.openConsole(ObjectPanel.this, getClientModel(), null);
                        if (console != null) {
                            console.loadScriptFile(file);
                        }
                    } else {
                        ClientHelper.open(ObjectPanel.this, doc, null);
                    }
                } catch (Exception ex) {
View Full Code Here

    public static Console openConsole(final Component parent, final ClientModel model, final String file) {
        try {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            Console console = new Console(parent.getClass().getClassLoader());
            console.setVariable("session", model.getClientSession().getSession());
            console.setVariable("binding", model.getClientSession().getSession().getBinding());

            console.run();

            JMenu cmisMenu = new JMenu("CMIS");
            console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);

            addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
                    "http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
                    new URI("http://chemistry.apache.org/java/opencmis.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Client API JavaDoc", new URI(
                    "http://chemistry.apache.org/java/0.7.0/maven/apidocs/"));

            console.getInputArea().setText(ClientHelper.readFileAndRemoveHeader(file));

            return console;
        } catch (Exception ex) {
            ClientHelper.showError(null, ex);
            return null;
View Full Code Here

      @Override
      public void run()
      {
        try
        {
          new Console(createBinding()).run();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
View Full Code Here

    public static Console openConsole(final Component parent, final ClientModel model, final String file) {
        try {
            parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            Console console = new Console(parent.getClass().getClassLoader());
            console.setVariable("session", model.getClientSession().getSession());
            console.setVariable("binding", model.getClientSession().getSession().getBinding());

            console.run();

            JMenu cmisMenu = new JMenu("CMIS");
            console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);

            addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
                    "http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Documentation",
                    new URI("http://chemistry.apache.org/java/opencmis.html"));
            addConsoleMenu(
                    cmisMenu,
                    "OpenCMIS Client API JavaDoc",
                    new URI(
                            "http://incubator.apache.org/chemistry/javadoc/org/apache/chemistry/opencmis/client/api/package-summary.html"));

            console.getInputArea().setText(ClientHelper.readFileAndRemoveHeader(file));

            return console;
        } catch (Exception ex) {
            ClientHelper.showError(null, ex);
            return null;
View Full Code Here

    private void openConsole(String file) {
        try {
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            Console console = new Console(this.getClass().getClassLoader());
            console.setVariable("session", model.getClientSession().getSession());
            console.setVariable("binding", model.getClientSession().getSession().getBinding());

            console.run();

            JMenu cmisMenu = new JMenu("CMIS");
            console.getFrame().getRootPane().getJMenuBar().add(cmisMenu);

            addConsoleMenu(cmisMenu, "CMIS 1.0 Specification", new URI(
                    "http://docs.oasis-open.org/cmis/CMIS/v1.0/os/cmis-spec-v1.0.html"));
            addConsoleMenu(cmisMenu, "OpenCMIS Documentation", new URI(
                    "http://incubator.apache.org/chemistry/opencmis.html"));
            addConsoleMenu(
                    cmisMenu,
                    "OpenCMIS Client API JavaDoc",
                    new URI(
                            "http://incubator.apache.org/chemistry/javadoc/org/apache/chemistry/opencmis/client/api/package-summary.html"));

            console.getInputArea().setText(ClientHelper.readFileAndRemoveHeader(file));
        } catch (Exception ex) {
            ClientHelper.showError(null, ex);
        } finally {
            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        }
View Full Code Here

TOP

Related Classes of groovy.ui.Console

Copyright © 2018 www.massapicom. 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.