Package org.python.pydev.core

Examples of org.python.pydev.core.IPythonPathNature


     *
     * @return source path to project
     * @throws CoreException threw if something wrong
     */
    private String getPythonPath() throws CoreException {
        IPythonPathNature pythonPathNature = PythonNature.getPythonPathNature(project);
        String pyPath = extractSourcePathFromPyProject(pythonPathNature, project);
        pyPath = addReferencedJavaProjects(pyPath);

        if (isDebug) {

View Full Code Here


        IContainer container = CustomizationCommons.getContainerFromObject(receiver);
        if (container == null) {
            return false;
        }

        IPythonPathNature nature = CustomizationCommons.getPythonPathNatureFromObject(receiver);
        if (nature == null) {
            return false;
        }

        //dev_appserver.py [options] <application root>
        //
        //Application root must be the path to the application to run in this server.
        //Must contain a valid app.yaml or app.yml file.
        IFile file = container.getFile(new Path("app.yaml"));
        if (file == null || !file.exists()) {
            file = container.getFile(new Path("app.yml"));
            if (file == null || !file.exists()) {
                return false;
            }
        }

        try {
            Map<String, String> variableSubstitution = nature.getVariableSubstitution();
            //Only consider a google app engine a project that has a google app engine variable!
            if (variableSubstitution != null
                    && variableSubstitution.containsKey(AppEngineConstants.GOOGLE_APP_ENGINE_VARIABLE)) {
                return true;
            }
View Full Code Here

     *
     * Considers as available for being a django project if there's a DJANGO_MANAGE_LOCATION variable
     * defined.
     */
    public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
        IPythonPathNature nature = CustomizationCommons.getPythonPathNatureFromObject(receiver);
        if (nature == null) {
            return false;
        }

        try {
            Map<String, String> variableSubstitution = nature.getVariableSubstitution();
            //Only consider a django project if a django_manage_variable is defined
            if (variableSubstitution != null
                    && variableSubstitution.containsKey(DjangoConstants.DJANGO_MANAGE_VARIABLE)) {
                return true;
            }
View Full Code Here

        GridData gd = new GridData(GridData.FILL_BOTH);
        topComp.setLayoutData(gd);

        if (project != null) {
            try {
                IPythonPathNature pathNature = PythonNature.getPythonPathNature(project);
                final PythonNature nature = PythonNature.getPythonNature(project);

                Map<String, String> variableSubstitution = pathNature.getVariableSubstitution(false);

                Label label = new Label(topComp, SWT.None);
                label.setText("Django manage.py");

                Text text = new Text(topComp, SWT.BORDER);
View Full Code Here

     * Saves values.
     */
    public boolean performOk() {

        try {
            IPythonPathNature pythonPathNature = PythonNature.getPythonPathNature(project);
            Map<String, String> variableSubstitution = pythonPathNature.getVariableSubstitution(false);

            boolean changed = update(DjangoConstants.DJANGO_MANAGE_VARIABLE, variableSubstitution,
                    textDjangoManage.getText(), pythonPathNature);

            changed = update(DjangoConstants.DJANGO_SETTINGS_MODULE, variableSubstitution,
                    textDjangoSettings.getText(), pythonPathNature) || changed;

            if (changed) {
                pythonPathNature.setVariableSubstitution(variableSubstitution);
                PythonNature pythonNature = PythonNature.getPythonNature(project);

                if (pythonNature != null && (changed || pythonNature.getAstManager() == null)) {
                    pythonNature.rebuildPath();
                }
View Full Code Here

        gd.horizontalSpan = 1;
        tabFolder.setLayoutData(gd);

        if (project != null) {
            try {
                IPythonPathNature nature = PythonNature.getPythonPathNature(project);

                createTabProjectSourceFolders(nature.getProjectSourcePath(false));
                createTabExternalSourceFolders(nature.getProjectExternalSourcePath(false));
                tabVariables = new TabVariables(tabFolder, nature.getVariableSubstitution(false));

                createRestoreButton(topComp);
            } catch (Exception e) {
                Log.log(e);
            }
View Full Code Here

     */
    private boolean doIt(boolean force) {
        if (project != null) {
            try {
                boolean changed = false;
                IPythonPathNature pythonPathNature = PythonNature.getPythonPathNature(project);

                String sourcePath = pythonPathNature.getProjectSourcePath(false);
                String externalSourcePath = pythonPathNature.getProjectExternalSourcePath(false);
                Map<String, String> variableSubstitution = pythonPathNature.getVariableSubstitution(false);

                String newSourcePath = StringUtils.leftAndRightTrim(treeSourceFolders.getTreeItemsAsStr(), '|');
                String newExternalSourcePath = StringUtils.leftAndRightTrim(treeExternalLibs.getTreeItemsAsStr(), '|');
                Map<String, String> newVariableSubstitution = tabVariables.getTreeItemsAsMap();

                if (checkIfShouldBeSet(sourcePath, newSourcePath)) {
                    pythonPathNature.setProjectSourcePath(newSourcePath);
                    changed = true;
                }

                if (checkIfShouldBeSet(externalSourcePath, newExternalSourcePath)) {
                    pythonPathNature.setProjectExternalSourcePath(newExternalSourcePath);
                    changed = true;
                }

                if (checkIfShouldBeSet(variableSubstitution, newVariableSubstitution)) {
                    pythonPathNature.setVariableSubstitution(newVariableSubstitution);
                    changed = true;
                }

                PythonNature pythonNature = PythonNature.getPythonNature(project);
                if (pythonNature != null && (changed || force || pythonNature.getAstManager() == null)) {
View Full Code Here

        }

        externalLibs = new InterpreterInfoTreeNode<LabelAndImage>(root, new LabelAndImage("External Libs",
                imageCache.get(UIConstants.LIB_SYSTEM_ROOT)));

        IPythonPathNature pythonPathNature = nature.getPythonPathNature();
        try {
            List<String> projectExternalSourcePath = pythonPathNature.getProjectExternalSourcePathAsList(true);
            Collections.sort(projectExternalSourcePath);
            for (String string : projectExternalSourcePath) {
                File f = new File(string);
                new PythonpathTreeNode(externalLibs, f, imageCache.get(UIConstants.LIB_SYSTEM), true);
            }
View Full Code Here

        IContainer container = CustomizationCommons.getContainerFromObject(firstElement);
        if (container == null) {
            return null;
        }

        IPythonPathNature pythonPathNature = CustomizationCommons.getPythonPathNatureFromObject(firstElement);
        if (pythonPathNature == null) {
            return null;
        }

        Map<String, String> variableSubstitution;
        try {
            variableSubstitution = pythonPathNature.getVariableSubstitution();
            //Only consider a google app engine a project that has a google app engine variable!
            if (variableSubstitution == null
                    || !variableSubstitution.containsKey(AppEngineConstants.GOOGLE_APP_ENGINE_VARIABLE)) {
                return null;
            }
View Full Code Here

        }

        List<String> paths;

        //if we have a project, get its complete pythonpath
        IPythonPathNature pythonPathNature = pythonNature.getPythonPathNature();
        if (pythonPathNature == null) {
            IProject project = pythonNature.getProject();
            String projectName;
            if (project == null) {
                projectName = "null?";
            } else {
                projectName = project.getName();
            }
            throw new RuntimeException("The project " + projectName + " does not have the pythonpath configured, \n"
                    + "please configure it correcly (please check the pydev getting started guide at \n"
                    + "http://pydev.org/manual_101_root.html for better information on how to do it).");
        }
        paths = pythonPathNature.getCompleteProjectPythonPath(interpreter, manager);

        return makePythonPathEnvFromPaths(paths);
    }
View Full Code Here

TOP

Related Classes of org.python.pydev.core.IPythonPathNature

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.