@Override public boolean fileIsUnderVcs(FilePath path) { final ChangeListManager clManager = ChangeListManager.getInstance(myProject); final VirtualFile file = path.getVirtualFile(); if (file == null) { return false; } return !SvnStatusUtil.isIgnoredInAnySense(clManager, file) && !clManager.isUnversioned(file); }
public void projectOpened() { TaskProjectConfiguration projectConfiguration = getProjectConfiguration(); servers: for (TaskProjectConfiguration.SharedServer server : projectConfiguration.servers) { if (server.type == null || server.url == null) { continue; } for (TaskRepositoryType<?> repositoryType : TaskRepositoryType.getRepositoryTypes()) { if (repositoryType.getName().equals(server.type)) { for (TaskRepository repository : myRepositories) { if (!repositoryType.equals(repository.getRepositoryType())) { continue; } if (server.url.equals(repository.getUrl())) { continue servers; } } TaskRepository repository = repositoryType.createRepository(); repository.setUrl(server.url); myRepositories.add(repository); } } } myContextManager.pack(200, 50); // make sure the task is associated with default changelist LocalTask defaultTask = findTask(LocalTaskImpl.DEFAULT_TASK_ID); LocalChangeList defaultList = myChangeListManager.findChangeList(LocalChangeList.DEFAULT_NAME); if (defaultList != null && defaultTask != null) { ChangeListInfo listInfo = new ChangeListInfo(defaultList); if (!defaultTask.getChangeLists().contains(listInfo)) { defaultTask.addChangelist(listInfo); } } // remove already not existing changelists from tasks changelists for (LocalTask localTask : getLocalTasks()) { for (Iterator<ChangeListInfo> iterator = localTask.getChangeLists().iterator(); iterator.hasNext(); ) { final ChangeListInfo changeListInfo = iterator.next(); if (myChangeListManager.getChangeList(changeListInfo.id) == null) { iterator.remove(); } } } myChangeListManager.addChangeListListener(myChangeListListener); }
private void createChangeList(LocalTask task, String name, @Nullable String comment) { LocalChangeList changeList = myChangeListManager.findChangeList(name); if (changeList == null) { changeList = myChangeListManager.addChangeList(name, comment); } else { final LocalTask associatedTask = getAssociatedTask(changeList); if (associatedTask != null) { associatedTask.removeChangelist(new ChangeListInfo(changeList)); } changeList.setComment(comment); } task.addChangelist(new ChangeListInfo(changeList)); myChangeListManager.setDefaultChangeList(changeList); }
@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; }
public SvnVcs( final Project project, MessageBus bus, SvnConfiguration svnConfiguration, final SvnLoadedBrachesStorage storage) { super(project, VCS_NAME); myLoadedBranchesStorage = storage; LOG.debug("ct"); myRootsToWorkingCopies = new RootsToWorkingCopies(this); myConfiguration = svnConfiguration; myAuthNotifier = new SvnAuthenticationNotifier(this); dumpFileStatus(FileStatus.ADDED); dumpFileStatus(FileStatus.DELETED); dumpFileStatus(FileStatus.MERGE); dumpFileStatus(FileStatus.MODIFIED); dumpFileStatus(FileStatus.NOT_CHANGED); dumpFileStatus(FileStatus.UNKNOWN); dumpFileStatus(SvnFileStatus.REPLACED); dumpFileStatus(SvnFileStatus.EXTERNAL); dumpFileStatus(SvnFileStatus.OBSTRUCTED); final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); myAddConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, this); myDeleteConfirmation = vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, this); myCheckoutOptions = vcsManager.getStandardOption(VcsConfiguration.StandardOption.CHECKOUT, this); if (myProject.isDefault()) { myChangeListListener = null; myEntriesFileListener = null; } else { myEntriesFileListener = new SvnEntriesFileListener(project); upgradeIfNeeded(bus); myChangeListListener = new SvnChangelistListener(myProject, this); myVcsListener = new VcsListener() { @Override public void directoryMappingChanged() { invokeRefreshSvnRoots(true); } }; } myFrameStateListener = project.isDefault() ? null : new MyFrameStateListener( ChangeListManager.getInstance(project), VcsDirtyScopeManager.getInstance(project)); myWorkingCopiesContent = new WorkingCopiesContent(this); // remove used some time before old notification group ids correctNotificationIds(); myChecker = new SvnExecutableChecker(myProject); }
private LocalTask restoreVcsContext(LocalTask task) { if (!isVcsEnabled()) return task; List<ChangeListInfo> changeLists = task.getChangeLists(); if (!changeLists.isEmpty()) { ChangeListInfo info = changeLists.get(0); LocalChangeList changeList = myChangeListManager.getChangeList(info.id); if (changeList == null) { changeList = myChangeListManager.addChangeList(info.name, info.comment); info.id = changeList.getId(); } myChangeListManager.setDefaultChangeList(changeList); } List<BranchInfo> branches = task.getBranches(false); VcsTaskHandler.TaskInfo info = fromBranches(branches); VcsTaskHandler[] handlers = VcsTaskHandler.getAllHandlers(myProject); for (VcsTaskHandler handler : handlers) { handler.switchToTask(info); } return task; }
@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(); }
public void disposeComponent() { if (myCacheRefreshTimer != null) { myCacheRefreshTimer.stop(); } myChangeListManager.removeChangeListListener(myChangeListListener); }