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


Java Issue.getData方法代码示例

本文整理汇总了Java中org.eclipse.xtext.validation.Issue.getData方法的典型用法代码示例。如果您正苦于以下问题:Java Issue.getData方法的具体用法?Java Issue.getData怎么用?Java Issue.getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.validation.Issue的用法示例。


在下文中一共展示了Issue.getData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fixIllegalDefaultSeverity

import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
/**
 * Fixes an illegally set default severity. The default severity must be within given severity range.
 *
 * @param issue
 *          the issue
 * @param acceptor
 *          the acceptor
 */
@Fix(IssueCodes.DEFAULT_SEVERITY_NOT_IN_RANGE)
public void fixIllegalDefaultSeverity(final Issue issue, final IssueResolutionAcceptor acceptor) {
  if (issue.getData() != null) {
    for (final String severityProposal : issue.getData()) {
      final String label = NLS.bind(Messages.CheckQuickfixProvider_DEFAULT_SEVERITY_FIX_LABEL, severityProposal);
      final String descn = NLS.bind(Messages.CheckQuickfixProvider_DEFAULT_SEVERITY_FIX_DESCN, severityProposal);

      acceptor.accept(issue, label, descn, NO_IMAGE, new IModification() {
        @Override
        public void apply(final IModificationContext context) throws BadLocationException {
          IXtextDocument xtextDocument = context.getXtextDocument();
          xtextDocument.replace(issue.getOffset(), issue.getLength(), severityProposal);
        }
      });
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:26,代码来源:CheckQuickfixProvider.java

示例2: fixSeverityToMaxSeverity

import org.eclipse.xtext.validation.Issue; //导入方法依赖的package包/类
/**
 * Fix severity by setting it to a legal value as is defined by severity range of referenced check. Legal
 * severities are passed as issue data (org.eclipse.xtext.validation.Issue#getData()).
 * 
 * @param issue
 *          the issue
 * @param acceptor
 *          the acceptor
 */
@Fix(IssueCodes.SEVERITY_NOT_ALLOWED)
public void fixSeverityToMaxSeverity(final Issue issue, final IssueResolutionAcceptor acceptor) {
  if (issue.getData() != null) {
    for (final String severityProposal : issue.getData()) {
      final String label = NLS.bind(Messages.CheckCfgQuickfixProvider_CORRECT_SEVERITY_LABEL, severityProposal);
      final String descn = NLS.bind(Messages.CheckCfgQuickfixProvider_CORRECT_SEVERITY_DESCN, severityProposal);

      acceptor.accept(issue, label, descn, NO_IMAGE, new IModification() {
        public void apply(final IModificationContext context) throws BadLocationException {
          IXtextDocument xtextDocument = context.getXtextDocument();
          xtextDocument.replace(issue.getOffset(), issue.getLength(), severityProposal);
        }
      });
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:26,代码来源:CheckCfgQuickfixProvider.java


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