Examples of PsiProject


Examples of org.mevenide.idea.psi.project.PsiProject

        super(pProject);
    }

    public PsiProject getPsiProject(final String pPomUrl) {
        boolean recreate = true;
        PsiProject psi = get(KEY, pPomUrl);

        if (psi != null) {
            final XmlFile xmlFile = psi.getXmlFile();
            final VirtualFile psiFile = xmlFile.getVirtualFile();
            if (psiFile != null) {
                final String psiUrl = psiFile.getUrl();
                recreate = !pPomUrl.equals(psiUrl);
            }
View Full Code Here

Examples of org.mevenide.idea.psi.project.PsiProject

                                             final String pPomUrl,
                                             final Artifact pArtifact) {
        //
        //get the pom PSI model
        //
        final PsiProject psi = PomModelManager.getInstance(pProject).getPsiProject(pPomUrl);
        if(psi == null)
            return false;

        final PsiDependencies deps = psi.getDependencies();

        //
        //iterate the pom dependencies and collect the artifacts that go in the classpath
        //ignoring everything that has a type that differs from "jar" (empty type is
        //ok, since the default is "jar")
        //
        final Artifact fullArtifact = pArtifact.getCompleteArtifact();
        for (int row = 0; row < deps.getRowCount(); row++) {
            final Artifact artifact = new Artifact();
            artifact.setGroupId(deps.getGroupId(row));
            artifact.setArtifactId(deps.getArtifactId(row));
            artifact.setType(deps.getType(row));
            artifact.setVersion(deps.getVersion(row));
            artifact.setExtension(deps.getExtension(row));
            if (artifact.getCompleteArtifact().equals(fullArtifact))
                return true;
        }

        //
        //if the pom extends another pom, aggregate it as well
        //
        final PsiProject parentPsi = psi.getParent();
        if (parentPsi != null) {
            final String path = parentPsi.getVirtualFile().getPath();
            final String url = "file://" + path;
            return isArtifactDeclared(pProject, url, pArtifact);
        }

        return false;
View Full Code Here

Examples of org.mevenide.idea.psi.project.PsiProject

    public static Artifact[] getPomClassPathArtifacts(final Project pProject,
                                                      final String pPomUrl) {
        //
        //get the pom PSI model
        //
        final PsiProject psi = PomModelManager.getInstance(pProject).getPsiProject(pPomUrl);
        if (psi == null)
            return new Artifact[0];
        final PsiDependencies deps = psi.getDependencies();

        //
        //iterate the pom dependencies and collect the artifacts that go in the classpath
        //ignoring everything that has a type that differs from "jar" (empty type is
        //ok, since the default is "jar")
        //
        final Set<Artifact> artifacts = new HashSet<Artifact>(deps.getRowCount());
        for (int row = 0; row < deps.getRowCount(); row++) {
            final String type = deps.getType(row);
            if (type != null && !"jar".equalsIgnoreCase(type))
                continue;

            final Artifact artifact = new Artifact();
            artifact.setGroupId(deps.getGroupId(row));
            artifact.setArtifactId(deps.getArtifactId(row));
            artifact.setType(type);
            artifact.setVersion(deps.getVersion(row));
            artifact.setExtension(deps.getExtension(row));
            artifacts.add(artifact);
        }

        //
        //if the pom extends another pom, aggregate it as well
        //
        final PsiProject parentPsi = psi.getParent();
        if (parentPsi != null) {
            final String path = parentPsi.getVirtualFile().getPath();
            final String url = "file://" + path;
            final Artifact[] parentDeps = getPomClassPathArtifacts(pProject, url);
            if (parentDeps != null && parentDeps.length > 0)
                for (Artifact parentDepFile : parentDeps)
                    artifacts.add(parentDepFile);
View Full Code Here

Examples of org.mevenide.idea.psi.project.PsiProject

    }

    public void actionPerformed(final AnActionEvent pEvent) {
        final Project project = problem.getProject();
        final PomModelManager modelMgr = PomModelManager.getInstance(project);
        final PsiProject psi = modelMgr.getPsiProject(problem.getPomUrl());
        if(psi == null)
            return;
       
        final PsiDependencies deps = psi.getDependencies();
        final int row = deps.findRow(problem.getArtifact());
        if (row >= 0)
            deps.deleteRows(row);
    }
View Full Code Here

Examples of org.mevenide.idea.psi.project.PsiProject

        String extension = problem.getFile().getExtension();
        if (extension == null || extension.equalsIgnoreCase(type))
            extension = null;

        final PomModelManager modelMgr = PomModelManager.getInstance(problem.getProject());
        final PsiProject psi = modelMgr.getPsiProject(problem.getPomUrl());
        if(psi == null)
            return;
       
        final PsiDependencies deps = psi.getDependencies();
        final int row = deps.appendRow();
        deps.setGroupId(row, groupId);
        deps.setArtifactId(row, artifactId);
        deps.setType(row, type);
        deps.setVersion(row, version);
View Full Code Here

Examples of org.mevenide.idea.psi.project.PsiProject

                String text = PathUtil.toPresentableUrl(url);

                if (pomMgr.isValid(url)) {
                    final PomModelManager modelMgr = PomModelManager.getInstance(project);
                    final PsiProject psi = modelMgr.getPsiProject(url);
                    if (psi != null) {
                        final String name = psi.getName();
                        if (name == null || name.trim().length() == 0) {
                            final String groupId = psi.getGroupId();
                            final String artifactId = psi.getArtifactId();
                            if (groupId != null && groupId.trim().length() > 0 && artifactId != null && artifactId.trim().length() > 0)
                                text = groupId + ":" + artifactId;
                        }
                        else
                            text = name;
View Full Code Here

Examples of org.mevenide.idea.psi.project.PsiProject

                                                 "Please select the project you wish to add the dependency for:");
        if (pomUrl == null || pomUrl.trim().length() == 0)
            return;

        final PomModelManager modelMgr = PomModelManager.getInstance(project);
        final PsiProject psi = modelMgr.getPsiProject(pomUrl);
        final PsiDependencies deps = psi.getDependencies();
        final RepoPathElement[] artifacts = getSelectedItems(RepoPathElement.LEVEL_VERSION);
        for (RepoPathElement pathElement : artifacts) {
            final int row = deps.appendRow();
            deps.setGroupId(row, pathElement.getGroupId());
            deps.setArtifactId(row, pathElement.getArtifactId());
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.