本文整理汇总了Java中org.eclipse.core.resources.IMarkerDelta.getKind方法的典型用法代码示例。如果您正苦于以下问题:Java IMarkerDelta.getKind方法的具体用法?Java IMarkerDelta.getKind怎么用?Java IMarkerDelta.getKind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IMarkerDelta
的用法示例。
在下文中一共展示了IMarkerDelta.getKind方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: breakpointChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint,
* org.eclipse.core.resources.IMarkerDelta)
*/
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
if (supportsBreakpoint(breakpoint)) {
try {
final URI uri = ((DSLBreakpoint)breakpoint).getURI();
final IMarker marker = breakpoint.getMarker();
for (Entry<String, Object> entry : delta.getAttributes().entrySet()) {
final Object markerValue = marker.getAttribute(entry.getKey());
final Object deltaValue = entry.getValue();
if ((markerValue != null && !markerValue.equals(deltaValue)) || (deltaValue != null
&& !deltaValue.equals(markerValue))) {
if (delta.getKind() == IResourceDelta.ADDED) {
factory.getDebugger().handleEvent(new ChangeBreakPointRequest(uri, entry.getKey(),
(Serializable)deltaValue));
} else {
factory.getDebugger().handleEvent(new ChangeBreakPointRequest(uri, entry.getKey(),
(Serializable)markerValue));
}
}
}
} catch (CoreException e) {
Activator.getDefault().error(e);
}
}
}
示例2: isProblemDelta
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的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;
}
示例3: dispatchMarkerDelta
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
protected void dispatchMarkerDelta(final IMarkerDelta iMarkerDelta, final String elementID) {
switch (iMarkerDelta.getKind()) {
case IResourceDelta.ADDED :
addSCTIssue(iMarkerDelta, elementID);
break;
case IResourceDelta.REMOVED :
removeSCTIssue(iMarkerDelta, elementID);
break;
case IResourceDelta.CHANGED :
removeSCTIssue(iMarkerDelta, elementID);
addSCTIssue(iMarkerDelta, elementID);
break;
default :
break;
}
}
示例4: isErrorDelta
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
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;
}
示例5: update
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
/**
* Updates this model to the given marker deltas.
*
* @param markerDeltas
* the array of marker deltas
*/
protected void update(IMarkerDelta[] markerDeltas)
{
if (markerDeltas.length == 0)
{
return;
}
for (IMarkerDelta delta : markerDeltas)
{
switch (delta.getKind())
{
case IResourceDelta.ADDED:
addMarkerAnnotation(delta.getMarker());
break;
case IResourceDelta.REMOVED:
removeMarkerAnnotation(delta.getMarker());
break;
case IResourceDelta.CHANGED:
modifyMarkerAnnotation(delta.getMarker());
break;
default:
break;
}
}
fireModelChanged();
}
示例6: 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);
}
}
}
示例7: resourceChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
public void resourceChanged(IResourceChangeEvent event) {
boolean postBuild = event.getType() == IResourceChangeEvent.POST_BUILD;
boolean accepted = false;
/*
* gather all marker changes from the delta. be sure to do this in the
* calling thread, as the delta is destroyed when this method returns
*/
IMarkerDelta[] markerDeltas = event.findMarkerDeltas(FindBugsMarker.NAME, true);
for (IMarkerDelta mdelta : markerDeltas) {
IMarker marker = mdelta.getMarker();
if (marker == null) {
continue;
}
DeltaInfo deltaInfo = new DeltaInfo(marker, mdelta.getKind());
if (BugContentProvider.DEBUG) {
System.out.println("resource change for: " + deltaInfo);
}
accepted |= refreshJob.addToQueue(deltaInfo);
}
if (!accepted) {
return;
}
if (postBuild) {
scheduleRefreshJob(SHORT_DELAY);
} else {
// After some time do updates anyways
scheduleRefreshJob(LONG_DELAY);
}
}
示例8: resourceChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
@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());
}
}
}
}
}
示例9: visit
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的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
}
示例10: breakpointChanged
import org.eclipse.core.resources.IMarkerDelta; //导入方法依赖的package包/类
@Override
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
if (delta == null) {//Ignore non marker events which come from BfBreakpoint.setInstalled
return;
}
if (this.isTerminated()) {
return;
}
try {
if (breakpoint instanceof BfWatchpoint) {
BfWatchpoint wp = (BfWatchpoint) breakpoint;
if (wp.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
this.process.getInterpreter().addWatchpoint(wp);
}
else {
this.process.getInterpreter().removeWatchpoint(wp);
}
return;
}
BfBreakpoint bp = this.getValidBreakpoint(breakpoint);
if (bp == null) {
return;
}
if (delta.getKind() != IResourceDelta.CHANGED) {
DbgActivator.getDefault().logError("Unexpected marker delta: " + delta, null);
return;
}
int newLocation = bp.getCharStart();
int oldLocation = delta.getAttribute(IMarker.CHAR_START, newLocation);
if (bp.isEnabled() && DebugPlugin.getDefault().getBreakpointManager().isEnabled()) {
if (!this.installedBreakpoints.contains(breakpoint)) {
this.process.getInterpreter().addBreakpoint(newLocation);
this.addInstalledBreakpoint(bp);
}
else if (newLocation != oldLocation) {
this.process.getInterpreter().removeBreakpoint(oldLocation);
this.process.getInterpreter().addBreakpoint(newLocation);
}
}
else {
this.process.getInterpreter().removeBreakpoint(oldLocation);
this.removeInstalledBreakpoint(bp);
}
}
catch (CoreException ex) {
DbgActivator.getDefault().logError("Breakpoint could not be added", ex);
}
}
示例11: 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();
}
});
}
}