Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResourceDelta


      if (event.getType() != IResourceChangeEvent.POST_CHANGE
              || event.getResource() instanceof IWorkspaceRoot) {
        return;
      }

      final IResourceDelta rootDelta = event.getDelta();

      NlpModelDeltaImpl modelDelta = new NlpModelDeltaImpl(null, rootDelta);

      mEventDispatcher.notify(modelDelta.getKind(), modelDelta);
View Full Code Here


    /**
     * Executes the current action.
     */
    public void handle(final NlpModelDeltaImpl delta) {
      if (delta.getResource() instanceof IProject) {
        final IResourceDelta resourceDelta = delta.getResourceDelta();

        final IProject project = (IProject) delta.getResource();

        if ((resourceDelta.getFlags() & IResourceDelta.OPEN) != 0) {
          if (project.isOpen()) {
            // add the nlp project
            delta.setKind(Kind.ADDED);
            mEventDispatcher.notify(delta.getKind(), delta);

            // remove the old resource project
            IResourceDelta removeProjectResourceDelta = new AbstractResourceDelta() {
              @Override
              public IResource getResource() {
                return project;
              }

              @Override
              public int getKind() {
                return IResourceDelta.REMOVED;
              }

              @Override
              public IPath getFullPath() {
                return resourceDelta.getFullPath();
              }

              @Override
              public IPath getProjectRelativePath() {
                return resourceDelta.getProjectRelativePath();
              }

              @Override
              public IResourceDelta[] getAffectedChildren() {
                return new IResourceDelta[] {};
              }
            };

            NlpModelDeltaImpl removeProjectDelta =
                    new NlpModelDeltaImpl((NlpModelDeltaImpl) delta.getParent(),
                    removeProjectResourceDelta);

            NlpModelDeltaImpl parent = (NlpModelDeltaImpl) delta.getParent();

            parent.addChild(removeProjectDelta);

            return;
          } else {
            // remove the nlp project
            delta.setKind(Kind.REMOVED);
            mEventDispatcher.notify(delta.getKind(), delta);

            // add the closed project resource
            IResourceDelta removeProjectResourceDelta = new AbstractResourceDelta() {
              @Override
              public IResource getResource() {
                return project;
              }

              @Override
              public int getKind() {
                return IResourceDelta.ADDED;
              }

              @Override
              public IPath getFullPath() {
                return resourceDelta.getFullPath();
              }

              @Override
              public IPath getProjectRelativePath() {
                return resourceDelta.getProjectRelativePath();
              }

              @Override
              public IResourceDelta[] getAffectedChildren() {
                return new IResourceDelta[] {};
              }
            };

            NlpModelDeltaImpl removeProjectDelta =
                    new NlpModelDeltaImpl((NlpModelDeltaImpl) delta.getParent(),
                    removeProjectResourceDelta);

            NlpModelDeltaImpl parent = (NlpModelDeltaImpl) delta.getParent();

            parent.addChild(removeProjectDelta);
            return;
          }
        }
        // indicates that a nature was added to the project
        else if ((resourceDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
          if (project.isOpen()) {
            IResourceDelta removeProjectResourceDelta = new AbstractResourceDelta() {
              @Override
              public IResource getResource() {
                return project;
              }

View Full Code Here

    mResourceDelta = resourceDelta;

    mKind = getKind(resourceDelta);

    IResourceDelta deltas[] = mResourceDelta.getAffectedChildren();

    for (IResourceDelta element : deltas) {
      if (element.getFlags() != IResourceDelta.MARKERS) {
        mChildren.add(new NlpModelDeltaImpl(this, element));
      }
View Full Code Here

    public CloseEditorListener(AnnotationEditor editor) {
      this.editor = editor;
    }

    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) {
              if (delta.getKind() == IResourceDelta.REMOVED) {
                IResource resource = delta.getResource();

                IEditorInput input = editor.getEditorInput();

                if (input instanceof FileEditorInput) {
                  FileEditorInput fileInput = (FileEditorInput) input;

                  if (resource.equals(fileInput.getFile())) {
                    editor.close(false);
                  }
                }
              }
            }

            return true;
          }
        };

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

   *
   * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
   */
  public void resourceChanged(IResourceChangeEvent event) {

    IResourceDelta delta = event.getDelta();
    try {
      delta.accept(this);
    } catch (CoreException e) {
      ToolPlugin.log(IStatus.ERROR,"Error in resourceChange.", e);
    }
  }
View Full Code Here

   *
   * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
   */
  public void resourceChanged(IResourceChangeEvent event) {

    IResourceDelta delta = event.getDelta();
    try {
      delta.accept(this);
    } catch (CoreException e) {
      ToolPlugin.log(IStatus.ERROR,"Error in resourceChange.", e);
    }
  }
View Full Code Here

  protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
      throws CoreException {
    if (kind == FULL_BUILD) {
      fullBuild(monitor);
    } else {
      IResourceDelta delta = getDelta(getProject());
      if (delta == null) {
        fullBuild(monitor);
      } else {
        incrementalBuild(delta, monitor);
      }
View Full Code Here

  protected IProject[] build(int kind, Map args,
      IProgressMonitor monitor) {
    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

  private IWorkspace workspace;
  private IResourceChangeListener changeListener= new ChangeListener();
 
  class ChangeListener implements IResourceChangeListener {
    public void resourceChanged(IResourceChangeEvent e) {
      IResourceDelta delta= e.getDelta();
      if (delta != null && method != null) {
        IResourceDelta child= delta.findMember(method.getFile().getFullPath());
        if (child != null)
          update(child.getMarkerDeltas());
      }
    }
View Full Code Here

   * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
   */
  @Override
  public void resourceChanged(IResourceChangeEvent event) {

    IResourceDelta delta = event.getDelta();
    try {
      delta.accept(this);
    } catch (CoreException e) {
      ToolNavigatorActivator.showError("Error in resourceChange.", e);
    }
  }
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.