Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResourceDelta


    }

    public void resourceChanged(IResourceChangeEvent event) {
        IResource myResource = ResourceUtil.getResource(getEditorInput());

        IResourceDelta delta = event.getDelta();
        if (delta == null)
            return;

        IPath fullPath = myResource.getFullPath();
        delta = delta.findMember(fullPath);
        if (delta == null)
            return;

        if (delta.getKind() == IResourceDelta.REMOVED) {
            close(false);
        } else if (delta.getKind() == IResourceDelta.CHANGED) {
            updateContent(getEditorInput());
        }
    }
View Full Code Here


public class NewProjectResourceListener implements IResourceChangeListener {
    private static final ILogger logger = Logger.getLogger(NewProjectResourceListener.class);

    public void resourceChanged(IResourceChangeEvent event) {
        IResourceDelta delta = event.getDelta();
        if (delta == null)
            return;

        final List<IProject> newProjects = new LinkedList<IProject>();
        try {
            delta.accept(new IResourceDeltaVisitor() {
                public boolean visit(IResourceDelta delta) throws CoreException {
                    if (delta.getFlags() == IResourceDelta.MARKERS)
                        return false; // ignore marker-only deltas.

                    IResource resource = delta.getResource();
                    if (resource.getType() == IResource.ROOT)
                        return true;

                    if (resource.getType() == IResource.PROJECT) {
                        IProject project = (IProject) resource;
                        if (project.isOpen() && project.hasNature(BndtoolsConstants.NATURE_ID) && ((delta.getKind() & IResourceDelta.ADDED) != 0)) {
                            newProjects.add(project);
                        }
                    }

                    return false;
View Full Code Here

                return null;
            }

            IFile buildFile = project.getFolder(targetDir.getName()).getFile(Workspace.BUILDFILES);
            IPath buildFilePath = buildFile.getProjectRelativePath();
            IResourceDelta delta = getDelta(project);

            if (delta == null) {
                // May have changed
                log(LOG_FULL, "null delta in dependency project %s", dep.getName());
                return dep;
            } else if (!isChangeDelta(delta)) {
                continue;
            } else {
                IResourceDelta buildFileDelta = delta.findMember(buildFilePath);
                if (buildFileDelta != null && isChangeDelta(buildFileDelta)) {
                    log(LOG_FULL, "detected change due to file %s, kind=0x%x, flags=0x%x", buildFile, delta.getKind(), delta.getFlags());
                    return dep;
                }
            }
View Full Code Here

        final Set<File> changedFiles = new HashSet<File>();

        final Set<File> targetJars = findJarsInTarget();

        boolean force = forceBuild;
        IResourceDelta delta;

        ProjectDeltaVisitor deltaVisitor = new ProjectDeltaVisitor(getProject(), changedFiles);

        // Get delta on local project
        delta = getDelta(getProject());
        if (delta != null) {
            delta.accept(deltaVisitor);

            log(LOG_FULL, "%d files in local project (outside target) changed or removed: %s, forced=%s", changedFiles.size(), changedFiles, deltaVisitor.force);

            if (deltaVisitor.force || changedFiles.size() > 0) {
                log(LOG_FULL, "Project changed: files=%s, force = %s", changedFiles, deltaVisitor.force);
                force = true;
            }
        } else {
            log(LOG_BASIC, "no info on local changes, doing a full build");
            force = true;
        }

        if (!force) {
            // Get deltas on dependency projects
            for (IProject depProject : dependsOn) {
                delta = getDelta(depProject);
                if (delta != null) {
                    Set<File> changedByProject = new HashSet<File>();
                    ProjectDeltaVisitor depVisitor = new ProjectDeltaVisitor(depProject, changedByProject);
                    delta.accept(depVisitor);

                    changedFiles.addAll(changedByProject);

                    //
                    // If the visitor detected a project that we depend on
View Full Code Here

        if (cnfProject == null) {
            logger.logError("Bnd configuration project (cnf) is not available in the Eclipse workspace.", null);
            return false;
        }

        IResourceDelta cnfDelta = getDelta(cnfProject);
        if (cnfDelta == null) {
            log(LOG_FULL, "no delta available for cnf project, ignoring");
            return false;
        }

        final AtomicBoolean result = new AtomicBoolean(false);
        cnfDelta.accept(new IResourceDeltaVisitor() {
            public boolean visit(IResourceDelta delta) throws CoreException {
                if (!isChangeDelta(delta))
                    return false;

                if (IResourceDelta.MARKERS == delta.getFlags())
View Full Code Here

        return result.get();
    }

    private boolean isLocalBndFileChange() throws CoreException {
        IResourceDelta myDelta = getDelta(getProject());
        if (myDelta == null) {
            log(LOG_BASIC, "local project delta is null, assuming changes exist", model.getName());
            return true;
        }

        final AtomicBoolean result = new AtomicBoolean(false);
        myDelta.accept(new IResourceDeltaVisitor() {
            public boolean visit(IResourceDelta delta) throws CoreException {
                if (!isChangeDelta(delta))
                    return false;

                IResource resource = delta.getResource();
View Full Code Here

                return null;
            }

            IFile buildFile = project.getFolder(targetDir.getName()).getFile(Workspace.BUILDFILES);
            IPath buildFilePath = buildFile.getProjectRelativePath();
            IResourceDelta delta = getDelta(project);

            if (delta == null) {
                // May have changed
                log(LOG_FULL, "null delta in dependency project %s", dep.getName());
                return dep;
            } else if (!isChangeDelta(delta)) {
                continue;
            } else {
                IResourceDelta buildFileDelta = delta.findMember(buildFilePath);
                if (buildFileDelta != null && isChangeDelta(buildFileDelta)) {
                    log(LOG_FULL, "detected change due to file %s, kind=0x%x, flags=0x%x", buildFile, delta.getKind(), delta.getFlags());
                    return dep;
                }
            }
View Full Code Here

        final Set<File> changedFiles = new HashSet<File>();

        final Set<File> targetJars = findJarsInTarget();

        boolean force = forceBuild;
        IResourceDelta delta;

        IResourceDeltaVisitor deltaVisitor = new ProjectDeltaVisitor(getProject(), changedFiles);

        // Get delta on local project
        delta = getDelta(getProject());
        if (delta != null) {
            log(LOG_FULL, "%d files in local project (outside target) changed or removed: %s", changedFiles.size(), changedFiles);
            delta.accept(deltaVisitor);
        } else {
            log(LOG_BASIC, "no info on local changes available");
        }

        // Get deltas on dependency projects
        for (IProject depProject : dependsOn) {
            delta = getDelta(depProject);
            if (delta != null) {
                IResourceDeltaVisitor depVisitor = new ProjectDeltaVisitor(depProject, changedFiles);
                delta.accept(depVisitor);
                log(LOG_FULL, "%d files in dependency project '%s' changed or removed: %s", changedFiles.size(), depProject.getName(), changedFiles);
            } else {
                log(LOG_BASIC, "no info available on changes from project '%s'", depProject.getName());
            }
        }
View Full Code Here

                try {
                    final AtomicBoolean update = new AtomicBoolean(false);

                    // Was the properties file (bnd.bnd or *.bndrun) included in
                    // the delta?
                    IResourceDelta propsDelta = event.getDelta().findMember(bndbndPath);
                    if (propsDelta == null && targetResource.getType() == IResource.FILE)
                        propsDelta = event.getDelta().findMember(targetResource.getFullPath());
                    if (propsDelta != null) {
                        if (propsDelta.getKind() == IResourceDelta.CHANGED) {
                            update.set(true);
                        }
                    }

                    // Check for bundles included in the launcher's runbundles
View Full Code Here

    }

    public void resourceChanged(IResourceChangeEvent event) {
        IResource myResource = ResourceUtil.getResource(getEditorInput());

        IResourceDelta delta = event.getDelta();
        if (delta == null)
            return;
        IPath fullPath = myResource.getFullPath();
        delta = delta.findMember(fullPath);
        if (delta == null)
            return;

        if ((delta.getKind() & IResourceDelta.CHANGED) != 0 && (delta.getFlags() & IResourceDelta.MARKERS) != 0) {
            getEditorSite().getShell().getDisplay().asyncExec(new Runnable() {
                public void run() {
                    loadProblems();
                    reportProblemsInHeader();
                }
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IResourceDelta

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.