void OnUIShellActivate(object sender, EventArgs e) { IAnkhCommandStates states = Context.GetService<IAnkhCommandStates>(); if (states != null && states.SccProviderActive) MaybeEnsure(); }
void OnSccShellActivate(object sender, EventArgs e) { IAnkhCommandStates states = Context.GetService <IAnkhCommandStates>(); if (states != null && states.SccProviderActive) { OnSccProviderActivated(sender, e); } }
void OnUIShellActivate(object sender, EventArgs e) { ThreadHelper.ThrowIfNotOnUIThread(); IAnkhCommandStates states = Context.GetService <IAnkhCommandStates>(); if (states != null && states.SccProviderActive) { MaybeEnsure(); } }
void FocusChanged(object sender, EventArgs e) { Items.Clear(); ISvnLogItem item = ItemSource.FocusedItem; if (item != null && item.ChangedPaths != null) { IAnkhCommandStates states = null; if (Context != null) { states = Context.GetService <IAnkhCommandStates>(); } Color[] colorInfo = null; if (!SystemInformation.HighContrast && (states != null && (!states.ThemeDefined || states.ThemeLight))) { colorInfo = new Color[] { Color.Gray, Color.FromArgb(100, 0, 100), Color.DarkRed, Color.DarkBlue }; } List <PathListViewItem> paths = new List <PathListViewItem>(); List <string> origins = new List <string>(); foreach (SvnOrigin o in LogSource.Targets) { string origin = SvnTools.UriPartToPath(o.RepositoryRoot.MakeRelativeUri(o.Uri).ToString()).Replace('\\', '/'); if (origin.Length == 0 || origin[0] != '/') { origin = "/" + origin; } origins.Add(origin.TrimEnd('/')); } if (item.ChangedPaths != null) { foreach (SvnChangeItem i in item.ChangedPaths) { bool hasFocus = (colorInfo != null) && HasFocus(origins, i.Path); paths.Add(new PathListViewItem(this, item, i, item.RepositoryRoot, hasFocus, colorInfo)); } } Items.AddRange(paths.ToArray()); } }
protected override void OnInitialize() { base.OnInitialize(); AnkhServiceEvents ev = GetService <AnkhServiceEvents>(); ev.SccProviderActivated += OnSvnSccProviderActivated; ev.SccProviderDeactivated += OnSccProviderDeactivated; IAnkhCommandStates states = GetService <IAnkhCommandStates>(); // Github issue #18. // Initialse SVN support unconditionally. // There is only one SCC provider in this package. The experimental GIT support has been removed. OnSvnSccProviderActivated(this, EventArgs.Empty); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); syncView.Context = Context; syncView.ColumnWidthChanged += new ColumnWidthChangedEventHandler(syncView_ColumnWidthChanged); IDictionary <string, int> widths = ConfigurationService.GetColumnWidths(GetType()); syncView.SetColumnWidths(widths); _recentChangesAction = new AnkhAction(DoRefresh); // if solution is not open, don't auto-refresh IAnkhCommandStates commandState = Context.GetService <IAnkhCommandStates>(); _solutionExists = (commandState != null && commandState.SolutionExists); RefreshIntervalConfigModified(); HookHandlers(); }
protected override void OnLoad(EventArgs e) { foreach (PendingChangesPage p in _pages) { p.Context = Context; p.ToolControl = this; if (!contentPanel.Controls.Contains(p)) { p.Enabled = p.Visible = false; p.Dock = DockStyle.Fill; contentPanel.Controls.Add(p); } } base.OnLoad(e); AnkhServiceEvents ev = Context.GetService <AnkhServiceEvents>(); ev.SccProviderActivated += new EventHandler(OnSccProviderActivated); ev.SccProviderDeactivated += new EventHandler(OnSccProviderDeactivated); IAnkhCommandStates states = Context.GetService <IAnkhCommandStates>(); bool shouldActivate = false; if (states != null) { if (!states.UIShellAvailable) { ev.UIShellActivate += new EventHandler(OnSccShellActivate); shouldActivate = false; } else { shouldActivate = states.SccProviderActive; } } _lastPage = _commitsPage; ShowPanel(shouldActivate ? _lastPage : _activatePage, false); pendingChangesTabs.Enabled = shouldActivate; }
protected override void OnInitialize() { base.OnInitialize(); AnkhServiceEvents ev = GetService <AnkhServiceEvents>(); ev.SccProviderActivated += OnSvnSccProviderActivated; ev.SccProviderDeactivated += OnSccProviderDeactivated; ev.GitSccProviderActivated += OnGitSccProviderActivated; ev.GitSccProviderDeactivated += OnSccProviderDeactivated; IAnkhCommandStates states = GetService <IAnkhCommandStates>(); if (states != null && states.SccProviderActive) { OnSvnSccProviderActivated(this, EventArgs.Empty); } else if (states != null && states.GitSccProviderActive) { OnGitSccProviderActivated(this, EventArgs.Empty); } }
/// <summary> /// Called by ProjectDocumentTracker when a solution is opened /// </summary> protected override void OnSolutionOpened(bool onLoad) { base.OnSolutionOpened(onLoad); if (!IsActive) { IAnkhCommandStates states = GetService <IAnkhCommandStates>(); if (states == null || states.OtherSccProviderActive) { return; } } if (!IsSolutionManaged) { string dir = SolutionDirectory; if (!string.IsNullOrEmpty(dir) && Directory.Exists(dir)) { if (!SvnTools.IsBelowManagedPath(dir)) { return; // Not for us } if (!IsActive) { RegisterAsPrimarySccProvider(); // Set us active; we know there is a .svn } // BH: Many users seem to have .load and .noload files checked in // so we can't just remove them without issues. } } if (!IsActive) { return; } foreach (SccProjectData data in ProjectMap.AllSccProjects) { if (data.IsSolutionInfrastructure) { // Solution folders don't save their Scc management state // We let them follow the solution settings if (IsSolutionManaged) { data.SetManaged(true); } } if (data.IsStoredInSolution) { // Flush the glyph cache of solution folders // (Well known VS bug: Initially clear) data.NotifyGlyphsChanged(); } } IPendingChangesManager mgr = GetService <IPendingChangesManager>(); if (mgr != null && mgr.IsActive) { mgr.FullRefresh(false); } UpdateSolutionGlyph(); }
public void RefreshText(IAnkhServiceProvider context) { if (context == null) { throw new ArgumentNullException("context"); } ISvnStatusCache cache = context.GetService <ISvnStatusCache>(); int idx = PendingChange.IconIndex; if (idx >= 0) { ImageIndex = idx; // Setting to -1 raises an exception } SvnItem item = cache[FullPath]; if (item == null) { throw new InvalidOperationException(); // Every path should return a SvnItem } PendingChangeStatus pcs = PendingChange.Change ?? new PendingChangeStatus(PendingChangeKind.None); SetValues( pcs.PendingCommitText, _lastChangeList = PendingChange.ChangeList, GetDirectory(item), PendingChange.FullPath, item.IsLocked ? PCResources.LockedValue : "", // Locked SafeDate(item.Modified), // Modified PendingChange.Name, PendingChange.RelativePath, PendingChange.Project, GetRevision(PendingChange), PendingChange.FileType, SafeWorkingCopy(item)); IAnkhCommandStates states = context.GetService <IAnkhCommandStates>(); if (!SystemInformation.HighContrast && (!states.ThemeDefined || states.ThemeLight)) { System.Drawing.Color clr = System.Drawing.Color.Black; if (item.IsConflicted || PendingChange.Kind == PendingChangeKind.WrongCasing) { clr = System.Drawing.Color.Red; } else if (item.IsDeleteScheduled) { if (item.Exists && item.InSolution && !item.IsSccExcluded) { clr = System.Drawing.Color.FromArgb(100, 0, 100); // As added } else { clr = System.Drawing.Color.DarkRed; } } else if (item.Status.IsCopied || item.Status.LocalNodeStatus == SharpSvn.SvnStatus.Added) { clr = System.Drawing.Color.FromArgb(100, 0, 100); } else if (!item.IsVersioned) { if (item.InSolution && !item.IsIgnored) { clr = System.Drawing.Color.FromArgb(100, 0, 100); // Same as added+copied } else { clr = System.Drawing.Color.Black; } } else if (item.IsModified) { clr = System.Drawing.Color.DarkBlue; } ForeColor = clr; } else if (this.ListView != null) { ForeColor = this.ListView.ForeColor; } }