Java源码示例:org.eclipse.xtext.ui.markers.IMarkerContributor

示例1
@Override
public void configure(Binder binder) {
	binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).toInstance("sct");
	binder.bind(IEncodingProvider.class).to(IEncodingProvider.Runtime.class);
	binder.bind(IQualifiedNameProvider.class).to(StextNameProvider.class);
	binder.bind(org.eclipse.jface.viewers.ILabelProvider.class)
			.annotatedWith(org.eclipse.xtext.ui.resource.ResourceServiceDescriptionLabelProvider.class)
			.to(DefaultDescriptionLabelProvider.class);
	binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class);
	
	binder.bind(MarkerCreator.class).to(SCTMarkerCreator.class);
	binder.bind(MarkerTypeProvider.class).to(SCTMarkerTypeProvider.class);
	binder.bind(IDiagnosticConverter.class).to(SCTDiagnosticConverterImpl.class);
	binder.bind(IURIEditorOpener.class).annotatedWith(LanguageSpecific.class).to(SCTFileEditorOpener.class);
	
	binder.bind(IMarkerContributor.class).to(TaskMarkerContributor.class);
	binder.bind(ITaskFinder.class).to(DomainSpecificTaskFinder.class);
	binder.bind(TaskMarkerCreator.class).to(SCTTaskMarkerCreator.class);
	binder.bind(TaskMarkerTypeProvider.class).to(SCTTaskMarkerTypeProvider.class);
}
 
示例2
private void deleteAllContributedMarkers(IFile file, IProgressMonitor monitor) {
	try {
		file.deleteMarkers(IMarkerContributor.MARKER_TYPE, true, IResource.DEPTH_ZERO);
	} catch (CoreException e) {
		LOG.error(e.getMessage(), e);
	}
}
 
示例3
protected IMarkerContributor getMarkerContributor(URI uri) {
	IResourceServiceProvider provider = resourceServiceProviderRegistry.getResourceServiceProvider(uri);
	if (provider != null) {
		return provider.get(IMarkerContributor.class);
	}
	return null;
}
 
示例4
private void deleteAllContributedMarkers(final IFile file, final IProgressMonitor monitor) {
	try {
		file.deleteMarkers(IMarkerContributor.MARKER_TYPE, true, IResource.DEPTH_ZERO);
	} catch (final CoreException e) {
		DEBUG.ERR(e.getMessage());
	}
}
 
示例5
/**
 * @since 2.6
 */
public Class<? extends IMarkerContributor> bindMarkerContributor() {
	return TaskMarkerContributor.class;
}
 
示例6
private void processDelta(Delta delta, /* @Nullable */ ResourceSet resourceSet, IProgressMonitor monitor) throws OperationCanceledException {
	URI uri = delta.getUri();
	IResourceUIValidatorExtension validatorExtension = getResourceUIValidatorExtension(uri);
	IMarkerContributor markerContributor = getMarkerContributor(uri);
	CheckMode normalAndFastMode = CheckMode.NORMAL_AND_FAST;

	for (Pair<IStorage, IProject> pair : mapper.getStorages(uri)) {
		if (monitor.isCanceled()) {
			throw new OperationCanceledException();
		}
		if (pair.getFirst() instanceof IFile) {
			IFile file = (IFile) pair.getFirst();
			
			if (EXTERNAL_PROJECT_NAME.equals(file.getProject().getName())) {
				// if the file is found via the source attachment of a classpath entry, which happens
				//  in case of running a test IDE with bundles from the workspace of the development IDE
				//  (the workspace bundles' bin folder is linked to the classpath of bundles in the test IDE),
				// skip the marker processing of that file, as the user can't react on any markers anyway.
				continue;
			}
			
			if (delta.getNew() != null) {
				if (resourceSet == null)
					throw new IllegalArgumentException("resourceSet may not be null for changed resources.");
				
				Resource resource = resourceSet.getResource(uri, true);
				if (validatorExtension != null) {
					validatorExtension.updateValidationMarkers(file, resource, normalAndFastMode, monitor);
				}
				if (markerContributor != null) {
					markerContributor.updateMarkers(file, resource, monitor);
				}
			} else {
				if (validatorExtension != null) {
					validatorExtension.deleteValidationMarkers(file, normalAndFastMode, monitor);
				} else {
					deleteAllValidationMarker(file, normalAndFastMode, monitor);
				}	
				if (markerContributor != null) {
					markerContributor.deleteMarkers(file, monitor);
				} else {
					deleteAllContributedMarkers(file, monitor);
				}
			}
		}
	}
}
 
示例7
@Override
public void updateMarkers(final Delta delta, final ResourceSet resourceSet, final IProgressMonitor monitor)
		throws OperationCanceledException {

	final URI uri = delta.getUri();
	final IResourceUIValidatorExtension validatorExtension = getResourceUIValidatorExtension(uri);
	final IMarkerContributor markerContributor = getMarkerContributor(uri);
	final CheckMode normalAndFastMode = CheckMode.NORMAL_AND_FAST;

	for (final Pair<IStorage, IProject> pair : mapper.getStorages(uri)) {
		if (monitor.isCanceled()) { throw new OperationCanceledException(); }
		if (pair.getFirst() instanceof IFile) {
			final IFile file = (IFile) pair.getFirst();

			if (delta.getNew() != null) {
				if (resourceSet == null) { throw new IllegalArgumentException(
						"resourceSet may not be null for changed resources."); }

				final Resource resource = resourceSet.getResource(uri, true);

				if (validatorExtension != null) {
					validatorExtension.updateValidationMarkers(file, resource, normalAndFastMode, monitor);
				}
				if (markerContributor != null) {
					markerContributor.updateMarkers(file, resource, monitor);
				}
				// GAMA.getGui().getMetaDataProvider().storeMetadata(file,
				// info.getInfo(resource, file.getModificationStamp()),
				// true);
			} else {
				if (validatorExtension != null) {
					validatorExtension.deleteValidationMarkers(file, normalAndFastMode, monitor);
				} else {
					deleteAllValidationMarker(file, normalAndFastMode, monitor);
				}
				if (markerContributor != null) {
					markerContributor.deleteMarkers(file, monitor);
				} else {
					deleteAllContributedMarkers(file, monitor);
				}
			}
		}
	}

}