public static SearchResultGroup[] createFakeSearchResult(SearchResultGroup[] returnValue, Object/* * org.eclipse.jdt.internal.corext.refactoring.rename. * RenameFieldProcessor */ processor) throws Exception { if (returnValue == null || returnValue.length == 0) { // if no matches were found, check if Data annotation is present on the class Field declaredField = processor.getClass().getDeclaredField("fField"); if (declaredField != null) { declaredField.setAccessible(true); SourceField fField = (SourceField) declaredField.get(processor); IAnnotation dataAnnotation = fField.getDeclaringType().getAnnotation("Data"); if (dataAnnotation != null) { // add fake item, to make refactoring checks pass return new SearchResultGroup[] {new SearchResultGroup(null, new SearchMatch[1])}; } } } return returnValue; }
public ISourceRange getSourceRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // ensure the class file's buffer is open so that source ranges are computed ClassFile classFile = (ClassFile)getClassFile(); if (classFile != null) { classFile.getBuffer(); return mapper.getSourceRange(this); } } return super.getSourceRange(); }
@Override public void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor monitor) throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); JavaModelManager.PerWorkingCopyInfo perWorkingCopyInfo = manager.getPerWorkingCopyInfo(this, false/*don't create*/, true /*record usage*/, null/*no problem requestor needed*/); if (perWorkingCopyInfo == null) { // close cu and its children close(); BecomeWorkingCopyOperation operation = new BecomeWorkingCopyOperation(this, problemRequestor); operation.runOperation(monitor); } }
int internalKind() throws JavaModelException { JavaModelManager manager = JavaModelManager.getJavaModelManager(); PackageFragmentRootInfo info = (PackageFragmentRootInfo) manager.peekAtInfo(this); if (info == null) { info = (PackageFragmentRootInfo) openWhenClosed(createElementInfo(), false, null); } return info.getRootKind(); }
public ISourceRange getSourceRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // ensure the class file's buffer is open so that source ranges are computed ClassFile classFile = (ClassFile)getClassFile(); if (classFile != null) { classFile.getBuffer(); return mapper.getSourceRange(this); } } return super.getSourceRange(); }
public IBuffer getBuffer() throws JavaModelException { if (isWorkingCopy()) return super.getBuffer(); else return this.classFile.getBuffer(); }
public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException { JavadocContents javadocContents = ((BinaryType) this.getDeclaringType()).getJavadocContents(monitor); if (javadocContents == null) return null; return javadocContents.getFieldDoc(this); } }
public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException { JavadocContents javadocContents = ((BinaryType) this.getDeclaringType()).getJavadocContents(monitor); if (javadocContents == null) return null; return javadocContents.getMethodDoc(this); } }
/** * @see IWorkingCopy#getSharedWorkingCopy(IProgressMonitor, IBufferFactory, IProblemRequestor) * @deprecated */ @Override public IJavaElement getSharedWorkingCopy(IProgressMonitor pm, IBufferFactory factory, IProblemRequestor problemRequestor) throws JavaModelException { // if factory is null, default factory must be used if (factory == null) factory = getBufferManager().getDefaultBufferFactory(); return getWorkingCopy(BufferFactoryWrapper.create(factory), problemRequestor, pm); } /**
public IJavaElement getPrimaryElement(boolean checkOwner) { CompilationUnit cu = (CompilationUnit)this.parent.getParent(); if (checkOwner && cu.isPrimary()) return this; return cu.getImport(getElementName()); } /**
public ISourceRange getNameRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // ensure the class file's buffer is open so that source ranges are computed ((ClassFile)getClassFile()).getBuffer(); return mapper.getNameRange(this); } else { return SourceMapper.UNKNOWN_RANGE; } } /*
/** * @see IWorkingCopy#findSharedWorkingCopy(IBufferFactory) * @deprecated */ public IJavaElement findSharedWorkingCopy(IBufferFactory factory) { // if factory is null, default factory must be used if (factory == null) factory = getBufferManager().getDefaultBufferFactory(); return findWorkingCopy(BufferFactoryWrapper.create(factory)); }
public static LambdaExpression createLambdaExpression(JavaElement parent, org.eclipse.jdt.internal.compiler.ast.LambdaExpression lambdaExpression) { if (isBinaryMember(parent)){ return new BinaryLambdaExpression(parent, lambdaExpression); } else { return new LambdaExpression(parent, lambdaExpression); } }
public IBuffer getBuffer() throws JavaModelException { if (isWorkingCopy()) return super.getBuffer(); else return this.classFile.getBuffer(); }
@Override public ISourceRange getSourceRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // ensure the class file's buffer is open so that source ranges are computed ((ModularClassFile)getClassFile()).getBuffer(); return mapper.getSourceRange(this); } else { return SourceMapper.UNKNOWN_RANGE; } } public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException {
public ISourceRange getSourceRange() throws JavaModelException { SourceMapper mapper= getSourceMapper(); if (mapper != null) { // ensure the class file's buffer is open so that source ranges are computed ClassFile classFile = (ClassFile)getClassFile(); if (classFile != null) { classFile.getBuffer(); return mapper.getSourceRange(this); } } return super.getSourceRange(); }
public IBuffer getBuffer() throws JavaModelException { if (isWorkingCopy()) return super.getBuffer(); else return this.classFile.getBuffer(); }
@Override public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException { JavadocContents javadocContents = ((BinaryType) this.getDeclaringType()).getJavadocContents(monitor); if (javadocContents == null) return null; return javadocContents.getFieldDoc(this); } }
public String getAttachedJavadoc(IProgressMonitor monitor) throws JavaModelException { JavadocContents javadocContents = ((BinaryType) this.getDeclaringType()).getJavadocContents(monitor); if (javadocContents == null) return null; return javadocContents.getMethodDoc(this); } }
public static LambdaExpression createLambdaExpression(JavaElement parent, org.eclipse.jdt.internal.compiler.ast.LambdaExpression lambdaExpression) { if (isBinaryMember(parent)){ return new BinaryLambdaExpression(parent, lambdaExpression); } else { return new LambdaExpression(parent, lambdaExpression); } }