Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResourceDelta


            if ( monitor != null && monitor.isCanceled() ) throw new OperationCanceledException();

            if ( kind == IncrementalProjectBuilder.FULL_BUILD ) {
                fullBuild( monitor );
            } else {
                IResourceDelta delta = getDelta( getProject() );
                if ( delta == null ) {
                    fullBuild( monitor );
                } else {
                    incrementalBuild( delta,
                                      monitor );
View Full Code Here


    public ModifyElementListener(FileEditorInput fileInput) {
      this.fileInput = fileInput;
    }

    public void resourceChanged(IResourceChangeEvent event) {
      IResourceDelta delta = event.getDelta();
      try {
        IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() {
          public boolean visit(IResourceDelta delta) throws CoreException {
            if (delta.getFlags() != IResourceDelta.MARKERS
                    && delta.getResource().getType() == IResource.FILE) {
              IResource resource = delta.getResource();
              if (resource.equals(fileInput.getFile())) {
                if (delta.getKind() == IResourceDelta.REMOVED) {
                  handleElementDeleted(fileInput);
                } else if (delta.getKind() == IResourceDelta.CHANGED) {
                 
                  if (isFileChangeTrackingEnabled)
                    handleElementChanged(fileInput);
                }
              }
            }

            return true;
          }
        };

        delta.accept(visitor);
      } catch (CoreException e) {
        CasEditorPlugin.log(e);
      }
    }
View Full Code Here

            if ( monitor != null && monitor.isCanceled() ) throw new OperationCanceledException();

            if ( kind == IncrementalProjectBuilder.FULL_BUILD ) {
                fullBuild( monitor );
            } else {
                IResourceDelta delta = getDelta( getProject() );
                if ( delta == null ) {
                    fullBuild( monitor );
                } else {
                    incrementalBuild( delta,
                                      monitor );
View Full Code Here

      this.currentElement = null;

      // get the workspace delta, and start processing there.
      IResourceDelta[] deltas = changes.getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED | IResourceDelta.CHANGED, IContainer.INCLUDE_HIDDEN);
      for (int i = 0; i < deltas.length; i++) {
        IResourceDelta delta = deltas[i];
        IResource res = delta.getResource();

        // find out the element type
        RootInfo rootInfo = null;
        int elementType;
        IProject proj = (IProject)res;
        boolean wasJavaProject = this.state.findJavaProject(proj.getName()) != null;
        boolean isJavaProject = JavaProject.hasJavaNature(proj);
        if (!wasJavaProject && !isJavaProject) {
          elementType = NON_JAVA_RESOURCE;
        } else {
          IPath rootPath = externalPath(res);
          rootInfo = enclosingRootInfo(rootPath, delta.getKind());
          if (rootInfo != null && rootInfo.isRootOfProject(rootPath)) {
            elementType = IJavaElement.PACKAGE_FRAGMENT_ROOT;
          } else {
            elementType = IJavaElement.JAVA_PROJECT;
          }
        }

        // traverse delta
        traverseDelta(delta, elementType, rootInfo, null);

        if (elementType == NON_JAVA_RESOURCE
            || (wasJavaProject != isJavaProject && (delta.getKind()) == IResourceDelta.CHANGED)) { // project has changed nature (description or open/closed)
          try {
            // add child as non java resource
            nonJavaResourcesChanged((JavaModel)model, delta);
          } catch (JavaModelException e) {
            // java model could not be opened
View Full Code Here

   */
  public void resourceChanged(IResourceChangeEvent event) {

    int eventType = this.overridenEventType == -1 ? event.getType() : this.overridenEventType;
    IResource resource = event.getResource();
    IResourceDelta delta = event.getDelta();

    switch(eventType){
      case IResourceChangeEvent.PRE_DELETE :
        try {
          if(resource.getType() == IResource.PROJECT
View Full Code Here

      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
        checkSourceAttachmentChange(child, childRes);

        // find out whether the child is a package fragment root of the current project
        IPath childPath = externalPath(childRes);
        int childKind = child.getKind();
        RootInfo childRootInfo = rootInfo(childPath, childKind);
        RootInfo originalChildRootInfo = childRootInfo;
        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.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);
    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());
        updateRootIndex(root, subpkgName, child);
      }
    }
View Full Code Here

     * of files that need recompilation, and adds them to <code>fChangedSources</code>.
     * @param monitor
     * @throws CoreException
     */
    private void collectSourcesToCompile(IProgressMonitor monitor) throws CoreException {
        IResourceDelta delta= getDelta(getProject());
        // boolean emitDiags= getDiagPreference();

        if (delta != null) {
            delta.accept(fDeltaVisitor);
            for (IFile chg : fChangedSources) {
              fDependencies.put(chg, new HashSet<IFile>())// clear dependencies of changed files
            }
          collectDependencies(monitor, fChangedSources);    // re-collect dependencies of changed files
        } else {
View Full Code Here

  public void resourceChanged(IResourceChangeEvent event) {
    switch (event.getType()) {
    case IResourceChangeEvent.POST_BUILD:
    case IResourceChangeEvent.POST_CHANGE:
      if (!isGeneratingCode) {
        IResourceDelta delta = event.getDelta();
        checkChange(delta);
      }
      break;
    case IResourceChangeEvent.PRE_CLOSE:
    case IResourceChangeEvent.PRE_DELETE:
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.