Examples of IInterpreterManager


Examples of org.python.pydev.core.IInterpreterManager

     */
    public void initializeFrom(ILaunchConfiguration configuration) {

        try {
            String id = configuration.getType().getIdentifier();
            IInterpreterManager manager = null;
            if (Constants.ID_JYTHON_LAUNCH_CONFIGURATION_TYPE.equals(id)
                    || Constants.ID_JYTHON_UNITTEST_LAUNCH_CONFIGURATION_TYPE.equals(id)) {
                manager = PydevPlugin.getJythonInterpreterManager();

            } else if (Constants.ID_IRONPYTHON_LAUNCH_CONFIGURATION_TYPE.equals(id)
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

    throws Exception
  {
    ArrayList<HashMap<String,String>> results =
      new ArrayList<HashMap<String,String>>();

    IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager();
    IInterpreterInfo[] interpreters = manager.getInterpreterInfos();
    for (IInterpreterInfo interpreter : interpreters){
      HashMap<String,String> result = new HashMap<String,String>();
      results.add(result);
      result.put("name", interpreter.getName());
      result.put("version", interpreter.getVersion());
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

{
  @Override
  public Object execute(CommandLine commandLine)
    throws Exception
  {
    IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager();
    IInterpreterInfo[] existing = manager.getInterpreterInfos();
    HashSet<String> skip = new HashSet<String>();
    for (IInterpreterInfo info : existing){
      skip.add(info.getExecutableOrJar());
    }

    String path = commandLine.getValue(Options.PATH_OPTION);
    if (!skip.contains(path)){
      IInterpreterInfo info = manager.createInterpreterInfo(
          path, new NullProgressMonitor(), false);
      if (commandLine.hasOption(Options.NAME_OPTION)){
        info.setName(commandLine.getValue(Options.NAME_OPTION));
      }else{
        info.setName(FileUtils.getBaseName(path).replace(".exe", ""));
      }

      IInterpreterInfo[] updated = new IInterpreterInfo[existing.length + 1];
      System.arraycopy(existing, 0, updated, 0, existing.length);
      updated[updated.length - 1] = info;

      manager.setInfos(updated, skip, new NullProgressMonitor());
      return Services.getMessage("python.interpreter.added", path);
    }
    return Services.getMessage("python.interpreter.exists", path);
  }
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

{
  @Override
  public Object execute(CommandLine commandLine)
    throws Exception
  {
    IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager();
    IInterpreterInfo[] existing = manager.getInterpreterInfos();
    HashSet<String> skip = new HashSet<String>();
    for (IInterpreterInfo info : existing){
      skip.add(info.getExecutableOrJar());
    }

    String path = commandLine.getValue(Options.PATH_OPTION);
    if (skip.contains(path)){
      IInterpreterInfo[] updated = new IInterpreterInfo[existing.length - 1];
      int index = 0;
      for (IInterpreterInfo info : existing){
        if (info.getExecutableOrJar().equals(path)){
          continue;
        }
        updated[index++] = info;
      }
      manager.setInfos(updated, skip, new NullProgressMonitor());
      return Services.getMessage("python.interpreter.removed", path);
    }
    return Services.getMessage("python.interpreter.not.found", path);
  }
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

      throw new RuntimeException(
          Services.getMessage("python.missing.nature"));
    }

    IInterpreterInfo interpreter = null;
    IInterpreterManager manager = nature.getRelatedInterpreterManager();
    IInterpreterInfo[] existing = manager.getInterpreterInfos();
    for (IInterpreterInfo info : existing){
      if (info.getName().equals(interpreterNameOrPath) ||
          info.getExecutableOrJar().equals(interpreterNameOrPath))
      {
        interpreter = info;
        break;
      }
    }

    File path = new File(interpreterNameOrPath);
    if (interpreter == null && path.exists() && path.isFile()){
      HashSet<String> skip = new HashSet<String>();
      for (IInterpreterInfo info : existing){
        skip.add(info.getExecutableOrJar());
      }
      interpreter = manager.createInterpreterInfo(
          interpreterNameOrPath, new NullProgressMonitor(), false);
      interpreter.setName(FileUtils.getBaseName(interpreterNameOrPath));
      IInterpreterInfo[] updated = new IInterpreterInfo[existing.length + 1];
      System.arraycopy(existing, 0, updated, 0, existing.length);
      updated[updated.length - 1] = interpreter;
      manager.setInfos(updated, skip, new NullProgressMonitor());
    }else if (interpreter == null){
      throw new RuntimeException(Services.getMessage(
            "python.interpreter.not.found", interpreterNameOrPath));
    }
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

    desc.setNatureIds(modified.toArray(new String[modified.size()]));
    project.setDescription(desc, new NullProgressMonitor());

    String pythonPath = project.getFullPath().toString();
    String interpreter = cli.getOptionValue("interpreter");
    IInterpreterManager manager = PydevPlugin.getPythonInterpreterManager();
    IInterpreterInfo info = manager.getInterpreterInfo(interpreter, null);
    if (info == null){
      throw new RuntimeException("Python interpreter not found: " + interpreter);
    }

    // construct version from the interpreter chosen.
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

    /**
     * Creates the jython interpreter manager with the default jython jar location.
     */
    protected static void createJythonInterpreterManager(NullProgressMonitor monitor) {
        IInterpreterManager iMan = PydevPlugin.getJythonInterpreterManager(true);
        IInterpreterInfo interpreterInfo = iMan
                .createInterpreterInfo(TestDependent.JYTHON_JAR_LOCATION, monitor, false);
        iMan.setInfos(new IInterpreterInfo[] { interpreterInfo }, null, null);
    }
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

    /**
     * @return the default interpreter info for the current manager
     */
    protected InterpreterInfo getDefaultInterpreterInfo() {
        IInterpreterManager iMan = getInterpreterManager();
        InterpreterInfo info;
        try {
            info = (InterpreterInfo) iMan.getDefaultInterpreterInfo(false);
        } catch (MisconfigurationException e) {
            throw new RuntimeException(e);
        }
        return info;
    }
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

        //ok, the system manager must be there
        assertTrue(info.getModulesManager().getSize(true) > 0);

        //and it must be registered as the pydev interpreter manager
        IInterpreterManager iMan2 = getInterpreterManager();
        InterpreterInfo info2;
        try {
            info2 = (InterpreterInfo) iMan2.getDefaultInterpreterInfo(false);
        } catch (MisconfigurationException e) {
            throw new RuntimeException(e);
        }
        assertTrue(info2 == info);
View Full Code Here

Examples of org.python.pydev.core.IInterpreterManager

     * checks if the size of the system modules manager and the project moule manager are coherent
     * (we must have more modules in the system than in the project)
     */
    protected void checkSize() {
        try {
            IInterpreterManager iMan = getInterpreterManager();
            InterpreterInfo info = (InterpreterInfo) iMan.getDefaultInterpreterInfo(false);
            assertTrue(info.getModulesManager().getSize(true) > 0);

            int size = ((ASTManager) nature.getAstManager()).getSize();
            assertTrue("Interpreter size:" + info.getModulesManager().getSize(true)
                    + " should be smaller than project size:" + size + " "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.