本文整理汇总了Java中org.eclipse.core.resources.IMarkerDelta.getResource方法的典型用法代码示例。如果您正苦于以下问题:Java IMarkerDelta.getResource方法的具体用法?Java IMarkerDelta.getResource怎么用?Java IMarkerDelta.getResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IMarkerDelta
的用法示例。
在下文中一共展示了IMarkerDelta.getResource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resourceChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (planAdvisorMember == null) {
// if PlanAdvisor.cleanup() has been called
return;
}
IMarkerDelta[] markerDeltas = event.findMarkerDeltas(null, true);
List<MarkerViolation> violations = new ArrayList<MarkerViolation>();
boolean needUpdate = false;
for (IMarkerDelta markerDelta : markerDeltas) {
IResource resource = markerDelta.getResource();
if (resource == null || !resource.exists() || !this.project.equals(resource.getProject())) {
continue;
}
if ((markerDelta.getKind() == IResourceDelta.ADDED) ||
(markerDelta.getKind() == IResourceDelta.CHANGED)) {
IMarker marker = markerDelta.getMarker();
if (!isViolationMarker(marker) && filter(marker)) {
violations.add(new MarkerViolation(this, marker));
}
}
if (markerDelta.getKind() == IResourceDelta.REMOVED) {
needUpdate = true;
}
}
if (!violations.isEmpty() || needUpdate) {
List<Notification> notifications = Collections.<Notification>singletonList(new MarkerNotification(violations));
if (planAdvisorMember != null) {
planAdvisorMember.enqueue(notifications);
}
}
}
示例2: resourceChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResource resource = CommonUtils.getAdapter(timeline, IResource.class);
if (resource == null) {
return;
}
Resource eResource = model.eResource();
if (eResource == null) {
return;
}
String uriFragment = eResource.getURIFragment(model);
URI modelFragmentURI = URI.createURI(uriFragment.toString());
boolean refresh = false;
final boolean includeSubTypes = true;
IMarkerDelta[] markerDeltas = event.findMarkerDeltas(IMarker.MARKER, includeSubTypes);
for (IMarkerDelta delta : markerDeltas) {
IResource markerResource = delta.getResource();
if (CommonUtils.equals(resource, markerResource)) {
try {
Object attribute = null;
if(delta.getKind() == IResourceDelta.REMOVED) {
// get the old value of location, since the new value doesn't exist (marker deleted)
attribute = delta.getAttribute(IMarker.LOCATION);
} else {
IMarker marker = delta.getMarker();
attribute = marker.getAttribute(IMarker.LOCATION);
}
if (attribute != null) {
String foreignFragment = attribute.toString();
if (foreignFragment.startsWith(modelFragmentURI.toString())) {
refresh = true;
break;
}
}
} catch (CoreException e) {
String message = e.getMessage();
if (!message.contains("Marker id") || !message.contains(" not found.")) {
LogUtil.warn(e);
}
}
}
}
if (refresh) {
WidgetUtils.runInDisplayThread(timeline.getControl(), new Runnable() {
@Override
public void run() {
updateTitleVisual();
}
});
}
}