本文整理汇总了Java中org.eclipse.jdt.core.search.SearchMatch.isInsideDocComment方法的典型用法代码示例。如果您正苦于以下问题:Java SearchMatch.isInsideDocComment方法的具体用法?Java SearchMatch.isInsideDocComment怎么用?Java SearchMatch.isInsideDocComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.search.SearchMatch
的用法示例。
在下文中一共展示了SearchMatch.isInsideDocComment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rewriteCompilationUnit
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
protected void rewriteCompilationUnit(ICompilationUnit unit,
Collection matches, CompilationUnit node, RefactoringStatus status,
IProgressMonitor monitor) throws CoreException {
final ASTRewrite astRewrite = ASTRewrite.create(node.getAST());
final ImportRewrite importRewrite = ImportRewrite.create(node, true);
for (final Iterator it = matches.iterator(); it.hasNext();) {
final SearchMatch match = (SearchMatch) it.next();
if (match.getAccuracy() == SearchMatch.A_ACCURATE
&& !match.isInsideDocComment())
if (this.matchToPurposeMap.get(match) == SearchMatchPurpose.ALTER_TYPE_DECLARATION
|| this.matchToPurposeMap.get(match) == SearchMatchPurpose.ALTER_NAMESPACE_PREFIX)
this.rewriteDeclarationsAndNamespaces(node, match, status,
astRewrite, importRewrite);
else if (this.matchToPurposeMap.get(match) == SearchMatchPurpose.ALTER_INFIX_EXPRESSION)
this.rewriteExpressions(node, match, status, astRewrite,
importRewrite);
}
this.rewriteAST(unit, astRewrite, importRewrite);
}
开发者ID:ponder-lab,项目名称:Constants-to-Enum-Eclipse-Plugin,代码行数:22,代码来源:ConvertConstantsToEnumRefactoring.java
示例2: toString
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuffer buf = new StringBuffer(fResouce.getFullPath().toString());
buf.append('\n');
for (int i = 0; i < fSearchMatches.size(); i++) {
SearchMatch match = fSearchMatches.get(i);
buf.append(" ")
.append(match.getOffset())
.append(", ")
.append(match.getLength()); // $NON-NLS-1$//$NON-NLS-2$
buf.append(
match.getAccuracy() == SearchMatch.A_ACCURATE
? "; acc"
: "; inacc"); // $NON-NLS-1$//$NON-NLS-2$
if (match.isInsideDocComment()) buf.append("; inDoc"); // $NON-NLS-1$
if (match.getElement() instanceof IJavaElement)
buf.append("; in: ")
.append(((IJavaElement) match.getElement()).getElementName()); // $NON-NLS-1$
buf.append('\n');
}
return buf.toString();
}
示例3: findParameters
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
private void findParameters(final int paramNumber, SearchPattern pattern)
throws CoreException {
final SearchRequestor requestor = new SearchRequestor() {
public void acceptSearchMatch(SearchMatch match)
throws CoreException {
if (match.getAccuracy() == SearchMatch.A_ACCURATE
&& !match.isInsideDocComment()) {
IJavaElement elem = (IJavaElement) match.getElement();
ASTNode node = Util.getASTNode(elem,
ASTNodeProcessor.this.monitor);
ParameterProcessingVisitor visitor = new ParameterProcessingVisitor(
paramNumber, match.getOffset());
node.accept(visitor);
ASTNodeProcessor.this.found.addAll(visitor.getElements());
for (Iterator it = visitor.getExpressions().iterator(); it
.hasNext();) {
Expression exp = (Expression) it.next();
ASTNodeProcessor.this.processExpression(exp);
}
}
}
};
final SearchEngine searchEngine = new SearchEngine();
searchEngine.search(pattern, new SearchParticipant[] { SearchEngine
.getDefaultSearchParticipant() }, this.scope, requestor, null);
}
示例4: acceptSearchMatch
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (match.getAccuracy() == SearchMatch.A_ACCURATE && !match.isInsideDocComment()) {
Object element = match.getElement();
if (element instanceof IType || element instanceof IMethod) {
IMember member = (IMember) element;
IType type =
member.getElementType() == IJavaElement.TYPE
? (IType) member
: member.getDeclaringType();
addTypeAndSubtypes(type);
}
}
}
示例5: acceptSearchMatch
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (match.isInsideDocComment()) {
return;
}
if (match.getElement() != null && match.getElement() instanceof IJavaElement) {
IJavaElement member = (IJavaElement) match.getElement();
if(!searchElements.contains(member)) {
addMatch(match);
searchElements.add(member);
}
}
}
示例6: acceptSearchMatch
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (match.isInsideDocComment())
return;
// get the AST node corresponding to the field
// access. It should be some kind of name
// (simple of qualified).
ASTNode node = ASTNodeSearchUtil.getAstNode(match,
processor.getCompilationUnit(((IMember) match.getElement()).getTypeRoot(),
new SubProgressMonitor(monitor.orElseGet(NullProgressMonitor::new), IProgressMonitor.UNKNOWN)));
// examine the node's parent.
ASTNode parent = node.getParent();
switch (parent.getNodeType()) {
case ASTNode.FIELD_ACCESS: {
FieldAccess fieldAccess = (FieldAccess) parent;
// the expression is the LHS of the
// selection operator.
Expression expression = fieldAccess.getExpression();
if (expression == null || expression.getNodeType() == ASTNode.THIS_EXPRESSION)
// either there is nothing on the LHS
// or it's this, in which case we fail.
this.accessesFieldsFromImplicitParameter = true;
break;
}
case ASTNode.SUPER_FIELD_ACCESS: {
// super will also tell us that it's an
// instance field access of this.
this.accessesFieldsFromImplicitParameter = true;
break;
}
default: {
// it must be an unqualified field access,
// meaning that it's an instance field access of this.
this.accessesFieldsFromImplicitParameter = true;
}
}
}
开发者ID:ponder-lab,项目名称:Migrate-Skeletal-Implementation-to-Interface-Refactoring,代码行数:44,代码来源:FieldAccessAnalysisSearchRequestor.java
示例7: getAffectedCompilationUnits
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
@Override
public ICompilationUnit[] getAffectedCompilationUnits(
final RefactoringStatus status, ReferencesInBinaryContext binaryRefs, IProgressMonitor pm)
throws CoreException {
IMethod method = (IMethod) fMethodBinding.getJavaElement();
Assert.isTrue(method != null);
SearchPattern pattern =
SearchPattern.createPattern(
method, IJavaSearchConstants.REFERENCES, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
IJavaSearchScope scope = RefactoringScopeFactory.create(method, true, false);
final HashSet<ICompilationUnit> affectedCompilationUnits = new HashSet<ICompilationUnit>();
CollectingSearchRequestor requestor =
new CollectingSearchRequestor(binaryRefs) {
private ICompilationUnit fLastCU;
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (filterMatch(match)) return;
if (match.isInsideDocComment())
return; // TODO: should warn user (with something like a ReferencesInBinaryContext)
ICompilationUnit unit = SearchUtils.getCompilationUnit(match);
if (match.getAccuracy() == SearchMatch.A_INACCURATE) {
if (unit != null) {
status.addError(
RefactoringCoreMessages.TargetProvider_inaccurate_match,
JavaStatusContext.create(
unit, new SourceRange(match.getOffset(), match.getLength())));
} else {
status.addError(RefactoringCoreMessages.TargetProvider_inaccurate_match);
}
} else if (unit != null) {
if (!unit.equals(fLastCU)) {
fLastCU = unit;
affectedCompilationUnits.add(unit);
}
}
}
};
new SearchEngine()
.search(
pattern,
SearchUtils.getDefaultSearchParticipants(),
scope,
requestor,
new SubProgressMonitor(pm, 1));
return affectedCompilationUnits.toArray(
new ICompilationUnit[affectedCompilationUnits.size()]);
}
示例8: acceptSearchMatch
import org.eclipse.jdt.core.search.SearchMatch; //导入方法依赖的package包/类
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (filterMatch(match)) return;
/*
* Processing is done in collector to reuse the buffer which was
* already required by the search engine to locate the matches.
*/
// [start, end[ include qualification.
IJavaElement element = SearchUtils.getEnclosingJavaElement(match);
int accuracy = match.getAccuracy();
int start = match.getOffset();
int length = match.getLength();
boolean insideDocComment = match.isInsideDocComment();
IResource res = match.getResource();
if (element.getAncestor(IJavaElement.IMPORT_DECLARATION) != null) {
collectMatch(
TypeReference.createImportReference(
element, accuracy, start, length, insideDocComment, res));
} else {
ICompilationUnit unit =
(ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT);
if (unit != null) {
IBuffer buffer = unit.getBuffer();
String matchText = buffer.getText(start, length);
if (fSource.isDefaultPackage()) {
collectMatch(
TypeReference.createSimpleReference(
element, accuracy, start, length, insideDocComment, res, matchText));
} else {
// assert: matchText doesn't start nor end with comment
int simpleNameStart = getLastSimpleNameStart(matchText);
if (simpleNameStart != 0) {
collectMatch(
TypeReference.createQualifiedReference(
element,
accuracy,
start,
length,
insideDocComment,
res,
start + simpleNameStart));
} else {
collectMatch(
TypeReference.createSimpleReference(
element, accuracy, start, length, insideDocComment, res, matchText));
}
}
}
}
}