• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java IProblemRequestor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getPerWorkingCopyInfo

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public PerWorkingCopyInfo getPerWorkingCopyInfo(
    CompilationUnit workingCopy,
    boolean create,
    boolean recordUsage,
    IProblemRequestor problemRequestor) {
  synchronized (
      this.perWorkingCopyInfos) { // use the perWorkingCopyInfo collection as its own lock
    WorkingCopyOwner owner = workingCopy.owner;
    Map workingCopyToInfos = (Map) this.perWorkingCopyInfos.get(owner);
    if (workingCopyToInfos == null && create) {
      workingCopyToInfos = new HashMap();
      this.perWorkingCopyInfos.put(owner, workingCopyToInfos);
    }

    PerWorkingCopyInfo info =
        workingCopyToInfos == null
            ? null
            : (PerWorkingCopyInfo) workingCopyToInfos.get(workingCopy);
    if (info == null && create) {
      info = new PerWorkingCopyInfo(workingCopy, problemRequestor);
      workingCopyToInfos.put(workingCopy, info);
    }
    if (info != null && recordUsage) info.useCount++;
    return info;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:JavaModelManager.java


示例2: reportProblems

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
/**
 * Report working copy problems to a given requestor.
 *
 * @param workingCopy
 * @param problemRequestor
 */
private void reportProblems(CompilationUnit workingCopy, IProblemRequestor problemRequestor) {
  try {
    problemRequestor.beginReporting();
    for (Iterator iteraror = this.problems.values().iterator(); iteraror.hasNext(); ) {
      CategorizedProblem[] categorizedProblems = (CategorizedProblem[]) iteraror.next();
      if (categorizedProblems == null) continue;
      for (int i = 0, length = categorizedProblems.length; i < length; i++) {
        CategorizedProblem problem = categorizedProblems[i];
        if (JavaModelManager.VERBOSE) {
          System.out.println(
              "PROBLEM FOUND while reconciling : " + problem.getMessage()); // $NON-NLS-1$
        }
        if (this.progressMonitor != null && this.progressMonitor.isCanceled()) break;
        problemRequestor.acceptProblem(problem);
      }
    }
  } finally {
    problemRequestor.endReporting();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ReconcileWorkingCopyOperation.java


示例3: accept

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public void accept(SpellingProblem problem) {
	IProblemRequestor requestor= fRequestor;
	if (requestor != null) {
		try {
			int line= getDocument().getLineOfOffset(problem.getOffset()) + 1;
			String word= getDocument().get(problem.getOffset(), problem.getLength());
			boolean dictionaryMatch= false;
			boolean sentenceStart= false;
			if (problem instanceof JavaSpellingProblem) {
				dictionaryMatch= ((JavaSpellingProblem)problem).isDictionaryMatch();
				sentenceStart= ((JavaSpellingProblem) problem).isSentenceStart();
			}
			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=81514
			IEditorInput editorInput= fEditor.getEditorInput();
			if (editorInput != null) {
				CoreSpellingProblem iProblem= new CoreSpellingProblem(problem.getOffset(), problem.getOffset() + problem.getLength() - 1, line, problem.getMessage(), word, dictionaryMatch, sentenceStart, getDocument(), editorInput.getName());
				requestor.acceptProblem(iProblem);
			}
		} catch (BadLocationException x) {
			// drop this SpellingProblem
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaSpellingReconcileStrategy.java


示例4: collectCorrections2

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
protected static final ArrayList collectCorrections2(ICompilationUnit cu, int nProblems)
    throws CoreException {

  final ArrayList problemsList = new ArrayList();
  final IProblemRequestor requestor =
      new IProblemRequestor() {
        public void acceptProblem(IProblem problem) {
          problemsList.add(problem);
        }

        public void beginReporting() {
          problemsList.clear();
        }

        public void endReporting() {}

        public boolean isActive() {
          return true;
        }
      };

  WorkingCopyOwner workingCopyOwner =
      new WorkingCopyOwner() {
        public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) {
          return requestor;
        }
      };
  ICompilationUnit wc = cu.getWorkingCopy(workingCopyOwner, null);
  try {
    wc.reconcile(ICompilationUnit.NO_AST, true, true, wc.getOwner(), null);
  } finally {
    wc.discardWorkingCopy();
  }

  IProblem[] problems = (IProblem[]) problemsList.toArray(new IProblem[problemsList.size()]);
  assertNumberOfProblems(nProblems, problems);

  return collectCorrections(cu, problems[0], null);
}
 
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:QuickFixTest.java


示例5: toString

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public String toString() {
  StringBuffer buffer = new StringBuffer();
  buffer.append("Info for "); // $NON-NLS-1$
  buffer.append(((JavaElement) this.workingCopy).toStringWithAncestors());
  buffer.append("\nUse count = "); // $NON-NLS-1$
  buffer.append(this.useCount);
  buffer.append("\nProblem requestor:\n  "); // $NON-NLS-1$
  buffer.append(this.problemRequestor);
  if (this.problemRequestor == null) {
    IProblemRequestor requestor = getProblemRequestor();
    buffer.append("\nOwner problem requestor:\n  "); // $NON-NLS-1$
    buffer.append(requestor);
  }
  return buffer.toString();
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:JavaModelManager.java


示例6: createWorkingCopyOwner

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
private WorkingCopyOwner createWorkingCopyOwner(ProblemRequestor problemRequestor) {
  return new WorkingCopyOwner() {
    public IProblemRequestor getProblemRequestor(ICompilationUnit unit) {
      return problemRequestor;
    }

    @Override
    public IBuffer createBuffer(ICompilationUnit workingCopy) {
      return new DocumentAdapter(workingCopy, (IFile) workingCopy.getResource());
    }
  };
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:JavaReconciler.java


示例7: getWorkingCopy

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public ICompilationUnit getWorkingCopy(String path, String source, WorkingCopyOwner owner) throws JavaModelException {
	ICompilationUnit workingCopy = getCompilationUnit(path);
	if (owner != null)
		workingCopy = workingCopy.getWorkingCopy(owner, null/*no progress monitor*/);
	else
		workingCopy.becomeWorkingCopy(null/*no progress monitor*/);
	workingCopy.getBuffer().setContents(source);
	IProblemRequestor problemRequestor = owner.getProblemRequestor(workingCopy);
	if (problemRequestor instanceof ProblemRequestor) {
		((ProblemRequestor) problemRequestor).initialize(source.toCharArray());
	}
	workingCopy.makeConsistent(null/*no progress monitor*/);
	return workingCopy;
}
 
开发者ID:jwloka,项目名称:reflectify,代码行数:15,代码来源:AbstractJavaModelTests.java


示例8: newExternalWorkingCopy

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
protected ICompilationUnit newExternalWorkingCopy(String name, IClasspathEntry[] classpath, final IProblemRequestor problemRequestor, final String contents) throws JavaModelException {
	WorkingCopyOwner owner = new WorkingCopyOwner() {
		public IBuffer createBuffer(ICompilationUnit wc) {
			IBuffer buffer = super.createBuffer(wc);
			buffer.setContents(contents);
			return buffer;
		}
		public IProblemRequestor getProblemRequestor(ICompilationUnit workingCopy) {
			return problemRequestor;
		}
	};
	return owner.newWorkingCopy(name, classpath, null/*no progress monitor*/);
}
 
开发者ID:jwloka,项目名称:reflectify,代码行数:14,代码来源:AbstractJavaModelTests.java


示例9: newWorkingCopyOwner

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
/**
 * Create a new working copy owner using given problem requestor
 * to report problem.
 *
 * @param problemRequestor The requestor used to report problems
 * @return The created working copy owner
 */
protected WorkingCopyOwner newWorkingCopyOwner(final IProblemRequestor problemRequestor) {
	return new WorkingCopyOwner() {
		public IProblemRequestor getProblemRequestor(ICompilationUnit unit) {
			return problemRequestor;
		}
	};
}
 
开发者ID:jwloka,项目名称:reflectify,代码行数:15,代码来源:AbstractJavaModelTests.java


示例10: getProblemRequestor

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
@Override
public IProblemRequestor getProblemRequestor(ICompilationUnit cu) {
	return new DiagnosticsHandler(connection, cu);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:5,代码来源:LanguageServerWorkingCopyOwner.java


示例11: PerWorkingCopyInfo

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public PerWorkingCopyInfo(CompilationUnit workingCopy, IProblemRequestor problemRequestor) {
  this.workingCopy = workingCopy;
  this.problemRequestor = problemRequestor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:JavaModelManager.java


示例12: acceptProblem

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public void acceptProblem(IProblem problem) {
  IProblemRequestor requestor = getProblemRequestor();
  if (requestor == null) return;
  requestor.acceptProblem(problem);
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:JavaModelManager.java


示例13: beginReporting

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public void beginReporting() {
  IProblemRequestor requestor = getProblemRequestor();
  if (requestor == null) return;
  requestor.beginReporting();
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:JavaModelManager.java


示例14: endReporting

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public void endReporting() {
  IProblemRequestor requestor = getProblemRequestor();
  if (requestor == null) return;
  requestor.endReporting();
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:JavaModelManager.java


示例15: getProblemRequestor

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public IProblemRequestor getProblemRequestor() {
  if (this.problemRequestor == null && this.workingCopy.owner != null) {
    return this.workingCopy.owner.getProblemRequestor(this.workingCopy);
  }
  return this.problemRequestor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:JavaModelManager.java


示例16: isActive

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public boolean isActive() {
  IProblemRequestor requestor = getProblemRequestor();
  return requestor != null && requestor.isActive();
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:JavaModelManager.java


示例17: executeOperation

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
/**
 * @throws org.eclipse.jdt.core.JavaModelException if setting the source of the original
 *     compilation unit fails
 */
protected void executeOperation() throws JavaModelException {
  checkCanceled();
  try {
    beginTask(Messages.element_reconciling, 2);

    CompilationUnit workingCopy = getWorkingCopy();
    boolean wasConsistent = workingCopy.isConsistent();

    // check is problem requestor is active
    IProblemRequestor problemRequestor = workingCopy.getPerWorkingCopyInfo();
    if (problemRequestor != null)
      problemRequestor =
          ((JavaModelManager.PerWorkingCopyInfo) problemRequestor).getProblemRequestor();
    boolean defaultRequestorIsActive = problemRequestor != null && problemRequestor.isActive();
    IProblemRequestor ownerProblemRequestor =
        this.workingCopyOwner.getProblemRequestor(workingCopy);
    boolean ownerRequestorIsActive =
        ownerProblemRequestor != null
            && ownerProblemRequestor != problemRequestor
            && ownerProblemRequestor.isActive();
    this.requestorIsActive = defaultRequestorIsActive || ownerRequestorIsActive;

    // create the delta builder (this remembers the current content of the cu)
    this.deltaBuilder = new JavaElementDeltaBuilder(workingCopy);

    // make working copy consistent if needed and compute AST if needed
    makeConsistent(workingCopy);

    // notify reconcile participants only if working copy was not consistent or if forcing problem
    // detection
    // (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=177319)
    if (!wasConsistent
        || ((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0)) {
      notifyParticipants(workingCopy);

      // recreate ast if one participant reset it
      if (this.ast == null) makeConsistent(workingCopy);
    }

    // report problems
    if (this.problems != null
        && (((this.reconcileFlags & ICompilationUnit.FORCE_PROBLEM_DETECTION) != 0)
            || !wasConsistent)) {
      if (defaultRequestorIsActive) {
        reportProblems(workingCopy, problemRequestor);
      }
      if (ownerRequestorIsActive) {
        reportProblems(workingCopy, ownerProblemRequestor);
      }
    }

    // report delta
    JavaElementDelta delta = this.deltaBuilder.delta;
    if (delta != null) {
      addReconcileDelta(workingCopy, delta);
    }
  } finally {
    done();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:65,代码来源:ReconcileWorkingCopyOperation.java


示例18: BecomeWorkingCopyOperation

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
public BecomeWorkingCopyOperation(
    CompilationUnit workingCopy, IProblemRequestor problemRequestor) {
  super(new IJavaElement[] {workingCopy});
  this.problemRequestor = problemRequestor;
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:BecomeWorkingCopyOperation.java


示例19: becomeWorkingCopy

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void becomeWorkingCopy(final IProblemRequestor problemRequestor, final IProgressMonitor monitor) throws JavaModelException {
  compilationUnit.becomeWorkingCopy(problemRequestor, monitor);
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:8,代码来源:AbstractCompilationUnitDecorator.java


示例20: getSharedWorkingCopy

import org.eclipse.jdt.core.IProblemRequestor; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public IJavaElement getSharedWorkingCopy(final IProgressMonitor monitor, final IBufferFactory factory, final IProblemRequestor problemRequestor) throws JavaModelException {
  return compilationUnit.getSharedWorkingCopy(monitor, factory, problemRequestor);
}
 
开发者ID:sealuzh,项目名称:PerformanceHat,代码行数:8,代码来源:AbstractCompilationUnitDecorator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MessageFormatter类代码示例发布时间:2022-05-23
下一篇:
Java BasicElementLabels类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap