当前位置: 首页>>代码示例>>Java>>正文


Java MarkerCreator类代码示例

本文整理汇总了Java中org.eclipse.xtext.ui.editor.validation.MarkerCreator的典型用法代码示例。如果您正苦于以下问题:Java MarkerCreator类的具体用法?Java MarkerCreator怎么用?Java MarkerCreator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MarkerCreator类属于org.eclipse.xtext.ui.editor.validation包,在下文中一共展示了MarkerCreator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newValidationJob

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
private ValidationJob newValidationJob(final XtextEditor editor) {

		final IXtextDocument document = editor.getDocument();
		final IAnnotationModel annotationModel = editor.getInternalSourceViewer().getAnnotationModel();

		final IssueResolutionProvider issueResolutionProvider = getService(editor, IssueResolutionProvider.class);
		final MarkerTypeProvider markerTypeProvider = getService(editor, MarkerTypeProvider.class);
		final MarkerCreator markerCreator = getService(editor, MarkerCreator.class);

		final IValidationIssueProcessor issueProcessor = new CompositeValidationIssueProcessor(
				new AnnotationIssueProcessor(document, annotationModel, issueResolutionProvider),
				new MarkerIssueProcessor(editor.getResource(), markerCreator, markerTypeProvider));

		return editor.getDocument().modify(resource -> {
			final IResourceServiceProvider serviceProvider = resource.getResourceServiceProvider();
			final IResourceValidator resourceValidator = serviceProvider.getResourceValidator();
			return new ValidationJob(resourceValidator, editor.getDocument(), issueProcessor, ALL);
		});
	}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:OwnResourceValidatorAwareValidatingEditorCallback.java

示例2: configure

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
@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);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:SCTXtextIntegrationModule.java

示例3: processMessages

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
/**
 * Processes the messages.
 * 
 * @param result the translation result
 * @throws CoreException in case of marker processing problems
 */
