Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResourceDelta


      int length = children.length;
      IResourceDelta[] orphanChildren = null;
      Openable parent = null;
      boolean isValidParent = true;
      for (int i = 0; i < length; i++) {
        IResourceDelta child = children[i];
        IResource childRes = child.getResource();
 
        // check source attachment change
        this.checkSourceAttachmentChange(child, childRes);
       
        // find out whether the child is a package fragment root of the current project
        IPath childPath = childRes.getFullPath();
        int childKind = child.getKind();
        RootInfo childRootInfo = this.rootInfo(childPath, childKind);
        if (childRootInfo != null && !childRootInfo.isRootOfProject(childPath)) {
          // package fragment root of another project (dealt with later)
          childRootInfo = null;
        }
View Full Code Here


            boolean isSource =
              rootInfo == null // if null, defaults to source
              || rootInfo.entryKind == IClasspathEntry.CPE_SOURCE;
            IResourceDelta[] children = delta.getAffectedChildren();
            for (int i = 0, length = children.length; i < length; i++) {
              IResourceDelta child = children[i];
              IResource resource = child.getResource();
              // TODO (philippe) Why do this? Every child is added anyway as the delta is walked
              if (resource instanceof IFile) {
                String name = resource.getName();
                if (isSource) {
                  if (org.aspectj.org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(name)) {
View Full Code Here

  private void updateRootIndex(PackageFragmentRoot root, String[] pkgName, IResourceDelta delta) {
    Openable pkg = root.getPackageFragment(pkgName);
    this.updateIndex(pkg, delta);
    IResourceDelta[] children = delta.getAffectedChildren();
    for (int i = 0, length = children.length; i < length; i++) {
      IResourceDelta child = children[i];
      IResource resource = child.getResource();
      if (resource instanceof IFolder) {
        String[] subpkgName = Util.arrayConcat(pkgName, resource.getName());
        this.updateRootIndex(root, subpkgName, child);
      }
    }
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

    }

    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;

        // Delegate to any interested pages
        for (Object page : pages) {
            if (page instanceof IResourceChangeListener) {
                ((IResourceChangeListener) page).resourceChanged(event);
            }
        }

        // Close editor if file removed or switch to new location if file moved
        if (delta.getKind() == IResourceDelta.REMOVED) {
            if ((delta.getFlags() & IResourceDelta.MOVED_TO) != 0) {
                IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(delta.getMovedToPath());
                final FileEditorInput newInput = new FileEditorInput(file);

                setInput(newInput);
                Display display = getEditorSite().getShell().getDisplay();
                if (display != null) {
                    SWTConcurrencyUtil.execForDisplay(display, true, new Runnable() {
                        public void run() {
                            setPartNameForInput(newInput);
                            sourcePage.setInput(newInput);
                        }
                    });
                }
            } else {
                close(false);
            }

        }
        // File content updated externally => reload all pages
        else if ((delta.getKind() & IResourceDelta.CHANGED) > 0 && (delta.getFlags() & IResourceDelta.CONTENT) > 0) {
            if (!saving.get()) {
                final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
                final IDocument document = docProvider.getDocument(getEditorInput());
                SWTConcurrencyUtil.execForControl(getEditorSite().getShell(), true, new Runnable() {
                    public void run() {
View Full Code Here

    /*
     * Report the full delta in the log
     */
    private void reportDelta(IProject project) throws CoreException {
        IResourceDelta delta = getDelta(project);
        if (delta == null) {
            log(LOG_FULL, "No delta, is null");
            return;
        }

        delta.accept(new IResourceDeltaVisitor() {

            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                log(LOG_FULL, delta.toString() + " " + delta.getResource().getModificationStamp() + " " + delta.getKind());
                return true;
            }
        });

    }
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() {
            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                if (!isChangeDelta(delta))
                    return false;
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() {
            @Override
            public boolean visit(IResourceDelta delta) throws CoreException {
                if (!isChangeDelta(delta))
                    return false;
View Full Code Here

     */
    public synchronized void resourceChanged(IResourceChangeEvent event) {
        if (event.getType() != IResourceChangeEvent.POST_CHANGE)
            return;

        IResourceDelta rootDelta = event.getDelta();
        try {
            final Set<Project> changed = new HashSet<Project>();
            rootDelta.accept(new IResourceDeltaVisitor() {
                public boolean visit(IResourceDelta delta) throws CoreException {
                    try {

                        IPath location = delta.getResource().getLocation();
                        if (location == null) {
View Full Code Here

            public void resourceChanged(IResourceChangeEvent event) {
                if (event.getType() != IResourceChangeEvent.POST_CHANGE)
                    return;

                IResourceDelta rootDelta = event.getDelta();
                if (isCnfChanged(rootDelta)) {
                    workspace.refresh();
                }
            }
        });
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.