本文整理匯總了Java中org.eclipse.core.resources.IResourceDelta.getMarkerDeltas方法的典型用法代碼示例。如果您正苦於以下問題:Java IResourceDelta.getMarkerDeltas方法的具體用法?Java IResourceDelta.getMarkerDeltas怎麽用?Java IResourceDelta.getMarkerDeltas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IResourceDelta
的用法示例。
在下文中一共展示了IResourceDelta.getMarkerDeltas方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isProblemDelta
import org.eclipse.core.resources.IResourceDelta; //導入方法依賴的package包/類
private boolean isProblemDelta(IResourceDelta delta) {
if ((delta.getFlags() & IResourceDelta.MARKERS) == 0) {
return false;
}
for (IMarkerDelta markerDelta : delta.getMarkerDeltas()) {
if (markerDelta.isSubtypeOf(IMarker.PROBLEM)) {
// Detect added/removed problem markers
int kind = markerDelta.getKind();
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
return true;
}
// Detect changes in problem marker severity
int oldSeverity = markerDelta.getAttribute(IMarker.SEVERITY, -1);
int newSeverity = markerDelta.getMarker().getAttribute(IMarker.SEVERITY, -1);
if (newSeverity != oldSeverity) {
return true;
}
}
}
return false;
}
示例2: isErrorDelta
import org.eclipse.core.resources.IResourceDelta; //導入方法依賴的package包/類
private boolean isErrorDelta(IResourceDelta delta)
{
if ((delta.getFlags() & IResourceDelta.MARKERS) != 0)
{
IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
for (int i = 0; i < markerDeltas.length; i++)
{
if (markerDeltas[i].isSubtypeOf(IMarker.PROBLEM))
{
int kind = markerDeltas[i].getKind();
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED)
{
return true;
}
int severity = markerDeltas[i].getAttribute(IMarker.SEVERITY, -1);
int newSeverity = markerDeltas[i].getMarker().getAttribute(IMarker.SEVERITY, -1);
if (newSeverity != severity)
{
return true;
}
}
}
}
return false;
}
示例3: visit
import org.eclipse.core.resources.IResourceDelta; //導入方法依賴的package包/類
/**
* Update the BibtextEntryView when markers change.
*/
public boolean visit(IResourceDelta delta) throws CoreException {
if(delta == null) {
return false;
}
IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
if(markerDeltas.length > 0){
Display.getDefault().asyncExec(new Runnable() {
public void run() {
refreshAction.run();
}
});
}
return true;
}
示例4: getSortedMarkerDelta
import org.eclipse.core.resources.IResourceDelta; //導入方法依賴的package包/類
private IMarkerDelta[] getSortedMarkerDelta(final IResourceDelta delta) {
IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
//sort IResourceDelta.CHANGED > IResourceDelta.REMOVED > IResourceDelta.ADDED
Arrays.sort(markerDeltas, new Comparator<IMarkerDelta>(){
@Override
public int compare(IMarkerDelta o1, IMarkerDelta o2) {
return -((Integer)o1.getKind()).compareTo(o2.getKind());
}
});
return markerDeltas;
}
示例5: visit
import org.eclipse.core.resources.IResourceDelta; //導入方法依賴的package包/類
@Override
public boolean visit(final IResourceDelta delta) {
final IResource res = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
System.out.print("Resource ");
System.out.print(res.getFullPath());
System.out.println(" was added.");
break;
case IResourceDelta.REMOVED:
System.out.print("Resource ");
System.out.print(res.getFullPath());
System.out.println(" was removed.");
break;
case IResourceDelta.CHANGED:
System.out.print("Resource ");
System.out.print(delta.getFullPath());
System.out.println(" has changed.");
final int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0) {
System.out.println("--> Content Change");
}
if ((flags & IResourceDelta.REPLACED) != 0) {
System.out.println("--> Content Replaced");
}
if ((flags & IResourceDelta.MARKERS) != 0) {
System.out.println("--> Marker Change");
final IMarkerDelta[] markers = delta.getMarkerDeltas();
// if interested in markers, check these deltas
}
break;
}
return true; // visit the children
}
示例6: visit
import org.eclipse.core.resources.IResourceDelta; //導入方法依賴的package包/類
public boolean visit(IResourceDelta delta) {
IResource res = delta.getResource();
switch (delta.getKind()) {
case IResourceDelta.ADDED:
System.out.print("Resource ");
System.out.print(res.getFullPath());
System.out.println(" was added.");
break;
case IResourceDelta.REMOVED:
System.out.print("Resource ");
System.out.print(res.getFullPath());
System.out.println(" was removed.");
break;
case IResourceDelta.CHANGED:
System.out.print("Resource ");
System.out.print(delta.getFullPath());
System.out.println(" has changed.");
int flags = delta.getFlags();
if ((flags & IResourceDelta.CONTENT) != 0) {
System.out.println("--> Content Change");
}
if ((flags & IResourceDelta.REPLACED) != 0) {
System.out.println("--> Content Replaced");
}
if ((flags & IResourceDelta.MARKERS) != 0) {
System.out.println("--> Marker Change");
IMarkerDelta[] markers = delta.getMarkerDeltas();
// if interested in markers, check these deltas
for (IMarkerDelta iMarkerDelta : markers) {
System.out.println(iMarkerDelta.getAttribute(IMarker.CHAR_START));
switch (iMarkerDelta.getKind()) {
case IResourceDelta.ADDED:
System.out.println("Added");
break;
case IResourceDelta.REMOVED:
System.out.println("Removed");
break;
case IResourceDelta.CHANGED:
System.out.println("Changed");
break;
}
}
}
break;
}
return true; // visit the children
}