Package org.epic.core.util

Examples of org.epic.core.util.PerlExecutor


        final String ERROR_TITLE = "Missing Perl interpreter";
        final String ERROR_MSG =
            "To operate correctly, EPIC requires a Perl interpreter. " +
            "Check your configuration settings (\"Window/Preferences/Perl EPIC\").";

        PerlExecutor executor = new PerlExecutor();
        try
        {
            List args = new ArrayList(1);
            args.add("-v");
            if (executor.execute(new File("."), args, "")
                .stdout.indexOf("This is perl") != -1)
            {
                requirePerlCheckPassed = true;
            }
            else
            {
                Status status = new Status(
                    IStatus.ERROR,
                    getPluginId(),
                    IStatus.OK,
                    "The executable specified in EPIC Preferences " +
                    "does not appear to be a valid Perl interpreter.",
                    null);

                getLog().log(status);
                if (!requirePerlErrorDisplayed || interactive)
                {
                    requirePerlErrorDisplayed = true;
                    showErrorDialog(ERROR_TITLE, ERROR_MSG, status);
                }
                requirePerlCheckPassed = false;
            }
        }
        catch (CoreException e)
        {
            getLog().log(e.getStatus());
            if (!requirePerlErrorDisplayed || interactive)
            {
                requirePerlErrorDisplayed = true;
                showErrorDialog(ERROR_TITLE, ERROR_MSG, e.getStatus());
            }
            requirePerlCheckPassed = false;
        }
        finally { executor.dispose(); }
    }
View Full Code Here


    }

    private static List runHelperScript(String scriptName, List scriptArgs)
        throws CoreException
    {
        PerlExecutor executor = new PerlExecutor();
        try
        {
            File scriptFile = PerlDebugPlugin.getDefault().extractTempFile(
                scriptName, null);
            List args = new ArrayList(1);
            args.add(scriptFile.getAbsolutePath());
            args.addAll(scriptArgs);
            return executor.execute(scriptFile.getParentFile(), args, "")
                .getStdoutLines();
        }
        catch (IOException e)
        {
            throw new CoreException(new Status(IStatus.ERROR, PerlDebugPlugin
                .getUniqueIdentifier(), IStatus.OK,
                "extractTempFile failed on " + scriptName, e));
        }
        finally
        {
            executor.dispose();
        }
    }
View Full Code Here

     *         seen by the Perl interpreter when executing scripts from
     *         this project, a superset of those returned by {@link #getIncPath}
     */
    public List getEffectiveIncPath() throws CoreException
    {
        PerlExecutor executor = new PerlExecutor();
       
        try
        {
            final String perlCode = "foreach $i(@INC) { print \"$i\n\"; }\n";
            List lines = executor.execute(
                this,
                Collections.EMPTY_LIST,
                perlCode).getStdoutLines();
           
            return makeAbsIncPath(
                (String[]) lines.toArray(new String[lines.size()]));
        }
        finally
        {
            executor.dispose();
        }
    }
View Full Code Here

{
    private static PerlValidator instance;   
   
    private PerlValidator()
    {
        super(PerlEditorPlugin.getDefault().getLog(), new PerlExecutor(true));
    }
View Full Code Here

        + option
        + " \""
        + searchText
        + "\"');";
       
        PerlExecutor executor = new PerlExecutor();
        try
        {
          // If the PerlDoc search method is not called from an editor the textEditor object is null.
          // In this case the execute method is called with the current directory as argument.
          if(textEditor != null) {
            return executor.execute(textEditor, null, perlCode).stdout;
          }
          else {
            try {
          return executor.execute(new File(new File(".").getCanonicalPath()), null, perlCode).stdout;
        } catch (Exception e) {
          e.printStackTrace();
          return "";
        }
          }
        }
        finally { executor.dispose(); }
  }   
View Full Code Here

                return;
            }
            initializing = true;
        }

        PerlExecutor executor = new PerlExecutor();
        try
        {
            List names =
                executor.execute(textEditor, null, perlCode).getStdoutLines();
            moduleNames = (String[]) names.toArray(new String[names.size()]);
        }
        finally {
            executor.dispose();
            initializing = false;
        }
  }
View Full Code Here

        + "       $proposals{$name.'()'} = 1;\n"
        + "   }\n"
        + "}}\n"
                + "print join(\"\\n\", sort keys %proposals);";

        PerlExecutor executor = new PerlExecutor();
    try
        {
            return executor.execute(fTextEditor, null, perlCode).getStdoutLines();
        }
        catch (CoreException e)
        {
            PerlEditorPlugin.getDefault().getLog().log(e.getStatus());
            return new ArrayList();
        }
        finally
        {
            executor.dispose();
        }
  }
View Full Code Here

TOP

Related Classes of org.epic.core.util.PerlExecutor

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.