public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context)
      throws CoreException, OperationCanceledException {
    RefactoringStatus result = new RefactoringStatus();

    // Find target repository
    IConnectionProfileRepository repo = getTargetRepository();

    // RJC: TODO: we should really prompt the user for overwrites. i.e.
    // behavior should be similar to moving a resource in the workspace
    for (int index = 0, count = mProfiles.length; index < count; ++index) {
      // Verify that the profile is compatible with the repository
      if (repo != null) {
        if (repo.isReadOnly()
            || repo.getProfileByName(mProfiles[index].getName()) != null
            || !repo.supportsProfileType(mProfiles[index].getProviderId())
            || !((ConnectionProfileProvider) mProfiles[index].getProvider())
                .compatibleWithRepository(repo.getRepositoryProfile())) {
          continue;
        }
      } else if (InternalProfileManager.getInstance()
              .getProfileByName(mProfiles[index].getName(), false)
          != null) {
        continue;
      }

      mProfilesToMove.add(mProfiles[index]);
    }

    return result;
  }
 private void disConnectSubProfiles(IConnectionProfile parent) {
   if (!parent
       .getCategory()
       .getId()
       .equals(IConnectionProfileRepositoryConstants.REPOSITORY_CATEGORY_ID)) {
     return;
   }
   IConnectionProfile[] profiles = InternalProfileManager.getInstance().getProfiles(true);
   for (int i = 0; i < profiles.length; i++) {
     ConnectionProfile profile = (ConnectionProfile) profiles[i];
     IConnectionProfileRepository repository = profile.getRepository();
     if (repository != null) {
       if (repository.getRepositoryProfile() != null
           && repository.getRepositoryProfile() == parent
           && profile.isConnected()) {
         profile.disconnect();
         // notify listeners to remove the contentExtension from the mProfileToExtension map.
         InternalProfileManager.getInstance().fireProfileDeleted(profile);
       }
     }
   }
 }