/** * Returns the extracted methods from the compilation unit. * * @param unit * the compilation unit * @return the extracted methods */ protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) { Assert.isNotNull(unit); final List list= new ArrayList(); for (int index= 0; index < fMembers.length; index++) { if (fMembers[index] instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMembers[index]); if (element instanceof IMethod) list.add(element); } } final IMethod[] methods= new IMethod[list.size()]; list.toArray(methods); return methods; }
/** * Returns the extracted fields from the compilation unit. * * @param unit * the compilation unit * @return the extracted fields */ protected final IField[] getExtractedFields(final ICompilationUnit unit) { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (int index= 0; index < fMembers.length; index++) { if (fMembers[index] instanceof IField) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMembers[index]); if (element instanceof IField) list.add(element); } } final IField[] fields= new IField[list.size()]; list.toArray(fields); return fields; }
/** * Returns the extracted fields from the compilation unit. * * @param unit * the compilation unit * @return the extracted fields */ protected final IField[] getExtractedFields(final ICompilationUnit unit) { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (int index= 0; index < fMembers.length; index++) { if (fMembers[index] instanceof IField) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMembers[index]); if (element instanceof IField) list.add(element); } } final IField[] fields= new IField[list.size()]; list.toArray(fields); return fields; }
/** * Returns the extracted fields from the compilation unit. * * @param unit * the compilation unit * @return the extracted fields */ protected final IField[] getExtractedFields(final ICompilationUnit unit) { Assert.isNotNull(unit); final List list= new ArrayList(); for (int index= 0; index < fMembers.length; index++) { if (fMembers[index] instanceof IField) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMembers[index]); if (element instanceof IField) list.add(element); } } final IField[] fields= new IField[list.size()]; list.toArray(fields); return fields; }
/** * Returns the extracted methods from the compilation unit except the default methods. * * @param unit the compilation unit * @return the extracted methods except the default method * @throws JavaModelException if the element does not exist */ protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) throws JavaModelException { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (int index= 0; index < fMembers.length; index++) { if (fMembers[index] instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMembers[index]); if (element instanceof IMethod && !JdtFlags.isDefaultMethod((IMethod) element)) list.add(element); } } return list.toArray(new IMethod[list.size()]); }
/** * Returns the extracted methods from the compilation unit except the default methods. * * @param unit the compilation unit * @return the extracted methods except the default method * @throws JavaModelException if the element does not exist */ protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) throws JavaModelException { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (int index= 0; index < fMembers.length; index++) { if (fMembers[index] instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMembers[index]); if (element instanceof IMethod && !JdtFlags.isDefaultMethod((IMethod) element)) list.add(element); } } return list.toArray(new IMethod[list.size()]); }
private IField getFieldInWorkingCopy(ICompilationUnit newWorkingCopyOfDeclaringCu, String elementName) { IType type= fField.getDeclaringType(); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newWorkingCopyOfDeclaringCu, type); if (typeWc == null) { return null; } return typeWc.getField(elementName); }
private IField getFieldInWorkingCopy(ICompilationUnit newWorkingCopyOfDeclaringCu, String elementName) { IType type= fField.getDeclaringType(); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newWorkingCopyOfDeclaringCu, type); if (typeWc == null) return null; return typeWc.getField(elementName); }
private IField getFieldInWorkingCopy(ICompilationUnit newWorkingCopyOfDeclaringCu, String elementName) { IType type= fField.getDeclaringType(); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newWorkingCopyOfDeclaringCu, type); if (typeWc == null) return null; return typeWc.getField(elementName); }
private IField getFieldInWorkingCopy(ICompilationUnit newWorkingCopyOfDeclaringCu, String elementName) throws CoreException{ IType type= fField.getDeclaringType(); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newWorkingCopyOfDeclaringCu, type); if (typeWc == null) return null; return typeWc.getField(elementName); }
IMethod method= iter.next(); ICompilationUnit newCu= RenameAnalyzeUtil.findWorkingCopyForCu(newDeclarationWCs, method.getCompilationUnit()); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newCu, method.getDeclaringType()); if (typeWc == null) {
IMethod method= iter.next(); ICompilationUnit newCu= RenameAnalyzeUtil.findWorkingCopyForCu(newDeclarationWCs, method.getCompilationUnit()); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newCu, method.getDeclaringType()); if (typeWc == null) {
IMethod method= iter.next(); ICompilationUnit newCu= RenameAnalyzeUtil.findWorkingCopyForCu(newDeclarationWCs, method.getCompilationUnit()); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newCu, method.getDeclaringType()); if (typeWc == null) {
IMethod method= (IMethod) iter.next(); ICompilationUnit newCu= RenameAnalyzeUtil.findWorkingCopyForCu(newDeclarationWCs, method.getCompilationUnit()); IType typeWc= (IType) JavaModelUtil.findInCompilationUnit(newCu, method.getDeclaringType()); if (typeWc == null) continue;
public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) { final ITypeBinding subBinding= subDeclaration.resolveBinding(); if (subBinding != null) { String name= null; ITypeBinding superBinding= null; final ITypeBinding[] superBindings= Bindings.getAllSuperTypes(subBinding); for (int index= 0; index < superBindings.length; index++) { name= superBindings[index].getName(); if (name.startsWith(fDestinationType.getElementName())) superBinding= superBindings[index]; } if (superBinding != null) { solveSuperTypeConstraints(unit, node, subType, subBinding, superBinding, new SubProgressMonitor(monitor, 80), status); if (!status.hasFatalError()) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, status, new SubProgressMonitor(monitor, 120)); } } } } catch (JavaModelException exception) { JavaPlugin.log(exception); status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractInterfaceProcessor_internal_error)); } }
@Override public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) { final ITypeBinding subBinding= subDeclaration.resolveBinding(); if (subBinding != null) { String name= null; ITypeBinding superBinding= null; final ITypeBinding[] superBindings= Bindings.getAllSuperTypes(subBinding); for (int index= 0; index < superBindings.length; index++) { name= superBindings[index].getName(); if (name.startsWith(fDestinationType.getElementName())) superBinding= superBindings[index]; } if (superBinding != null) { solveSuperTypeConstraints(unit, node, subType, subBinding, superBinding, new SubProgressMonitor(monitor, 80), status); if (!status.hasFatalError()) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, status, new SubProgressMonitor(monitor, 120)); } } } } catch (JavaModelException exception) { JavaPlugin.log(exception); status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractInterfaceProcessor_internal_error)); } }
@Override public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, declaring); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) { final ITypeBinding subBinding= subDeclaration.resolveBinding(); if (subBinding != null) { String name= null; ITypeBinding superBinding= null; final ITypeBinding[] superBindings= Bindings.getAllSuperTypes(subBinding); for (int index= 0; index < superBindings.length; index++) { name= superBindings[index].getName(); if (name.startsWith(fDestinationType.getElementName())) superBinding= superBindings[index]; } if (superBinding != null) { solveSuperTypeConstraints(unit, node, subType, subBinding, superBinding, new SubProgressMonitor(monitor, 80), status); if (!status.hasFatalError()) rewriteTypeOccurrences(manager, this, sourceRewrite, unit, node, replacements, status, new SubProgressMonitor(monitor, 120)); } } } } catch (JavaModelException exception) { JavaPlugin.log(exception); status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractInterfaceProcessor_internal_error)); } }
public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, fSubType); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) {
@Override public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, fSubType); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) {
@Override public final void acceptAST(final ICompilationUnit unit, final CompilationUnit node) { try { final IType subType= (IType) JavaModelUtil.findInCompilationUnit(unit, fSubType); final AbstractTypeDeclaration subDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(subType, node); if (subDeclaration != null) {