当前位置: 首页>>代码示例>>Java>>正文


Java IJavaElementDelta类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.IJavaElementDelta的典型用法代码示例。如果您正苦于以下问题:Java IJavaElementDelta类的具体用法?Java IJavaElementDelta怎么用?Java IJavaElementDelta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IJavaElementDelta类属于org.eclipse.jdt.core包,在下文中一共展示了IJavaElementDelta类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createResourceRemovedMacro

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
/**
 * Creates a macro corresponding to the removed delta of the change.
 * @param time the time when the change occurred
 * @param delta the removed delta of the change
 * @return the created resource macro
 */
private ResourceMacro createResourceRemovedMacro(long time, IJavaElementDelta delta) {
    IJavaElement elem = delta.getElement();
    String path = elem.getPath().toString();
    if (path == null) {
        return null;
    }
    
    String type = "Removed";
    if ((delta.getFlags() & IJavaElementDelta.F_MOVED_TO) != 0) {
        if (isRenamed(delta.getElement(), delta.getMovedToElement())) {
            type = "RenamedTo";
        } else {
            type = "MovedTo";
        }
    }
    
    return new ResourceMacro(time, type, path, elem);
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:25,代码来源:ResourceChangedManager.java

示例2: createResourceAddedMacro

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
/**
 * Creates a macro corresponding to the added delta of the change.
 * @param time the time when the change occurred
 * @param delta the added delta of the change
 * @return the created resource macro
 */
private ResourceMacro createResourceAddedMacro(long time, IJavaElementDelta delta) {
    IJavaElement elem = delta.getElement();
    String path = elem.getPath().toString();
    if (path == null) {
        return null;
    }
    
    String type = "Added";
    if ((delta.getFlags() & IJavaElementDelta.F_MOVED_FROM) != 0) {
        if (isRenamed(delta.getElement(), delta.getMovedFromElement())) {
            type = "RenamedFrom";
        } else {
            type = "MovedFrom";
        }
    }
    
    return new ResourceMacro(time, type, path, elem);
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:25,代码来源:ResourceChangedManager.java

示例3: collectDeltas

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
/**
 * Collects all the deltas of the changes.
 * @param delta the root delta of the change
 * @param deltas the collection of the deltas to be collected
 */
private void collectDeltas(IJavaElementDelta delta) {
    if (delta.getKind() == IJavaElementDelta.ADDED ||
        delta.getKind() == IJavaElementDelta.REMOVED) {
        if (!contain(delta)) {
            deltas.add(delta);
        }
    } else if (delta.getKind() == IJavaElementDelta.CHANGED &&
            ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0)) {
        if (!contain(delta)) {
            deltas.add(delta);
        }
    }
    
    for (IJavaElementDelta d : delta.getAffectedChildren()) {
        collectDeltas(d);
    }
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:23,代码来源:ResourceChangedManager.java

示例4: visit

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private void visit(IJavaElementDelta delta) {
	IJavaElement el = delta.getElement();
	switch (el.getElementType()) {
	case IJavaElement.JAVA_MODEL:
		for (IJavaElementDelta c : delta.getAffectedChildren()) {
			visit(c);
		}
		break;
	case IJavaElement.JAVA_PROJECT:
		IJavaProject javaProject = (IJavaProject) el;
		if (isClasspathChanged(delta)) {
			detectionJob.analyze(javaProject);
		}
		break;
	default:
		break;
	}
}
 
开发者ID:fbricon,项目名称:wildfly-hive,代码行数:19,代码来源:ClasspathChangeListener.java

示例5: getProjectDeltas

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private Set<IJavaElementDelta> getProjectDeltas(IJavaElementDelta delta) {
	IJavaElement element = delta.getElement();
	if(delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT) {
		return Collections.singleton(delta);
	}
	Set<IJavaElementDelta> result = null;
	if(element instanceof IJavaModel) {
		if(delta.getAddedChildren()!=null) {
			for(IJavaElementDelta child: delta.getAffectedChildren()) {
				Set<IJavaElementDelta> projectDeltas = getProjectDeltas(child);
				if(!projectDeltas.isEmpty()) {
					if(result == null)
						result = newLinkedHashSet(); 
					result.addAll(projectDeltas);
				}
			}
		}
	}
	return result == null ? Collections.<IJavaElementDelta>emptySet() : result;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:Storage2UriMapperJavaImpl.java

示例6: getJavaProjectsWithClasspathChange

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private Set<IJavaProject> getJavaProjectsWithClasspathChange(IJavaElementDelta delta) {
	IJavaElement element = delta.getElement();
	if (element instanceof IPackageFragmentRoot) {
		IPackageFragmentRoot root = (IPackageFragmentRoot) element;
		if (delta.getKind() == IJavaElementDelta.REMOVED || delta.getKind() == IJavaElementDelta.ADDED
				|| (delta.getFlags() & IJavaElementDelta.F_REORDER) != 0
				|| (delta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0
				|| (delta.getFlags() & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0
				|| (root.isExternal() && (delta.getFlags() & // external folders change
				(IJavaElementDelta.F_CONTENT | IJavaElementDelta.F_SOURCEATTACHED | IJavaElementDelta.F_SOURCEDETACHED)) == delta
						.getFlags())) {
			return Collections.singleton(root.getJavaProject());
		}
	} else if (element instanceof IJavaModel) {
		return getPackageFragmentRootDeltas(delta.getAffectedChildren());
	} else if (element instanceof IJavaProject) {
		if ((delta.getFlags() & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0
				|| (delta.getFlags() & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0)
			return Collections.singleton((IJavaProject) element);
		return getPackageFragmentRootDeltas(delta.getAffectedChildren());
	}
	return Collections.emptySet();
}
 
开发者ID:cplutte,项目名称:bts,代码行数:24,代码来源:Storage2UriMapperJavaImpl.java

示例7: isAffectingPackageFragmentRoots

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private boolean isAffectingPackageFragmentRoots(IJavaElementDelta delta) {
	IJavaElement element = delta.getElement();
	if (element instanceof IPackageFragmentRoot) {
		if (delta.getKind() == IJavaElementDelta.REMOVED
			|| delta.getKind() == IJavaElementDelta.ADDED
			|| (delta.getFlags() & IJavaElementDelta.F_REORDER) != 0
			|| (delta.getFlags() & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0
			|| (delta.getFlags() & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0
			|| (((IPackageFragmentRoot) element).isExternal() && (delta.getFlags() & // external folders change
					(IJavaElementDelta.F_CONTENT 
							| IJavaElementDelta.F_SOURCEATTACHED 
							| IJavaElementDelta.F_SOURCEDETACHED)) == delta.getFlags())) {
			return true;
		}
	} else if (element instanceof IJavaModel) {
		return isAffectingPackageFragmentRoots(delta.getAffectedChildren());
	} else if (element instanceof IJavaProject) {
		if ((delta.getFlags() & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0 ||
				(delta.getFlags() & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0)
			return true;
		return isAffectingPackageFragmentRoots(delta.getAffectedChildren());
	}
	return false;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:25,代码来源:AbstractJavaProjectsState.java

示例8: collectRemoved

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private void collectRemoved(
    Set<IAdaptable> potentiallyRemovedSet,
    Set<IAdaptable> removedElements,
    IJavaElementDelta delta) {
  if (delta.getKind() == IJavaElementDelta.REMOVED) removedElements.add(delta.getElement());
  else if (delta.getKind() == IJavaElementDelta.CHANGED) {
    int flags = delta.getFlags();
    if ((flags & REMOVED_FLAGS) != 0) {
      potentiallyRemovedSet.add(delta.getElement());
    } else {
      IJavaElementDelta[] childDeltas = delta.getAffectedChildren();
      for (int i = 0; i < childDeltas.length; i++) {
        collectRemoved(potentiallyRemovedSet, removedElements, childDeltas[i]);
      }
    }
  }
  IResourceDelta[] resourceDeltas = delta.getResourceDeltas();
  if (resourceDeltas != null) {
    for (int i = 0; i < resourceDeltas.length; i++) {
      collectRemovals(removedElements, resourceDeltas[i]);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:SearchResultUpdater.java

示例9: addReconcileDelta

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
protected void addReconcileDelta(ICompilationUnit workingCopy, IJavaElementDelta delta) {
  HashMap reconcileDeltas =
      JavaModelManager.getJavaModelManager().getDeltaProcessor().reconcileDeltas;
  org.eclipse.jdt.internal.core.JavaElementDelta previousDelta =
      (org.eclipse.jdt.internal.core.JavaElementDelta) reconcileDeltas.get(workingCopy);
  if (previousDelta != null) {
    IJavaElementDelta[] children = delta.getAffectedChildren();
    for (int i = 0, length = children.length; i < length; i++) {
      org.eclipse.jdt.internal.core.JavaElementDelta child =
          (org.eclipse.jdt.internal.core.JavaElementDelta) children[i];
      previousDelta.insertDeltaTree(child.getElement(), child);
    }
    // note that the last delta's AST always takes precedence over the existing delta's AST
    // since it is the result of the last reconcile operation
    if ((delta.getFlags() & IJavaElementDelta.F_AST_AFFECTED) != 0) {
      previousDelta.changedAST(delta.getCompilationUnitAST());
    }

  } else {
    reconcileDeltas.put(workingCopy, delta);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:JavaModelOperation.java

示例10: firePostChangeDelta

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private void firePostChangeDelta(
    IJavaElementDelta deltaToNotify,
    IElementChangedListener[] listeners,
    int[] listenerMask,
    int listenerCount) {

  // post change deltas
  if (DEBUG) {
    System.out.println(
        "FIRING POST_CHANGE Delta [" + Thread.currentThread() + "]:"); // $NON-NLS-1$//$NON-NLS-2$
    System.out.println(
        deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); // $NON-NLS-1$
  }
  if (deltaToNotify != null) {
    // flush now so as to keep listener reactions to post their own deltas for subsequent
    // iteration
    flush();

    //			// mark the operation stack has not modifying resources since resource deltas are being
    // fired
    //			JavaModelOperation.setAttribute(JavaModelOperation.HAS_MODIFIED_RESOURCE_ATTR, null);

    notifyListeners(
        deltaToNotify, ElementChangedEvent.POST_CHANGE, listeners, listenerMask, listenerCount);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:DeltaProcessor.java

示例11: fireReconcileDelta

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private void fireReconcileDelta(
    IElementChangedListener[] listeners, int[] listenerMask, int listenerCount) {

  IJavaElementDelta deltaToNotify = mergeDeltas(this.reconcileDeltas.values());
  if (DEBUG) {
    System.out.println(
        "FIRING POST_RECONCILE Delta ["
            + Thread.currentThread()
            + "]:"); // $NON-NLS-1$//$NON-NLS-2$
    System.out.println(
        deltaToNotify == null ? "<NONE>" : deltaToNotify.toString()); // $NON-NLS-1$
  }
  if (deltaToNotify != null) {
    // flush now so as to keep listener reactions to post their own deltas for subsequent
    // iteration
    this.reconcileDeltas = new HashMap();

    notifyListeners(
        deltaToNotify,
        ElementChangedEvent.POST_RECONCILE,
        listeners,
        listenerMask,
        listenerCount);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:DeltaProcessor.java

示例12: ignoreClasspathChanges

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private boolean ignoreClasspathChanges(ElementChangedEvent event) {
	if (event.getDelta() == null && event.getDelta().getChangedChildren() == null)
		return true;
	for (IJavaElementDelta delta : event.getDelta().getChangedChildren()) {
		if (delta.getResourceDeltas() == null)
			return false;
		for (IResourceDelta rd : delta.getResourceDeltas()) {
			if (rd.getFullPath() == null)
				continue;
			String path = rd.getFullPath().getFileExtension();
			if (path != null && !(path.equalsIgnoreCase(FileExtension.JRXML) || path.equalsIgnoreCase(FileExtension.JASPER)))
				return false;
		}
	}
	return true;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:JavaProjectClassLoader.java

示例13: reconcile

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
@Override
public void reconcile(final ReconcileContext context) {
	if (FileCompletionPreferencePage.checkDuringTyping) {
		if (context == null) {
			LOG.fine("context is null");
		} else {
			IJavaElementDelta delta = context.getDelta();
			if (delta == null) {
				LOG.fine("delta is null");
			} else {
				reconcileImpl(context, delta);
			}
		}
	}

}
 
开发者ID:impetuouslab,项目名称:eclipse-filecompletion,代码行数:17,代码来源:MarkerFinderImpl.java

示例14: findElement

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private IJavaElementDelta findElement(IJavaElement target, IJavaElementDelta delta) {

			if (delta == null || target == null)
				return null;

			IJavaElement element= delta.getElement();

			if (element.getElementType() > IJavaElement.CLASS_FILE)
				return null;

			if (target.equals(element))
				return delta;

			IJavaElementDelta[] children= delta.getAffectedChildren();

			for (int i= 0; i < children.length; i++) {
				IJavaElementDelta d= findElement(target, children[i]);
				if (d != null)
					return d;
			}

			return null;
		}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:DefaultJavaFoldingStructureProvider.java

示例15: collectRemoved

import org.eclipse.jdt.core.IJavaElementDelta; //导入依赖的package包/类
private void collectRemoved(Set<IAdaptable> potentiallyRemovedSet, Set<IAdaptable> removedElements, IJavaElementDelta delta) {
	if (delta.getKind() == IJavaElementDelta.REMOVED)
		removedElements.add(delta.getElement());
	else if (delta.getKind() == IJavaElementDelta.CHANGED) {
		int flags= delta.getFlags();
		if ((flags & REMOVED_FLAGS) != 0) {
			potentiallyRemovedSet.add(delta.getElement());
		} else {
			IJavaElementDelta[] childDeltas= delta.getAffectedChildren();
			for (int i= 0; i < childDeltas.length; i++) {
				collectRemoved(potentiallyRemovedSet, removedElements, childDeltas[i]);
			}
		}
	}
	IResourceDelta[] resourceDeltas= delta.getResourceDeltas();
	if (resourceDeltas != null) {
		for (int i= 0; i < resourceDeltas.length; i++) {
			collectRemovals(removedElements, resourceDeltas[i]);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:SearchResultUpdater.java


注:本文中的org.eclipse.jdt.core.IJavaElementDelta类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。