/** * Adds an <code>INFO</code> entry filled with the given message to this status. * If the current severity is <code>OK</code> it will be changed to <code>INFO * </code>. It will remain unchanged otherwise. * * @param msg the message of the info entry * * @see RefactoringStatusEntry */ public void addInfo(String msg) { addInfo(msg, null); }
/** * Adds an <code>INFO</code> entry filled with the given message to this status. * If the current severity is <code>OK</code> it will be changed to <code>INFO * </code>. It will remain unchanged otherwise. * * @param msg the message of the info entry * * @see RefactoringStatusEntry */ public void addInfo(String msg) { addInfo(msg, null); }
/** * Adds an <code>INFO</code> entry filled with the given message to this status. * If the current severity is <code>OK</code> it will be changed to <code>INFO * </code>. It will remain unchanged otherwise. * * @param msg the message of the info entry * * @see RefactoringStatusEntry */ public void addInfo(String msg) { addInfo(msg, null); }
result.addInfo(msg);
result.addInfo(msg);
public static ICleanUpFix createCleanUp(final CompilationUnit cu, CodeGenerationSettings settings, boolean organizeImports, RefactoringStatus status) throws CoreException { if (!organizeImports) return null; final boolean hasAmbiguity[]= new boolean[] { false }; IChooseImportQuery query= new IChooseImportQuery() { @Override public TypeNameMatch[] chooseImports(TypeNameMatch[][] openChoices, ISourceRange[] ranges) { hasAmbiguity[0]= true; return new TypeNameMatch[0]; } }; final ICompilationUnit unit= (ICompilationUnit)cu.getJavaElement(); OrganizeImportsOperation op= new OrganizeImportsOperation(unit, cu, settings.importIgnoreLowercase, false, false, query); final TextEdit edit= op.createTextEdit(null); if (hasAmbiguity[0]) { status.addInfo(Messages.format(ActionMessages.OrganizeImportsAction_multi_error_unresolvable, getLocationString(cu))); } if (op.getParseError() != null) { status.addInfo(Messages.format(ActionMessages.OrganizeImportsAction_multi_error_parse, getLocationString(cu))); return null; } if (edit == null || (edit instanceof MultiTextEdit && edit.getChildrenSize() == 0)) return null; return new ImportsFix(edit, unit, FixMessages.ImportsFix_OrganizeImports_Description); }
public static ICleanUpFix createCleanUp(final CompilationUnit cu, CodeGenerationSettings settings, boolean organizeImports, RefactoringStatus status) throws CoreException { if (!organizeImports) return null; final boolean hasAmbiguity[]= new boolean[] { false }; IChooseImportQuery query= new IChooseImportQuery() { @Override public TypeNameMatch[] chooseImports(TypeNameMatch[][] openChoices, ISourceRange[] ranges) { hasAmbiguity[0]= true; return new TypeNameMatch[0]; } }; final ICompilationUnit unit= (ICompilationUnit)cu.getJavaElement(); OrganizeImportsOperation op= new OrganizeImportsOperation(unit, cu, settings.importIgnoreLowercase, false, false, query); final TextEdit edit= op.createTextEdit(null); if (hasAmbiguity[0]) { status.addInfo(Messages.format(ActionMessages.OrganizeImportsAction_multi_error_unresolvable, getLocationString(cu))); } if (op.getParseError() != null) { status.addInfo(Messages.format(ActionMessages.OrganizeImportsAction_multi_error_parse, getLocationString(cu))); return null; } if (edit == null || (edit instanceof MultiTextEdit && edit.getChildrenSize() == 0)) return null; return new ImportsFix(edit, unit, FixMessages.ImportsFix_OrganizeImports_Description); }
edit= op.createTextEdit(null); } catch (AmbiguousImportException e) { status.addInfo(Messages.format(ActionMessages.OrganizeImportsAction_multi_error_unresolvable, getLocationString(cu))); return null; status.addInfo(Messages.format(ActionMessages.OrganizeImportsAction_multi_error_parse, getLocationString(cu))); return null;
@Override protected RefactoringStatus verifyDestination(IJavaElement destination) throws JavaModelException { RefactoringStatus superStatus= super.verifyDestination(destination); if (superStatus.hasFatalError()) return superStatus; Object commonParent= new ParentChecker(getResources(), getJavaElements()).getCommonParent(); if (destination.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer != null && (destinationAsContainer.equals(commonParent) || commonParent instanceof IPackageFragmentRoot && destinationAsContainer.equals(((IPackageFragmentRoot) commonParent).getResource()))) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IPackageFragment destinationAsPackage= getDestinationAsPackageFragment(); if (destinationAsPackage != null && (destinationAsPackage.equals(commonParent))) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); if (cannotUpdateReferencesForDestination()) superStatus.addInfo(RefactoringCoreMessages.ReorgPolicyFactory_noJavaUpdates); return superStatus; }
@Override protected RefactoringStatus verifyDestination(IResource destination) throws JavaModelException { RefactoringStatus superStatus= super.verifyDestination(destination); if (superStatus.hasFatalError()) return superStatus; Object commonParent= getCommonParent(); if (destination.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer != null && destinationAsContainer.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IJavaElement destinationContainerAsPackage= getDestinationContainerAsJavaElement(); if (destinationContainerAsPackage != null && destinationContainerAsPackage.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); if (cannotUpdateReferencesForDestination()) superStatus.addInfo(RefactoringCoreMessages.ReorgPolicyFactory_noJavaUpdates); return superStatus; } }
@Override protected RefactoringStatus verifyDestination(IResource destination) throws JavaModelException { RefactoringStatus superStatus= super.verifyDestination(destination); if (superStatus.hasFatalError()) return superStatus; Object commonParent= getCommonParent(); if (destination.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer != null && destinationAsContainer.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IJavaElement destinationContainerAsPackage= getDestinationContainerAsJavaElement(); if (destinationContainerAsPackage != null && destinationContainerAsPackage.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); if (cannotUpdateReferencesForDestination()) superStatus.addInfo(RefactoringCoreMessages.ReorgPolicyFactory_noJavaUpdates); return superStatus; } }
@Override protected RefactoringStatus verifyDestination(IJavaElement destination) throws JavaModelException { RefactoringStatus superStatus= super.verifyDestination(destination); if (superStatus.hasFatalError()) return superStatus; Object commonParent= new ParentChecker(getResources(), getJavaElements()).getCommonParent(); if (destination.equals(commonParent)) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer != null && (destinationAsContainer.equals(commonParent) || commonParent instanceof IPackageFragmentRoot && destinationAsContainer.equals(((IPackageFragmentRoot) commonParent).getResource()))) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); IPackageFragment destinationAsPackage= getDestinationAsPackageFragment(); if (destinationAsPackage != null && (destinationAsPackage.equals(commonParent))) return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); if (cannotUpdateReferencesForDestination()) superStatus.addInfo(RefactoringCoreMessages.ReorgPolicyFactory_noJavaUpdates); return superStatus; }
@Override protected RefactoringStatus verifyDestination(IResource destination) throws JavaModelException { RefactoringStatus superStatus= super.verifyDestination(destination); if (superStatus.hasFatalError()) { return superStatus; } Object commonParent= getCommonParent(); if (destination.equals(commonParent)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); } IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer != null && destinationAsContainer.equals(commonParent)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); } IJavaElement destinationContainerAsPackage= getDestinationContainerAsJavaElement(); if (destinationContainerAsPackage != null && destinationContainerAsPackage.equals(commonParent)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); } if (cannotUpdateReferencesForDestination()) { superStatus.addInfo(RefactoringCoreMessages.ReorgPolicyFactory_noJavaUpdates); } return superStatus; } }
@Override protected RefactoringStatus verifyDestination(IJavaElement destination) throws JavaModelException { RefactoringStatus superStatus= super.verifyDestination(destination); if (superStatus.hasFatalError()) { return superStatus; } Object commonParent= new ParentChecker(getResources(), getJavaElements()).getCommonParent(); if (destination.equals(commonParent)) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); } IContainer destinationAsContainer= getDestinationAsContainer(); if (destinationAsContainer != null && (destinationAsContainer.equals(commonParent) || commonParent instanceof IPackageFragmentRoot && destinationAsContainer.equals(((IPackageFragmentRoot) commonParent).getResource()))) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); } IPackageFragment destinationAsPackage= getDestinationAsPackageFragment(); if (destinationAsPackage != null && (destinationAsPackage.equals(commonParent))) { return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_parent); } if (cannotUpdateReferencesForDestination()) { superStatus.addInfo(RefactoringCoreMessages.ReorgPolicyFactory_noJavaUpdates); } return superStatus; }
result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_field_delegate_not_final, BasicElementLabels.getJavaElementName(frag.getName().getIdentifier())), null); } else if (frag.getInitializer() == null) { result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_field_delegate_no_initializer, BasicElementLabels.getJavaElementName(frag.getName().getIdentifier())), null); } else { DelegateFieldCreator creator= new DelegateFieldCreator(); result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_delegate_for_type, BasicElementLabels.getJavaElementName(((AbstractTypeDeclaration) declaration).getName().getIdentifier())), null);
result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_field_delegate_not_final, frag.getName()), null); } else if (frag.getInitializer() == null) { result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_field_delegate_no_initializer, frag.getName()), null); } else { DelegateFieldCreator creator= new DelegateFieldCreator(); result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_delegate_for_type, ((AbstractTypeDeclaration) declaration).getName().getIdentifier()), null);
result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_field_delegate_not_final, BasicElementLabels.getJavaElementName(frag.getName().getIdentifier())), null); } else if (frag.getInitializer() == null) { result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_field_delegate_no_initializer, BasicElementLabels.getJavaElementName(frag.getName().getIdentifier())), null); } else { DelegateFieldCreator creator= new DelegateFieldCreator(); result.addInfo(Messages.format(RefactoringCoreMessages.DelegateCreator_cannot_create_delegate_for_type, BasicElementLabels.getJavaElementName(((AbstractTypeDeclaration) declaration).getName().getIdentifier())), null);