@Override
  public void deactivate() {
    FrameStateManager.getInstance().removeListener(myFrameStateListener);

    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
    if (myVcsListener != null) {
      vcsManager.removeVcsListener(myVcsListener);
    }

    if (myEntriesFileListener != null) {
      VirtualFileManager.getInstance().removeVirtualFileListener(myEntriesFileListener);
    }
    SvnApplicationSettings.getInstance().svnDeactivated();
    if (myCommittedChangesProvider != null) {
      myCommittedChangesProvider.deactivate();
    }
    if (myChangeListListener != null && !myProject.isDefault()) {
      ChangeListManager.getInstance(myProject).removeChangeListListener(myChangeListListener);
    }
    vcsManager.removeVcsListener(myRootsToWorkingCopies);
    myRootsToWorkingCopies.clear();

    myAuthNotifier.stop();
    myAuthNotifier.clear();

    mySvnBranchPointsCalculator.deactivate();
    mySvnBranchPointsCalculator = null;
    myWorkingCopiesContent.deactivate();
    myLoadedBranchesStorage.deactivate();
    myPool.dispose();
    myPool = null;
  }
 @SuppressWarnings({"HardCodedStringLiteral"})
 public void readExternal(Element element) throws InvalidDataException {
   DefaultJDOMExternalizer.readExternal(this, element);
   List elems = element.getChildren("addpath");
   LOG.debug(elems.toString());
   ADD_PATHS = new String[elems.size()];
   for (int i = 0; i < elems.size(); i++) {
     Element elem = (Element) elems.get(i);
     ADD_PATHS[i] = elem.getAttributeValue("path");
   }
   Element configurationDirectory = element.getChild("configuration");
   if (configurationDirectory != null) {
     myConfigurationDirectory = configurationDirectory.getText();
     Attribute defaultAttr = configurationDirectory.getAttribute("useDefault");
     try {
       myIsUseDefaultConfiguration = defaultAttr != null && defaultAttr.getBooleanValue();
     } catch (DataConversionException e) {
       myIsUseDefaultConfiguration = false;
     }
   } else {
     myIsUseDefaultConfiguration = true;
   }
   // compatibility: this setting was moved from .iws to global settings
   List urls = element.getChildren("checkoutURL");
   for (Object url1 : urls) {
     Element child = (Element) url1;
     String url = child.getText();
     if (url != null) {
       SvnApplicationSettings.getInstance().addCheckoutURL(url);
     }
   }
   myIsKeepLocks = element.getChild("keepLocks") != null;
   myRemoteStatus = element.getChild("remoteStatus") != null;
   myUpgradeMode =
       element.getChild("upgradeMode") != null ? element.getChild("upgradeMode").getText() : null;
   final Element useProxy = element.getChild("myIsUseDefaultProxy");
   if (useProxy == null) {
     myIsUseDefaultProxy = false;
   } else {
     myIsUseDefaultProxy = Boolean.parseBoolean(useProxy.getText());
   }
   final Element supportedVersion = element.getChild("supportedVersion");
   if (supportedVersion != null) {
     try {
       mySupportOptions = new SvnSupportOptions(Long.parseLong(supportedVersion.getText().trim()));
     } catch (NumberFormatException e) {
       mySupportOptions = new SvnSupportOptions(null);
     }
   }
   final Attribute maxAnnotateRevisions = element.getAttribute("maxAnnotateRevisions");
   if (maxAnnotateRevisions != null) {
     try {
       myMaxAnnotateRevisions = maxAnnotateRevisions.getIntValue();
     } catch (DataConversionException e) {
       //
     }
     final Attribute acceleration = element.getAttribute("myUseAcceleration");
     if (acceleration != null) {
       try {
         myUseAcceleration = UseAcceleration.valueOf(acceleration.getValue());
       } catch (IllegalArgumentException e) {
         //
       }
     }
   }
   final Attribute autoUpdateAfterCommit = element.getAttribute("myAutoUpdateAfterCommit");
   if (autoUpdateAfterCommit != null) {
     myAutoUpdateAfterCommit = Boolean.parseBoolean(autoUpdateAfterCommit.getValue());
   }
   final Attribute cleanupRun = element.getAttribute(CLEANUP_ON_START_RUN);
   if (cleanupRun != null) {
     myCleanupRun = Boolean.parseBoolean(cleanupRun.getValue());
   }
   final Attribute treeConflictMergeNewFilesPlace =
       element.getAttribute("TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE");
   final Attribute protocols = element.getAttribute("SSL_PROTOCOLS");
   if (protocols != null) {
     try {
       SSL_PROTOCOLS = SSLProtocols.valueOf(protocols.getValue());
     } catch (IllegalArgumentException e) {
       //
     }
   }
   if (treeConflictMergeNewFilesPlace != null) {
     TREE_CONFLICT_MERGE_THEIRS_NEW_INTO_OLD_PLACE =
         Boolean.parseBoolean(treeConflictMergeNewFilesPlace.getValue());
   }
 }
  @Override
  public void activate() {
    createPool();
    final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
    if (!myProject.isDefault()) {
      ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener);
      vcsManager.addVcsListener(myVcsListener);
    }

    SvnApplicationSettings.getInstance().svnActivated();
    if (myEntriesFileListener != null) {
      VirtualFileManager.getInstance().addVirtualFileListener(myEntriesFileListener);
    }
    // this will initialize its inner listener for committed changes upload
    LoadedRevisionsCache.getInstance(myProject);
    FrameStateManager.getInstance().addListener(myFrameStateListener);

    myAuthNotifier.init();
    mySvnBranchPointsCalculator = new SvnBranchPointsCalculator(myProject);
    mySvnBranchPointsCalculator.activate();

    if (SystemInfo.isWindows) {
      if (!SVNJNAUtil.isJNAPresent()) {
        Notifications.Bus.notify(
            new Notification(
                getDisplayName(),
                "Subversion plugin: no JNA",
                "A problem with JNA initialization for svnkit library. Encryption is not available.",
                NotificationType.WARNING),
            NotificationDisplayType.BALLOON,
            myProject);
      } else if (!SVNJNAUtil.isWinCryptEnabled()) {
        Notifications.Bus.notify(
            new Notification(
                getDisplayName(),
                "Subversion plugin: no encryption",
                "A problem with encryption module (Crypt32.dll) initialization for svnkit library. Encryption is not available.",
                NotificationType.WARNING),
            NotificationDisplayType.BALLOON,
            myProject);
      }
    }

    final SvnConfiguration.UseAcceleration accelerationType =
        SvnConfiguration.getInstance(myProject).myUseAcceleration;
    if (SvnConfiguration.UseAcceleration.javaHL.equals(accelerationType)) {
      CheckJavaHL.runtimeCheck(myProject);
    } else if (SvnConfiguration.UseAcceleration.commandLine.equals(accelerationType)
        && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
      myChecker.checkExecutableAndNotifyIfNeeded();
    }

    // do one time after project loaded
    StartupManager.getInstance(myProject)
        .runWhenProjectIsInitialized(
            new DumbAwareRunnable() {
              @Override
              public void run() {
                postStartup();

                // for IDEA, it takes 2 minutes - and anyway this can be done in background, no
                // sense...
                // once it could be mistaken about copies for 2 minutes on start...

                /*if (! myMapping.getAllWcInfos().isEmpty()) {
                  invokeRefreshSvnRoots();
                  return;
                }
                ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
                  public void run() {
                    myCopiesRefreshManager.getCopiesRefresh().ensureInit();
                  }
                }, SvnBundle.message("refreshing.working.copies.roots.progress.text"), true, myProject);*/
              }
            });

    vcsManager.addVcsListener(myRootsToWorkingCopies);

    myLoadedBranchesStorage.activate();
  }