Package org.apache.ivyde.eclipse.cpcontainer

Examples of org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer


    public void setFocus() {
    }

    public void selectionChanged(IWorkbenchPart part, ISelection sel) {
        if (sel instanceof IStructuredSelection) {
            IvyClasspathContainer ivycp = IvyClasspathUtil
                    .getIvyClasspathContainer((IStructuredSelection) sel);
            if (ivycp != null) {
                browser.setUrl("");
                URL report;
                try {
                    report = ivycp.getReportUrl();
                } catch (IvyDEException e) {
                    e.log(IStatus.WARNING, "Impossible show the report for " + ivycp.getConf());
                    e.show(IStatus.WARNING, "Show Ivy report failure",
                        "Impossible show the report for " + ivycp.getConf());
                    return;
                }
                if (!browser.setUrl(report.toExternalForm())) {
                    browser.setUrl("");
                    Message.warn("impossible to set report view url to " + report.toExternalForm());
View Full Code Here


    }

    private void triggerResolve() {
        IFile file = ((IvyFileEditorInput) getEditorInput()).getFile();
        IJavaProject project = JavaCore.create(file.getProject());
        IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(project);
        if (cp != null
                && cp.getConf().getIvyXmlPath().equals(file.getProjectRelativePath().toString())) {
            cp.launchResolve(false, true, null);
        }
    }
View Full Code Here

     */
    public void doSave(IProgressMonitor monitor) {
        xmlEditor.doSave(monitor);
        IFile file = ((IvyFileEditorInput) getEditorInput()).getFile();
        IJavaProject project = JavaCore.create(file.getProject());
        IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(project);
        if (cp != null
                && cp.getConf().getInheritedIvySettingsPath().equals(
                    file.getProjectRelativePath().toString())) {
            cp.launchResolve(false, true, null);
        }
    }
View Full Code Here

        IFile file = ((IvyFileEditorInput) getEditorInput()).getFile();
        List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
                .getIvySettingsClasspathContainers(file);
        Iterator/* <IvyClasspathContainer> */itContainers = containers.iterator();
        while (itContainers.hasNext()) {
            IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainers.next();
            ivycp.launchResolve(false, true, null);
        }
    }
View Full Code Here

public abstract class IvyDEContainerAction implements IActionDelegate {

    public void selectionChanged(IAction action, ISelection s) {
        if (s instanceof IStructuredSelection) {
            IStructuredSelection selection = (IStructuredSelection) s;
            IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(selection);
            if (cp != null) {
                action.setEnabled(true);
                selectionChanged(action, cp);
                return;
            }
View Full Code Here

        // nothing to do
    }

    public void selectionChanged(IWorkbenchPart part, ISelection sel) {
        if (sel instanceof IStructuredSelection) {
            IvyClasspathContainer ivycp = IvyClasspathUtil
                    .getIvyClasspathContainer((IStructuredSelection) sel);
            if (ivycp != null) {
                browser.setUrl("");
                URL report;
                try {
                    report = ivycp.getReportUrl();
                } catch (IvyDEException e) {
                    e.log(IStatus.WARNING, "Impossible show the report for " + ivycp.getConf());
                    e.show(IStatus.WARNING, "Show Ivy report failure",
                        "Impossible show the report for " + ivycp.getConf());
                    return;
                }
                if (!browser.setUrl(report.toExternalForm())) {
                    browser.setUrl("");
                    Message.warn("impossible to set report view url to " + report.toExternalForm());
View Full Code Here

        containerPage.finish();
        IClasspathEntry newEntry = containerPage.getSelection();
        IPath path = newEntry.getPath();
        IJavaProject project = containerPage.getProject();
        try {
            IvyClasspathContainer ivycp = new IvyClasspathContainer(project, path,
                    new IClasspathEntry[0], new IClasspathAttribute[0]);
            JavaCore.setClasspathContainer(path, new IJavaProject[] {project},
                new IClasspathContainer[] {ivycp}, null);
            IClasspathEntry[] entries = project.getRawClasspath();
            List newEntries = new ArrayList(Arrays.asList(entries));
            newEntries.add(newEntry);
            entries = (IClasspathEntry[]) newEntries
                    .toArray(new IClasspathEntry[newEntries.size()]);
            project.setRawClasspath(entries, project.getOutputLocation(), null);
            ivycp.launchResolve(false, true, null);
        } catch (JavaModelException e) {
            IvyPlugin.log(e);
            return false;
        }
        return true;
View Full Code Here

        for (int i = 0; i < projects.length; i++) {
            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
                    .getIvyClasspathContainers(projects[i]);
            Iterator/* <IvyClasspathContainer> */itContainers = containers.iterator();
            while (itContainers.hasNext()) {
                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainers.next();
                if (!ivycp.getConf().isSettingsProjectSpecific()) {
                    ivycp.launchResolve(false, false, null);
                }
            }
        }
    }
View Full Code Here

            String message = "Could not resolve classpath container: " + entry.getPath().toString();
            throw new CoreException(new Status(IStatus.ERROR, IvyPlugin.ID,
                    IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR, message, null));
            // execution will not reach here - exception will be thrown
        }
        IvyClasspathContainer ivycp = (IvyClasspathContainer) container;
        if (ivycp.getConf().isInheritedResolveBeforeLaunch()) {
            IStatus status = ivycp.launchResolve(false, false, new NullProgressMonitor());
            if (status.getCode() != IStatus.OK) {
                throw new CoreException(status);
            }
        }
        IClasspathEntry[] cpes = container.getClasspathEntries();
View Full Code Here

        MultiStatus errorStatuses = new MultiStatus(IvyPlugin.ID, IStatus.ERROR,
                "Failed to update one or more Ivy files.  See details.", null);

        IvyClasspathContainer[] containers = getIvyClasspathContainers();
        for (int i = 0; i < containers.length; i++) {
            IvyClasspathContainer container = containers[i];

            ModuleDescriptor moduleDescriptor;
            try {
                moduleDescriptor = container.getState().getModuleDescriptor();
            } catch (IvyDEException e) {
                errorStatuses
                        .add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
                                "Failed to get module descriptor at "
                                        + container.getConf().getIvyXmlPath(), e));
                continue;
            }

            Map/* <ModuleRevisionId, String> */newRevisions = new HashMap();

            DependencyDescriptor[] dependencies = moduleDescriptor.getDependencies();
            for (int j = 0; j < dependencies.length; j++) {
                for (int k = 0; k < multiRevisionDependencies.length; k++) {
                    MultiRevisionDependencyDescriptor multiRevision = multiRevisionDependencies[k];
                    ModuleRevisionId dependencyRevisionId = dependencies[j]
                            .getDependencyRevisionId();
                    if (dependencies[j].getDependencyId().equals(multiRevision.getModuleId())
                            && multiRevision.hasNewRevision()
                            && multiRevision.isForContainer(container)) {
                        newRevisions.put(dependencyRevisionId, multiRevisionDependencies[k]
                                .getNewRevision());
                        break; // move on to the next dependency
                    }
                }
            }
           
            UpdateOptions updateOptions = new UpdateOptions()
                .setResolvedRevisions(newRevisions)
                .setReplaceInclude(false)
                .setGenerateRevConstraint(false)
                .setNamespace(new RevisionPreservingNamespace());
            File ivyFile = container.getState().getIvyFile();
           
            File ivyTempFile = new File(ivyFile.toString() + ".temp");
            try {
                XmlModuleDescriptorUpdater.update(ivyFile.toURI().toURL(), ivyTempFile,
                    updateOptions);
                saveChanges(container, ivyFile, ivyTempFile);
            } catch (MalformedURLException e) {
                errorStatuses.add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
                        "Failed to write Ivy file " + container.getState().getIvyFile().getPath()
                                + " (malformed URL)", e));
            } catch (IOException e) {
                errorStatuses.add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
                        "Failed to write Ivy file " + container.getState().getIvyFile().getPath(),
                        e));
            } catch (SAXException e) {
                errorStatuses.add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
                    "Failed to write Ivy file " + container.getState().getIvyFile().getPath(),
                    e));
            } finally {
                ivyTempFile.delete();
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer

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.