/** * {@inheritDoc} */ public Object[] getElements() { return new Object[] { getDeclaringType()}; }
@Override public Object[] getElements() { return new Object[] { getDeclaringType()}; }
@Override public Object[] getElements() { return new Object[] { getDeclaringType()}; }
/** * Creates a new extract supertype refactoring processor. * * @param members * the members to extract, or <code>null</code> if invoked by * scripting * @param settings * the code generation settings, or <code>null</code> if * invoked by scripting */ public ExtractSupertypeProcessor(final IMember[] members, final CodeGenerationSettings settings) { super(members, settings, true); if (members != null) { final IType declaring= getDeclaringType(); if (declaring != null) fTypesToExtract= new IType[] { declaring}; } }
/** * Creates a new extract supertype refactoring processor. * * @param members * the members to extract, or <code>null</code> if invoked by * scripting * @param settings * the code generation settings, or <code>null</code> if * invoked by scripting */ public ExtractSupertypeProcessor(final IMember[] members, final CodeGenerationSettings settings) { super(members, settings, true); if (members != null) { final IType declaring= getDeclaringType(); if (declaring != null) fTypesToExtract= new IType[] { declaring}; } }
/** * Creates a new extract supertype refactoring processor. * * @param members * the members to extract, or <code>null</code> if invoked by * scripting * @param settings * the code generation settings, or <code>null</code> if * invoked by scripting */ public ExtractSupertypeProcessor(final IMember[] members, final CodeGenerationSettings settings) { super(members, settings, true); if (members != null) { final IType declaring= getDeclaringType(); if (declaring != null) fTypesToExtract= new IType[] { declaring}; } }
/** * Returns the declaring type. * * @return the declaring type */ public IType getDeclaringType() { return getProcessor().getDeclaringType(); }
/** * Returns the declaring type. * * @return the declaring type */ public IType getDeclaringType() { return getProcessor().getDeclaringType(); }
/** * Returns the declaring type. * * @return the declaring type */ public IType getDeclaringType() { return getProcessor().getDeclaringType(); }
Assert.isNotNull(monitor); if (fPossibleCandidates == null || fPossibleCandidates.length == 0) { final IType declaring= getDeclaringType(); if (declaring != null) { try {
Assert.isNotNull(monitor); if (fPossibleCandidates == null || fPossibleCandidates.length == 0) { final IType declaring= getDeclaringType(); if (declaring != null) { try {
Assert.isNotNull(monitor); if (fPossibleCandidates == null || fPossibleCandidates.length == 0) { final IType declaring= getDeclaringType(); if (declaring != null) { try {
/** * Computes the destination type based on the new name. * * @param name the new name * @return the destination type */ public IType computeExtractedType(final String name) { if (name != null && !name.equals("")) {//$NON-NLS-1$ final IType declaring= getDeclaringType(); try { final ICompilationUnit[] units= declaring.getPackageFragment().getCompilationUnits(fOwner); final String newName= JavaModelUtil.getRenamedCUName(declaring.getCompilationUnit(), name); ICompilationUnit result= null; for (int index= 0; index < units.length; index++) { if (units[index].getElementName().equals(newName)) result= units[index]; } if (result != null) { final IType type= result.getType(name); setDestinationType(type); return type; } } catch (JavaModelException exception) { JavaPlugin.log(exception); } } return null; }
/** * Computes the destination type based on the new name. * * @param name the new name * @return the destination type */ public IType computeExtractedType(final String name) { if (name != null && !name.equals("")) {//$NON-NLS-1$ final IType declaring= getDeclaringType(); try { final ICompilationUnit[] units= declaring.getPackageFragment().getCompilationUnits(fOwner); final String newName= JavaModelUtil.getRenamedCUName(declaring.getCompilationUnit(), name); ICompilationUnit result= null; for (int index= 0; index < units.length; index++) { if (units[index].getElementName().equals(newName)) result= units[index]; } if (result != null) { final IType type= result.getType(name); setDestinationType(type); return type; } } catch (JavaModelException exception) { JavaPlugin.log(exception); } } return null; }
/** * Computes the destination type based on the new name. * * @param name the new name * @return the destination type */ public IType computeExtractedType(final String name) { if (name != null && !name.equals("")) {//$NON-NLS-1$ final IType declaring= getDeclaringType(); try { final ICompilationUnit[] units= declaring.getPackageFragment().getCompilationUnits(fOwner); final String newName= JavaModelUtil.getRenamedCUName(declaring.getCompilationUnit(), name); ICompilationUnit result= null; for (int index= 0; index < units.length; index++) { if (units[index].getElementName().equals(newName)) result= units[index]; } if (result != null) { final IType type= result.getType(name); setDestinationType(type); return type; } } catch (JavaModelException exception) { JavaPlugin.log(exception); } } return null; }
/** * Checks whether the compilation unit to be extracted is valid. * * @return a status describing the outcome of the */ public RefactoringStatus checkExtractedCompilationUnit() { final RefactoringStatus status= new RefactoringStatus(); final ICompilationUnit cu= getDeclaringType().getCompilationUnit(); if (fTypeName == null || "".equals(fTypeName)) //$NON-NLS-1$ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name); status.merge(Checks.checkTypeName(fTypeName)); if (status.hasFatalError()) return status; status.merge(Checks.checkCompilationUnitName(JavaModelUtil.getRenamedCUName(cu, fTypeName))); if (status.hasFatalError()) return status; status.merge(Checks.checkCompilationUnitNewName(cu, fTypeName)); return status; }
/** * Checks whether the compilation unit to be extracted is valid. * * @return a status describing the outcome of the */ public RefactoringStatus checkExtractedCompilationUnit() { final RefactoringStatus status= new RefactoringStatus(); final ICompilationUnit cu= getDeclaringType().getCompilationUnit(); if (fTypeName == null || "".equals(fTypeName)) //$NON-NLS-1$ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name); status.merge(Checks.checkTypeName(fTypeName, cu)); if (status.hasFatalError()) return status; status.merge(Checks.checkCompilationUnitName(JavaModelUtil.getRenamedCUName(cu, fTypeName), cu)); if (status.hasFatalError()) return status; status.merge(Checks.checkCompilationUnitNewName(cu, fTypeName)); return status; }
/** * Checks whether the compilation unit to be extracted is valid. * * @return a status describing the outcome of the */ public RefactoringStatus checkExtractedCompilationUnit() { final RefactoringStatus status= new RefactoringStatus(); final ICompilationUnit cu= getDeclaringType().getCompilationUnit(); if (fTypeName == null || "".equals(fTypeName)) //$NON-NLS-1$ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name); status.merge(Checks.checkTypeName(fTypeName, cu)); if (status.hasFatalError()) return status; status.merge(Checks.checkCompilationUnitName(JavaModelUtil.getRenamedCUName(cu, fTypeName), cu)); if (status.hasFatalError()) return status; status.merge(Checks.checkCompilationUnitNewName(cu, fTypeName)); return status; }
try { monitor.beginTask(RefactoringCoreMessages.ExtractSupertypeProcessor_preparing, 20); final IType declaring= getDeclaringType(); final CompilationUnitRewrite declaringRewrite= new CompilationUnitRewrite(fOwner, declaring.getCompilationUnit()); final AbstractTypeDeclaration declaringDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(declaring, declaringRewrite.getRoot());
try { monitor.beginTask(RefactoringCoreMessages.ExtractSupertypeProcessor_preparing, 20); final IType declaring= getDeclaringType(); final CompilationUnitRewrite declaringRewrite= new CompilationUnitRewrite(fOwner, declaring.getCompilationUnit()); final AbstractTypeDeclaration declaringDeclaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(declaring, declaringRewrite.getRoot());