private void processMessages(TranslationResult<?> result) throws CoreException {
    final IResource res = getResource();
    res.deleteMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ZERO);
    DiagnosticConverterImpl conv = new DiagnosticConverterImpl();
    final MarkerCreator markerCreator = new MarkerCreator();
    for (int m = 0; m < result.getMessageCount(); m++) {
        Message message = result.getMessage(m);
        conv.convertValidatorDiagnostic(ValidationUtils.processMessage(message), new IAcceptor<Issue>() {
            
            @Override
            public void accept(Issue issue) {
                try {
                    markerCreator.createMarker(issue, res, IMarker.PROBLEM);
                } catch (CoreException e) {
                    getLogger().exception(e);
                }
            }
        });
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:27,代码来源:CommonXtextEditor.java

示例4: createMarkers

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
private void createMarkers(IFile file, List<Issue> list, MarkerCreator markerCreator,
		MarkerTypeProvider markerTypeProvider) throws CoreException {

	for (Issue issue : list) {
		markerCreator.createMarker(issue, file, markerTypeProvider.getMarkerType(issue));
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:ResourceUIValidatorExtension.java

示例5: validate

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
/**
 * Validate the given resource and create the corresponding markers. The CheckMode is a constant calculated from the constructor
 * parameters.
 * 
 * @param resourceValidator
 *          the resource validator (not null)
 * @param markerCreator
 *          the marker creator
 * @param file
 *          the EFS file (not null)
 * @param resource
 *          the EMF resource (not null)
 * @param monitor
 *          the monitor (not null)
 */
protected void validate(final IResourceValidator resourceValidator, final MarkerCreator markerCreator, final IFile file, final Resource resource, final IProgressMonitor monitor) {
  try {
    monitor.subTask("validating " + file.getName()); //$NON-NLS-1$

    final List<Issue> list = resourceValidator.validate(resource, checkMode, getCancelIndicator(monitor));
    if (list != null) {
      // resourceValidator.validate returns null if canceled (and not an empty list)
      file.deleteMarkers(MarkerTypes.FAST_VALIDATION, true, IResource.DEPTH_ZERO);
      file.deleteMarkers(MarkerTypes.NORMAL_VALIDATION, true, IResource.DEPTH_ZERO);
      file.deleteMarkers(MarkerTypes.EXPENSIVE_VALIDATION, true, IResource.DEPTH_ZERO);

      if (markerCreator != null) {
        for (final Issue issue : list) {
          markerCreator.createMarker(issue, file, MarkerTypes.forCheckType(issue.getType()));
        }
      } else {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.error("Could not create markers. The marker creator is null."); //$NON-NLS-1$
        }
      }
    }
  } catch (final CoreException e) {
    LOGGER.error(e.getMessage(), e);
  } finally {
    monitor.worked(1);
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:43,代码来源:CheckMarkerUpdateJob.java

示例6: getMarkerCreator

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
private MarkerCreator getMarkerCreator(Resource resource) {
	return getService(resource, MarkerCreator.class);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:4,代码来源:ResourceUIValidatorExtension.java

示例7: run

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected IStatus run(final IProgressMonitor monitor) {

  // Let's start (number of task = number of resource * 2 (loading + validating))
  monitor.beginTask("", 2 * this.uris.size()); //$NON-NLS-1$

  for (final URI uri : this.uris) {
    // Last chance to cancel before next validation
    if (monitor.isCanceled()) {
      return Status.CANCEL_STATUS;
    }

    final IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
    if (serviceProvider == null) {
      // This may happen for non-Xtext resources in ice entities
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(MessageFormat.format("Could not validate {0}: no resource service provider found", uri.toString())); //$NON-NLS-1$
      }
      continue; // Skip to next URI
    }

    final IResourceValidator resourceValidator = serviceProvider.getResourceValidator();
    final IStorage2UriMapper uriMapper = serviceProvider.get(IStorage2UriMapper.class);
    final MarkerCreator markerCreator = serviceProvider.get(MarkerCreator.class);

    // Get the file; only local files will be re-validated, derived files are ignored
    final IFile iFile = getFileFromStorageMapper(uriMapper, uri);
    if (iFile == null) {
      continue; // no storage mapping found for this URI
    }

    if (resourceValidator == null) {
      LOGGER.error(MessageFormat.format("Could not validate {0}: no resource validator found", iFile.getName())); //$NON-NLS-1$
    } else if (iFile != null) {
      monitor.subTask("loading " + iFile.getName()); //$NON-NLS-1$

      // Don't try to evaluate resource set before it has been checked that the storage provider contains a mapping
      // for current uri
      final ResourceSet resourceSet = getResourceSet(uriMapper, uri);

      // Load the corresponding resource
      boolean loaded = false;
      Resource eResource = null;
      try {
        eResource = resourceSet.getResource(uri, false);
        if ((eResource == null) || (eResource != null && !eResource.isLoaded())) {
          // if the resource does not exist in the resource set, or is not loaded yet
          // load it.
          eResource = resourceSet.getResource(uri, true);
          loaded = true;
        }
        monitor.worked(1);
        // CHECKSTYLE:OFF
      } catch (final RuntimeException e) {
        // CHECKSTYLE:ON
        LOGGER.error(MessageFormat.format("{0} could not be validated.", iFile.getName()), e); //$NON-NLS-1$
      } finally {
        if (eResource != null) {
          validate(resourceValidator, markerCreator, iFile, eResource, monitor);
          LOGGER.debug("Validated " + uri); //$NON-NLS-1$
          if (loaded) { // NOPMD
            // unload any resource that was previously loaded as part of this loop.
            eResource.unload();
          }
        }
      }
    }
  }

  monitor.done();

  return Status.OK_STATUS;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:75,代码来源:CheckMarkerUpdateJob.java

示例8: bindMarkerCreator

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
public Class<? extends MarkerCreator> bindMarkerCreator() {
	return SCTMarkerCreator.class;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:4,代码来源:GenericEditorModule.java

示例9: ValidMarkerUpdateJob

import org.eclipse.xtext.ui.editor.validation.MarkerCreator; //导入依赖的package包/类
/**
 * Instantiates a new valid marker update job.
 *
 * @param name
 *          the name
 * @param fileExtensions
 *          the file extensions
 * @param resourceSet
 *          the resource set
 * @param markerCreator
 *          the marker creator
 * @param resourceDescriptions
 *          the resource descriptions
 * @param resourceServiceProvider
 *          the resource service provider
 * @param performExpensiveValidation
 *          true if expensive validation should be performed, false otherwise
 */
public ValidMarkerUpdateJob(final String name, final String fileExtensions, final ResourceSet resourceSet, final MarkerCreator markerCreator, final IResourceDescriptions resourceDescriptions, final IResourceServiceProvider resourceServiceProvider, final boolean performExpensiveValidation, final IStorage2UriMapper storage2UriMapper) {
  super(name + " " + fileExtensions); //$NON-NLS-1$

  this.fileExtensions = fileExtensions;
  this.resourceSet = resourceSet;
  this.markerCreator = markerCreator;
  this.resourceDescriptions = resourceDescriptions;
  this.resourceServiceProvider = resourceServiceProvider;
  this.performExpensiveValidation = performExpensiveValidation;
  this.checkMode = performExpensiveValidation ? CheckMode.ALL : CheckMode.NORMAL_AND_FAST;
  this.storage2UriMapper = storage2UriMapper;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:31,代码来源:ValidMarkerUpdateJob.java


注:本文中的org.eclipse.xtext.ui.editor.validation.MarkerCreator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。