本文整理汇总了Java中org.eclipse.jdt.core.IJavaElementDelta.getElement方法的典型用法代码示例。如果您正苦于以下问题:Java IJavaElementDelta.getElement方法的具体用法?Java IJavaElementDelta.getElement怎么用?Java IJavaElementDelta.getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IJavaElementDelta
的用法示例。
在下文中一共展示了IJavaElementDelta.getElement方法的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);
}
示例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);
}
示例3: 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;
}
}
示例4: 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;
}
示例5: 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();
}
示例6: 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;
}
示例7: 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
示例8: addAffectedChildren
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
private void addAffectedChildren(IJavaElementDelta delta) throws JavaModelException {
IJavaElementDelta[] children = delta.getAffectedChildren();
for (int i = 0, length = children.length; i < length; i++) {
IJavaElementDelta child = children[i];
IJavaElement childElement = child.getElement();
switch (childElement.getElementType()) {
case IJavaElement.IMPORT_CONTAINER:
addChange((IImportContainer)childElement, child);
break;
case IJavaElement.IMPORT_DECLARATION:
addChange((IImportDeclaration)childElement, child);
break;
case IJavaElement.TYPE:
addChange((IType)childElement, child);
break;
case IJavaElement.INITIALIZER:
case IJavaElement.FIELD:
case IJavaElement.METHOD:
addChange((IMember)childElement, child);
break;
}
}
}
示例9: createResourceChangedMacro
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
/**
* Creates a macro corresponding to the changed delta of the change.
* @param time the time when the change occurred
* @param delta the changed delta of the change
* @return the created resource macro
*/
private ResourceMacro createResourceChangedMacro(long time, IJavaElementDelta delta) {
IJavaElement elem = delta.getElement();
String path = elem.getPath().toString();
if (path == null) {
return null;
}
if ((delta.getFlags() & IJavaElementDelta.F_CONTENT) != 0) {
// System.out.println("CONTENT CHANGED" + path);
return null;
}
return new ResourceMacro(time, "Changed", path, elem);
}
示例10: visit
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
private void visit(IJavaElementDelta delta) {
IJavaElement el = delta.getElement();
switch (el.getElementType()) {
case IJavaElement.JAVA_MODEL:
visitChildren(delta);
break;
case IJavaElement.JAVA_PROJECT:
if (isClasspathChanged(delta.getFlags()) && platformHolder.isCurrentPlatformProject(delta.getElement().getJavaProject())) {
notifyClasspathChanged((IJavaProject) el);
}
break;
default:
break;
}
}
示例11: processDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
public void processDelta(IJavaElementDelta delta, int eventType) {
switch (delta.getKind()) {
case IJavaElementDelta.CHANGED:
IJavaElementDelta[] children = delta.getAffectedChildren();
for (int i = 0, length = children.length; i < length; i++) {
IJavaElementDelta child = children[i];
processDelta(child, eventType);
}
break;
case IJavaElementDelta.REMOVED:
IJavaElement element = delta.getElement();
if (this.encloses(element)) {
if (this.elements != null) {
this.elements.remove(element);
}
String path = null;
switch (element.getElementType()) {
case IJavaElement.JAVA_PROJECT:
path = ((IJavaProject) element).getProject().getFullPath().toString();
break;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
path = ((IPackageFragmentRoot) element).getPath().toString();
break;
default:
return;
}
for (int i = 0; i < this.pathsCount; i++) {
if (this.relativePaths[i].equals(path)) {
this.relativePaths[i] = null;
rehash();
break;
}
}
}
break;
}
}
示例12: elementChanged
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
public void elementChanged(ElementChangedEvent event) {
for (IJavaElementDelta delta : event.getDelta().getChangedChildren()) {
int flags = delta.getFlags();
if ((flags & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0) {
IJavaElement element = delta.getElement();
if (element.getElementType() != IJavaElement.JAVA_PROJECT) {
continue;
}
classpathChanged((IJavaProject) element);
}
}
}
示例13: processDelta
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
@Override
protected void processDelta(IJavaElementDelta delta, List<IJavaElement> result) {
IJavaElement elem= delta.getElement();
boolean isChanged= delta.getKind() == IJavaElementDelta.CHANGED;
boolean isRemoved= delta.getKind() == IJavaElementDelta.REMOVED;
int flags= delta.getFlags();
switch (elem.getElementType()) {
case IJavaElement.JAVA_MODEL:
processChildrenDelta(delta, result);
return;
case IJavaElement.JAVA_PROJECT:
if (isRemoved || (isChanged &&
(flags & IJavaElementDelta.F_CLOSED) != 0)) {
return;
}
processChildrenDelta(delta, result);
return;
case IJavaElement.PACKAGE_FRAGMENT_ROOT:
if (isRemoved) {
return;
}
try {
if ((((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) ||
((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0))
&& ((IPackageFragmentRoot)elem).getKind() != IPackageFragmentRoot.K_SOURCE) {
result.add(elem);
}
} catch (JavaModelException e) {
// don't update
}
return;
default:
return;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:38,代码来源:BuildpathIndicatorLabelDecorator.java
示例14: findElement
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
protected IJavaElementDelta findElement(IJavaElement unit, IJavaElementDelta delta) {
if (delta == null || unit == null)
return null;
IJavaElement element= delta.getElement();
if (unit.equals(element)) {
if (isPossibleStructuralChange(delta)) {
return delta;
}
return null;
}
if (element.getElementType() > IJavaElement.CLASS_FILE)
return null;
IJavaElementDelta[] children= delta.getAffectedChildren();
if (children == null || children.length == 0)
return null;
for (int i= 0; i < children.length; i++) {
IJavaElementDelta d= findElement(unit, children[i]);
if (d != null)
return d;
}
return null;
}
示例15: getChangedParentElement
import org.eclipse.jdt.core.IJavaElementDelta; //导入方法依赖的package包/类
/**
* Returns the most generic ancestor of the given input which has a change, or <b>null</b>
* if no such ancestor exists.
*
* @param input the input of which the result must be an ancestor
* @param delta the delta describing the model change
* @return the changed element or <code>null</code>
*/
private IJavaElement getChangedParentElement(IJavaElement input, IJavaElementDelta delta) {
IJavaElement element= delta.getElement();
if (!isAncestor(element, input))
return null;
if (element instanceof ICompilationUnit) {
ICompilationUnit cu= (ICompilationUnit) element;
if (!cu.getPrimary().equals(cu))
return null;
if (isStructuralChange(delta))
return element;
} else {
if (!onlyChildrenChanged(delta))
return element;
}
IJavaElementDelta[] affectedChildren= delta.getAffectedChildren();
for (int i= 0; i < affectedChildren.length; i++) {
IJavaElement res= getChangedParentElement(input, affectedChildren[i]);
if (res != null)
return res;
}
return null;
}