本文整理匯總了Java中org.eclipse.core.resources.IResourceDelta.MARKERS屬性的典型用法代碼示例。如果您正苦於以下問題:Java IResourceDelta.MARKERS屬性的具體用法?Java IResourceDelta.MARKERS怎麽用?Java IResourceDelta.MARKERS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.eclipse.core.resources.IResourceDelta
的用法示例。
在下文中一共展示了IResourceDelta.MARKERS屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isMarkerChangeForThisEditor
private boolean isMarkerChangeForThisEditor(IResourceChangeEvent event) {
IResource resource = ResourceUtil.getResource(getEditorInput());
if (resource == null) {
return false;
}
IPath path = resource.getFullPath();
if (path == null) {
return false;
}
IResourceDelta eventDelta = event.getDelta();
if (eventDelta == null) {
return false;
}
IResourceDelta delta = eventDelta.findMember(path);
if (delta == null) {
return false;
}
boolean isMarkerChangeForThisResource = (delta.getFlags() & IResourceDelta.MARKERS) != 0;
return isMarkerChangeForThisResource;
}
示例2: handleResource
protected boolean handleResource ( final IResourceDelta delta )
{
if ( delta.getResource ().getType () != IResource.FILE )
{
return true;
}
if ( delta.getFlags () == IResourceDelta.MARKERS )
{
return false;
}
final URI uri = URI.createPlatformResourceURI ( delta.getFullPath ().toString (), true );
if ( !this.loadedUris.contains ( uri ) )
{
return true;
}
fireResourceChange ();
return true;
}
示例3: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
if ((event.getDelta().getFlags() ^ IResourceDelta.MARKERS) != 0) {
try {
event.getDelta().accept(delta -> {
if (delta.getResource().equals(this.resource)) {
viewer.getControl().getDisplay().asyncExec(() -> {
if (viewer instanceof StructuredViewer) {
viewer.refresh(true);
}
});
}
return delta.getResource().getFullPath().isPrefixOf(this.resource.getFullPath());
});
} catch (CoreException e) {
// LanguageServerPlugin.logError(e);
}
}
}
示例4: isProblemDelta
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;
}
示例5: process
@Override
public ResourceDeltaToIssueResult process(IResourceChangeEvent event, Resource connectedResource,
Multimap<String, SCTIssue> visibleIssues) {
final IFile file = WorkspaceSynchronizer.getFile(connectedResource);
final IResourceDelta deltaForFile = getDeltaForFile(event, file);
if (deltaForFile == null) {
return null;
}
currentIssues = HashMultimap.create(visibleIssues);
changedIssuesElementIDs = Sets.newHashSet();
if ((IResourceDelta.CHANGED == deltaForFile.getKind()) && ((deltaForFile.getFlags() & IResourceDelta.MARKERS) != 0)) {
processMarkerDelta(deltaForFile);
}
return new ResourceDeltaToIssueResult(currentIssues,changedIssuesElementIDs);
}
示例6: handleAddedResource
/**
* Adds patch file to admin folder.
*
* @param res
* changed resource
* @param delta
* resource delta
* @param flag
*/
private void handleAddedResource(IResource res, IResourceDelta delta,
int flag) {
if ((flag & IResourceDelta.MARKERS) == 0
|| (flag & IResourceDelta.MOVED_FROM) != 0) {
try {
persistanceOperations.addAdminResource(res);
} catch (FileOperationException e) {
LogOperations.logError(
"Change file could not be created in admin folder.", e);
}
VariantSyncPlugin.getDefault().logMessage(
RESOURCE + res.getFullPath() + " was added "
+ getFlagTxt(flag));
update();
}
}
示例7: visit
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
boolean isAutomatic = getPreferenceStore().getBoolean(EvoSuitePreferencePage.AUTOMATIC_TEST_ON_SAVE);
if (isAutomatic // && markersEnabled()
&& delta.getKind() == IResourceDelta.CHANGED
&& delta.getFlags() != IResourceDelta.MARKERS
&& delta.getResource() != null) {
final IResource res = delta.getResource();
if (res.getType() == IResource.FILE
&& res.getName().toLowerCase().endsWith("java")
&& !res.getName().endsWith(JUNIT_IDENTIFIER)
&& !res.getName().endsWith(SCAFFOLDING_IDENTIFIER)) {
System.out.println("Resetting Roaming Job for " + res.getName());
FILE_QUEUE.addFile(res);
FILE_QUEUE.update();
resetRoamingJob(res);
}
}
return true;
}
示例8: isErrorDelta
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;
}
示例9: resourceChanged
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResource file = ResourceUtil.getResource(getEditorInput());
IResourceDelta delta = event.getDelta();
if (delta != null && file != null) {
IResourceDelta child = delta.findMember(file.getFullPath());
if (child != null && (child.getFlags() & IResourceDelta.MARKERS) != 0) {
UiSync.exec(parentComposite, () -> {
if (!parentComposite.isDisposed()) {
firePropertyChange(IWorkbenchPart.PROP_TITLE);
}
});
}
}
}
示例10: visit
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
// Check if resource is accessible.
// We do not deal with the markers for deleted files here
// WorkspaceEventsHandler removes the diagnostics for deleted resources.
if (resource == null || !resource.isAccessible()) {
return false;
}
if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.ROOT) {
return true;
}
// ignore problems caused by standalone files
if (resource.getType() == IResource.PROJECT) {
return !JavaLanguageServerPlugin.getProjectsManager().getDefaultProject().equals(resource.getProject());
}
// No marker changes continue to visit
if ((delta.getFlags() & IResourceDelta.MARKERS) == 0) {
return false;
}
IFile file = (IFile) resource;
String uri = JDTUtils.getFileURI(resource);
IDocument document = null;
IMarker[] markers = null;
// Check if it is a Java ...
if (JavaCore.isJavaLikeFileName(file.getName())) {
markers = resource.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
ICompilationUnit cu = (ICompilationUnit) JavaCore.create(file);
document = JsonRpcHelpers.toDocument(cu.getBuffer());
} // or a build file
else if (projectsManager.isBuildFile(file)) {
//all errors on that build file should be relevant
markers = file.findMarkers(null, true, 1);
document = JsonRpcHelpers.toDocument(file);
}
if (document != null) {
this.connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), toDiagnosticsArray(document, markers)));
}
return false;
}
示例11: visit
@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
}
示例12: visit
@Override
public boolean visit(final IResourceDelta delta) {
final IResource res = delta.getResource();
boolean update = false;
switch (delta.getKind()) {
case IResourceDelta.OPEN:
if (res.isAccessible())
update = projectOpened((IProject) res);
else
update = projectClosed((IProject) res);
break;
case IResourceDelta.ADDED:
update = processAddition(res);
break;
case IResourceDelta.REMOVED:
update = processRemoval(res);
break;
case IResourceDelta.CHANGED:
final int flags = delta.getFlags();
if ((flags & IResourceDelta.MARKERS) != 0) {
update = processMarkersChanged(res);
} else if ((flags & IResourceDelta.TYPE) != 0) {
if (DEBUG)
DEBUG("Resource type changed: " + res);
} else if ((flags & IResourceDelta.CONTENT) != 0) {
if (DEBUG)
DEBUG("Resource contents changed: " + res);
} else if ((flags & IResourceDelta.SYNC) != 0) {
if (DEBUG)
DEBUG("Resource sync info changed: " + res);
}
break;
}
if (update) {
updateResource(res);
}
return true; // visit the children
}
示例13: visit
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
}
示例14: getFlagTxt
/**
* Adds debug messages.
*
* @param flag
* @return debug message
*/
private String getFlagTxt(int flag) {
String flags = "F_";
if ((flag & IResourceDelta.ADDED) != 0) {
flags += "ADDED ";
}
if ((flag & IResourceDelta.ADDED_PHANTOM) != 0) {
flags += "ADDED_PHANTOM ";
}
if ((flag & IResourceDelta.ALL_WITH_PHANTOMS) != 0) {
flags += "ALL_WITH_PHANTOMS ";
}
if ((flag & IResourceDelta.CHANGED) != 0) {
flags += "CHANGED ";
}
if ((flag & IResourceDelta.CONTENT) != 0) {
flags += "CONTENT ";
}
if ((flag & IResourceDelta.COPIED_FROM) != 0) {
flags += "COPIED_FROM ";
}
if ((flag & IResourceDelta.DERIVED_CHANGED) != 0) {
flags += "DERIVED_CHANGED ";
}
if ((flag & IResourceDelta.DESCRIPTION) != 0) {
flags += "DESCRIPTION ";
}
if ((flag & IResourceDelta.ENCODING) != 0) {
flags += "ENCODING ";
}
if ((flag & IResourceDelta.LOCAL_CHANGED) != 0) {
flags += "LOCAL_CHANGED ";
}
if ((flag & IResourceDelta.MARKERS) != 0) {
flags += "MARKERS ";
}
if ((flag & IResourceDelta.MOVED_FROM) != 0) {
flags += "MOVED_FROM ";
}
if ((flag & IResourceDelta.MOVED_TO) != 0) {
flags += "MOVED_TO ";
}
if ((flag & IResourceDelta.NO_CHANGE) != 0) {
flags += "NO_CHANGE ";
}
if ((flag & IResourceDelta.OPEN) != 0) {
flags += "OPEN ";
}
if ((flag & IResourceDelta.REMOVED) != 0) {
flags += "REMOVED ";
}
if ((flag & IResourceDelta.REMOVED_PHANTOM) != 0) {
flags += "REMOVED_PHANTOM ";
}
if ((flag & IResourceDelta.REPLACED) != 0) {
flags += "REPLACED ";
}
if ((flag & IResourceDelta.SYNC) != 0) {
flags += "SYNC ";
}
if ((flag & IResourceDelta.TYPE) != 0) {
flags += "TYPE ";
}
return flags;
}