private RemoteRevisionsCache(final Project project) {
    myProject = project;
    myLock = new Object();

    myRemoteRevisionsNumbersCache = new RemoteRevisionsNumbersCache(myProject);
    myRemoteRevisionsStateCache = new RemoteRevisionsStateCache(myProject);

    myChangeDecorator = new RemoteStatusChangeNodeDecorator(this);

    myVcsManager = ProjectLevelVcsManager.getInstance(project);
    myVcsManager.addVcsListener(this);
    myKinds = new HashMap<String, RemoteDifferenceStrategy>();
    Disposer.register(
        project,
        new Disposable() {
          public void dispose() {
            myVcsManager.removeVcsListener(RemoteRevisionsCache.this);
          }
        });
    final VcsConfiguration vcsConfiguration = VcsConfiguration.getInstance(myProject);
    myControlledCycle =
        new ControlledCycle(
            project,
            new Getter<Boolean>() {
              @Override
              public Boolean get() {
                final boolean shouldBeDone =
                    vcsConfiguration.isChangedOnServerEnabled() && myVcsManager.hasActiveVcss();

                if (shouldBeDone) {
                  boolean somethingChanged = myRemoteRevisionsNumbersCache.updateStep();
                  somethingChanged |= myRemoteRevisionsStateCache.updateStep();
                  if (somethingChanged) {
                    myProject.getMessageBus().syncPublisher(REMOTE_VERSION_CHANGED).run();
                  }
                }
                return shouldBeDone;
              }
            },
            "Finishing \"changed on server\" update",
            DEFAULT_REFRESH_INTERVAL);

    updateRoots();

    if ((!myProject.isDefault()) && vcsConfiguration.isChangedOnServerEnabled()) {
      ((ProjectLevelVcsManagerImpl) myVcsManager)
          .addInitializationRequest(
              VcsInitObject.REMOTE_REVISIONS_CACHE,
              new Runnable() {
                public void run() {
                  // do not start if there're no vcses
                  if (!myVcsManager.hasActiveVcss() || !vcsConfiguration.isChangedOnServerEnabled())
                    return;
                  myControlledCycle.startIfNotStarted(-1);
                }
              });
    }
  }
Exemplo n.º 2
0
  /* Invoked by reflection */
  TodoView(Project project, ProjectLevelVcsManager manager) {
    myProject = project;
    myVCSManager = manager;
    myCurrentPanelSettings = new TodoPanelSettings();
    myAllPanelSettings = new TodoPanelSettings();
    myChangeListTodosPanelSettings = new TodoPanelSettings();

    myVCSManager.addVcsListener(myVcsListener);

    final MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
    TodoConfiguration.getInstance().addPropertyChangeListener(myPropertyChangeListener, this);

    MessageBusConnection connection = myProject.getMessageBus().connect(this);
    connection.subscribe(AppTopics.FILE_TYPES, new MyFileTypeListener());
  }
Exemplo n.º 3
0
  @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();
  }