Package org.python.pydev.plugin.nature

Examples of org.python.pydev.plugin.nature.PythonNature


    throws Exception
  {
    String file = commandLine.getValue(Options.FILE_OPTION);
    String projectName = commandLine.getValue(Options.PROJECT_OPTION);
    IProject project = ProjectUtils.getProject(projectName);
    PythonNature nature = PythonNature.getPythonNature(project);

    // only refresh the file.
    if(!commandLine.hasOption(Options.VALIDATE_OPTION) || nature == null){
      // getting the file will refresh it.
      ProjectUtils.getFile(project, file);

    // validate the src file.
    }else{
      String filePath = ProjectUtils.getFilePath(project, file);
      String moduleName = nature.resolveModule(filePath);

      IDocument document = ProjectUtils.getDocument(project, file);
      // NOTE: checkForPath is false to support python files w/ file extenstion
      // != .py (like twisted .tac files for example)
      SourceModule module = (SourceModule)AbstractModule.createModuleFromDoc(
View Full Code Here


  public Object execute(CommandLine commandLine)
    throws Exception
  {
    String projectName = commandLine.getValue(Options.PROJECT_OPTION);
    IProject project = ProjectUtils.getProject(projectName);
    PythonNature nature = PythonNature.getPythonNature(project);
    IInterpreterInfo interpreter = nature.getProjectInterpreter();
    if (interpreter != null){
      return interpreter.getExecutableOrJar();
    }
    return null;
  }
View Full Code Here

  @Override
  public List<Error> update(IProject project, CommandLine commandLine)
    throws Exception
  {
    PythonNature nature = PythonNature.getPythonNature(project);
    // force a reload of .pydevproject
    nature.setProject(project);

    // call refresh to ensure the project interpreter is validated properly
    refresh(project, commandLine);

    String dotPydevProject = project.getFile(PYDEVPROJECT)
      .getRawLocation().toOSString();
    FileOffsets offsets = FileOffsets.compile(dotPydevProject);
    String contents = IOUtils.toString(new FileInputStream(dotPydevProject));

    Tuple<List<ProjectConfigError>, IInterpreterInfo> configErrorsAndInfo =
      nature.getConfigErrorsAndInfo(project);
    ArrayList<Error> errors = new ArrayList<Error>();
    for (ProjectConfigError e : configErrorsAndInfo.o1){
      String message = e.getLabel();
      int line = 1;
      int col = 1;
View Full Code Here

  @Override
  public void refresh(IProject project, CommandLine commandLine)
    throws Exception
  {
    PythonNature pythonNature = PythonNature.getPythonNature(project);
    pythonNature.rebuildPath();
  }
View Full Code Here

    }

    @Override
    protected PythonNature createNature() {
        return new PythonNature() {
            @Override
            public int getInterpreterType() throws CoreException {
                return IInterpreterManager.INTERPRETER_TYPE_PYTHON;
            }
View Full Code Here

    }

    @Override
    protected PythonNature createNature() {
        return new PythonNature() {
            @Override
            public int getInterpreterType() throws CoreException {
                return IInterpreterManager.INTERPRETER_TYPE_PYTHON;
            }
View Full Code Here

     * @param path the pythonpath for the new nature
     * @param name the name for the project
     * @return true if the creation was needed and false if it wasn't
     */
    protected boolean restoreProjectPythonPath(boolean force, String path, String name) {
        PythonNature n = checkNewNature(name, force);
        if (n != null) {
            nature = n;
            ProjectStub projectStub = new ProjectStub(name, path, new IProject[0], new IProject[0]);

            setAstManager(path, projectStub, nature);
View Full Code Here

     * @param path the pythonpath for the new nature
     * @param name the name for the project
     * @return true if the creation was needed and false if it wasn't
     */
    protected boolean restoreProjectPythonPath2(boolean force, String path, String name) {
        PythonNature n = checkNewNature(name, force);
        if (n != null) {
            nature2 = n;

            ProjectStub projectFromNature1 = (ProjectStub) nature.getProject();
            //create a new project referencing the first one
View Full Code Here

    /**
     * @return a PythonNature that is regarded as a python nature with the latest grammar.
     */
    public static PythonNature createStaticNature() {
        return new PythonNature() {
            @Override
            public int getInterpreterType() throws CoreException {
                return IInterpreterManager.INTERPRETER_TYPE_PYTHON;
            }

View Full Code Here

        assertTrue(foundRtJar);
    }

    @Override
    protected PythonNature createNature() {
        return new PythonNature() {
            @Override
            public int getInterpreterType() throws CoreException {
                return IInterpreterManager.INTERPRETER_TYPE_JYTHON;
            }
View Full Code Here

TOP

Related Classes of org.python.pydev.plugin.nature.PythonNature

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.