Java Code Examples for org.eclipse.core.resources.IResourceDelta#getMarkerDeltas()

The following examples show how to use org.eclipse.core.resources.IResourceDelta#getMarkerDeltas() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProblemManager.java    From typescript.java with MIT License 6 votes vote down vote up
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;
}
 
Example 2
Source File: ProblemMarkerManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: BibtexEntryView.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: JavaReconciler.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void resourceChanged(IResourceChangeEvent e) {
	if (isRunningInReconcilerThread())
		return;

	IResourceDelta delta= e.getDelta();
	IResource resource= getResource();
	if (delta != null && resource != null) {
		IResourceDelta child= delta.findMember(resource.getFullPath());
		if (child != null) {
			IMarkerDelta[] deltas= child.getMarkerDeltas();
			int i= deltas.length;
			while (--i >= 0) {
				if (deltas[i].isSubtypeOf(IMarker.PROBLEM)) {
					forceReconciling();
					return;
				}
			}
		}
	}
}
 
Example 5
Source File: ProblemMarkerManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 6
Source File: ProblemMarkerManager.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private boolean isErrorDelta(IResourceDelta delta) {
    if ((delta.getFlags() & IResourceDelta.MARKERS) != 0) {
        IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
        for (int i = 0; i < markerDeltas.length; i++) {
            IMarkerDelta iMarkerDelta = markerDeltas[i];
            if (iMarkerDelta.isSubtypeOf(IMarker.PROBLEM)) {
                int kind = iMarkerDelta.getKind();
                if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED) {
                    return true;
                }
                int severity = iMarkerDelta.getAttribute(IMarker.SEVERITY, -1);
                int newSeverity = iMarkerDelta.getMarker().getAttribute(IMarker.SEVERITY, -1);
                if (newSeverity != severity) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example 7
Source File: ProblemMarkerManager.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
protected 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;
}
 
Example 8
Source File: DefaultResourceChangeToIssueProcessor.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example 9
Source File: ExternalBreakpointWatcher.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void resourceChanged(IResourceChangeEvent event) {
	IResourceDelta delta = event.getDelta();
	if(delta == null) {
		return;
	}
	
	IResource res = delta.getResource();
	if(res instanceof IWorkspaceRoot && (delta.getFlags() & IResourceDelta.MARKERS) != 0) {
		
		IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
		for (IMarkerDelta markerDelta : markerDeltas) {
			int kind = markerDelta.getKind();
			
			if(markerDelta.isSubtypeOf(CBREAKPOINT_MARKER_TYPE)) {
				
				if (kind == IResourceDelta.ADDED) {
					addMarkerAnnotation(markerDelta.getMarker());
				}
				
				if (kind == IResourceDelta.REMOVED) {
					removeMarkerAnnotation(markerDelta.getMarker());
				}
				
				if (kind == IResourceDelta.CHANGED) {
					updateMarkerAnnotation(markerDelta.getMarker());
				}
				
			}
		}
	}
}