예제 #1
0
 public CreateFileChange(string fileName, string content)
 {
     this.FileName    = fileName;
     this.Content     = content;
     this.Description = string.Format(GettextCatalog.GetString("Create file '{0}'"), Path.GetFileName(fileName));
 }
예제 #2
0
        public override Annotation[] GetAnnotations(FilePath repositoryPath, Revision since)
        {
            SvnRevision       sinceRev    = since != null ? (SvnRevision)since : null;
            List <Annotation> annotations = new List <Annotation> (Svn.GetAnnotations(this, repositoryPath, SvnRevision.First, sinceRev ?? SvnRevision.Base));
            Annotation        nextRev     = new Annotation(null, GettextCatalog.GetString("<uncommitted>"), DateTime.MinValue, null, GettextCatalog.GetString("working copy"));
            var baseDocument    = Mono.TextEditor.TextDocument.CreateImmutableDocument(GetBaseText(repositoryPath));
            var workingDocument = Mono.TextEditor.TextDocument.CreateImmutableDocument(File.ReadAllText(repositoryPath));

            // "SubversionException: blame of the WORKING revision is not supported"
            if (sinceRev == null)
            {
                foreach (var hunk in baseDocument.Diff(workingDocument, includeEol: false))
                {
                    annotations.RemoveRange(hunk.RemoveStart - 1, hunk.Removed);
                    for (int i = 0; i < hunk.Inserted; ++i)
                    {
                        if (hunk.InsertStart + i >= annotations.Count)
                        {
                            annotations.Add(nextRev);
                        }
                        else
                        {
                            annotations.Insert(hunk.InsertStart - 1, nextRev);
                        }
                    }
                }
            }

            return(annotations.ToArray());
        }
 void GetMessageFormats()
 {
     AddingPackageMessageFormat   = GettextCatalog.GetString("Installing...{0}");
     RemovingPackageMessageFormat = GettextCatalog.GetString("Uninstalling...{0}");
     ManagingPackageMessageFormat = GettextCatalog.GetString("Managing...{0}");
 }
        static CommandInfoSet CreateFixMenu(TextEditor editor, DocumentContext ctx, CodeActionContainer container)
        {
            if (editor == null)
            {
                throw new ArgumentNullException("editor");
            }
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            var result = new CommandInfoSet();

            result.Text = GettextCatalog.GetString("Fix");
            foreach (var diagnostic in container.CodeFixActions)
            {
                var info = new CommandInfo(diagnostic.CodeAction.Title);
                result.CommandInfos.Add(info, new Action(async() => await new CodeActionEditorExtension.ContextActionRunner(diagnostic.CodeAction, editor, ctx).Run()));
            }
            if (result.CommandInfos.Count == 0)
            {
                return(result);
            }
            bool firstDiagnosticOption = true;

            foreach (var fix in container.DiagnosticsAtCaret)
            {
                var inspector = BuiltInCodeDiagnosticProvider.GetCodeDiagnosticDescriptor(fix.Id);
                if (inspector == null)
                {
                    continue;
                }

                if (firstDiagnosticOption)
                {
                    result.CommandInfos.AddSeparator();
                    firstDiagnosticOption = false;
                }

                var label   = GettextCatalog.GetString("_Options for \"{0}\"", fix.GetMessage());
                var subMenu = new CommandInfoSet();
                subMenu.Text = label;

//				if (inspector.CanSuppressWithAttribute) {
//					var menuItem = new FixMenuEntry (GettextCatalog.GetString ("_Suppress with attribute"),
//						delegate {
//
//							inspector.SuppressWithAttribute (Editor, DocumentContext, GetTextSpan (fix.Item2));
//						});
//					subMenu.Add (menuItem);
//				}

                if (inspector.CanDisableWithPragma)
                {
                    var info = new CommandInfo(GettextCatalog.GetString("_Suppress with #pragma"));
                    subMenu.CommandInfos.Add(info, new Action(() => inspector.DisableWithPragma(editor, ctx, fix)));

                    info = new CommandInfo(GettextCatalog.GetString("_Suppress with file"));
                    subMenu.CommandInfos.Add(info, new Action(() => inspector.DisableWithFile(editor, ctx, fix)));
                }

                var configInfo = new CommandInfo(GettextCatalog.GetString("_Configure Rule"));
                subMenu.CommandInfos.Add(configInfo, new Action(() => {
                    IdeApp.Workbench.ShowGlobalPreferencesDialog(null, "C#", dialog => {
                        var panel = dialog.GetPanel <CodeIssuePanel> ("C#");
                        if (panel == null)
                        {
                            return;
                        }
                        panel.Widget.SelectCodeIssue(inspector.IdString);
                    });
                }));

                foreach (var fix2 in container.CodeFixActions)
                {
                    var provider = fix2.Diagnostic.GetCodeFixProvider().GetFixAllProvider();
                    if (provider == null)
                    {
                        continue;
                    }
                    if (!provider.GetSupportedFixAllScopes().Contains(FixAllScope.Document))
                    {
                        continue;
                    }
                    var subMenu2 = new CommandInfoSet();
                    subMenu2.Text = GettextCatalog.GetString("Fix all");
                    var diagnosticAnalyzer = fix2.Diagnostic.GetCodeDiagnosticDescriptor(LanguageNames.CSharp).GetProvider();
                    if (!diagnosticAnalyzer.SupportedDiagnostics.Contains(fix.Descriptor))
                    {
                        continue;
                    }

                    var info = new CommandInfo(GettextCatalog.GetString("In _Document"));
                    subMenu2.CommandInfos.Add(info, new Action(async delegate {
                        var fixAllDiagnosticProvider = new CodeActionEditorExtension.FixAllDiagnosticProvider(diagnosticAnalyzer.SupportedDiagnostics.Select(d => d.Id).ToImmutableHashSet(), async(Microsoft.CodeAnalysis.Document doc, ImmutableHashSet <string> diagnostics, CancellationToken token) => {
                            var model = await doc.GetSemanticModelAsync(token);
                            var compilationWithAnalyzer = model.Compilation.WithAnalyzers(new [] { diagnosticAnalyzer }.ToImmutableArray(), null, token);

                            return(await compilationWithAnalyzer.GetAnalyzerSemanticDiagnosticsAsync(model, null, token));
                        }, (arg1, arg2, arg3, arg4) => {
                            return(Task.FromResult((IEnumerable <Diagnostic>) new Diagnostic[] { }));
                        });
                        var ctx2 = new FixAllContext(
                            ctx.AnalysisDocument,
                            fix2.Diagnostic.GetCodeFixProvider(),
                            FixAllScope.Document,
                            fix2.CodeAction.EquivalenceKey,
                            diagnosticAnalyzer.SupportedDiagnostics.Select(d => d.Id),
                            fixAllDiagnosticProvider,
                            default(CancellationToken)
                            );
                        var fixAll = await provider.GetFixAsync(ctx2);
                        using (var undo = editor.OpenUndoGroup()) {
                            CodeDiagnosticDescriptor.RunAction(ctx, fixAll, default(CancellationToken));
                        }
                    }));
                    subMenu.CommandInfos.Add(subMenu2);
                }
                result.CommandInfos.Add(subMenu);
            }

            return(result);
        }
예제 #5
0
		/// <summary>
		/// Adds CDATA and comment begin tags.
		/// </summary>
		protected static void AddMiscBeginTags (CompletionDataList list)
		{
			list.Add ("!--",  "md-literal", GettextCatalog.GetString ("Comment"));
			list.AddKeyHandler (new IgnoreDashKeyHandler ());
			list.Add ("![CDATA[", "md-literal", GettextCatalog.GetString ("Character data"));
		}
예제 #6
0
        void CreatePageWidget(SectionPage page)
        {
            List <PanelInstance> boxPanels = new List <PanelInstance> ();
            List <PanelInstance> tabPanels = new List <PanelInstance> ();

            foreach (PanelInstance pi in page.Panels)
            {
                if (pi.Widget == null)
                {
                    pi.Widget = pi.Panel.CreatePanelWidget();
                    if (pi.Widget == null)
                    {
                        continue;
                    }

                    //HACK: work around bug 469427 - broken themes match on widget names
                    if (pi.Widget.Name.IndexOf("Panel") > 0)
                    {
                        pi.Widget.Name = pi.Widget.Name.Replace("Panel", "_");
                    }
                }
                else if (pi.Widget.Parent != null)
                {
                    ((Gtk.Container)pi.Widget.Parent).Remove(pi.Widget);
                }

                if (pi.Node.Grouping == PanelGrouping.Tab)
                {
                    tabPanels.Add(pi);
                }
                else
                {
                    boxPanels.Add(pi);
                }
            }

            // Try to fit panels with grouping=box or auto in the main page.
            // If they don't fit. Move auto panels to its own tab page.

            int  mainPageSize;
            bool fits;

            do
            {
                PanelInstance lastAuto = null;
                mainPageSize = 0;
                foreach (PanelInstance pi in boxPanels)
                {
                    if (pi.Node.Grouping == PanelGrouping.Auto)
                    {
                        lastAuto = pi;
                    }
                    // HACK: This we are parenting/unparenting the widget here as a workaround
                    // for a layout issue. To properly calculate the size of the widget, the widget
                    // needs to have the style that it will have when added to the window.
                    pi.Widget.Parent = this;
                    mainPageSize    += pi.Widget.SizeRequest().Height + 6;
                    pi.Widget.Unparent();
                }
                fits = mainPageSize <= pageFrame.Allocation.Height;
                if (!fits)
                {
                    if (lastAuto != null && boxPanels.Count > 1)
                    {
                        boxPanels.Remove(lastAuto);
                        tabPanels.Insert(0, lastAuto);
                    }
                    else
                    {
                        fits = true;
                    }
                }
            } while (!fits);

            Gtk.VBox box = new VBox(false, 12);
            box.Show();
            for (int n = 0; n < boxPanels.Count; n++)
            {
                if (n != 0)
                {
                    HSeparator sep = new HSeparator();
                    sep.Show();
                    box.PackStart(sep, false, false, 0);
                }
                PanelInstance pi = boxPanels [n];
                box.PackStart(pi.Widget, pi.Node.Fill, pi.Node.Fill, 0);
                pi.Widget.Show();
            }

            box.BorderWidth = 12;

            if (tabPanels.Count > 0)
            {
                /*				SquaredNotebook nb = new SquaredNotebook ();
                 * nb.Show ();
                 * nb.AddTab (box, GettextCatalog.GetString ("General"));
                 * foreach (PanelInstance pi in tabPanels) {
                 *      Gtk.Alignment a = new Alignment (0, 0, 1, 1);
                 *      a.BorderWidth = 9;
                 *      a.Show ();
                 *      a.Add (pi.Widget);
                 *      nb.AddTab (a, GettextCatalog.GetString (pi.Node.Label));
                 *      pi.Widget.Show ();
                 * }*/
                Gtk.Notebook nb = new Notebook();
                nb.Show();
                if (box.Children.Length > 0)
                {
                    Gtk.Label blab = new Gtk.Label(GettextCatalog.GetString("General"));
                    blab.Show();
                    box.BorderWidth = 9;
                    nb.InsertPage(box, blab, -1);
                }
                foreach (PanelInstance pi in tabPanels)
                {
                    Gtk.Label lab = new Gtk.Label(GettextCatalog.GetString(pi.Node.Label));
                    lab.Show();
                    Gtk.Alignment a = new Alignment(0, 0, 1, 1);
                    a.BorderWidth = 9;
                    a.Show();
                    a.Add(pi.Widget);
                    nb.InsertPage(a, lab, -1);
                    pi.Widget.Show();
                }
                page.Widget    = nb;
                nb.BorderWidth = 12;
            }
            else
            {
                page.Widget = box;
            }
        }
예제 #7
0
 private ResolveConflictsView()
 {
     this.ContentName = GettextCatalog.GetString("Resolve Conflicts");
     listStore        = new ListStore(typeField, nameField, itemField, versionBaseField, versionTheirField, versionYourField);
     BuildGui();
 }
예제 #8
0
        public async Task <bool> Execute(ProgressMonitor monitor, WorkspaceObject entry, ExecutionContext context,
                                         ConfigurationSelector configuration)
        {
            ProcessExecutionCommand cmd = CreateExecutionCommand(entry, configuration);

            monitor.Log.WriteLine(GettextCatalog.GetString("Executing: {0} {1}", cmd.Command, cmd.Arguments));

            if (!Directory.Exists(cmd.WorkingDirectory))
            {
                monitor.ReportError(GettextCatalog.GetString("Custom command working directory does not exist"), null);
                return(false);
            }

            ProcessAsyncOperation oper    = null;
            OperationConsole      console = null;
            var result = true;

            try {
                if (context != null)
                {
                    if (externalConsole)
                    {
                        console = context.ExternalConsoleFactory.CreateConsole(!pauseExternalConsole, monitor.CancellationToken);
                    }
                    else
                    {
                        console = context.ConsoleFactory.CreateConsole(monitor.CancellationToken);
                    }
                    oper = context.ExecutionHandler.Execute(cmd, console);
                }
                else
                {
                    if (externalConsole)
                    {
                        console = context.ExternalConsoleFactory.CreateConsole(!pauseExternalConsole, monitor.CancellationToken);
                        oper    = Runtime.ProcessService.StartConsoleProcess(cmd.Command, cmd.Arguments,
                                                                             cmd.WorkingDirectory, console, null);
                    }
                    else
                    {
                        oper = Runtime.ProcessService.StartProcess(cmd.Command, cmd.Arguments,
                                                                   cmd.WorkingDirectory, monitor.Log, monitor.Log, null, false).ProcessAsyncOperation;
                    }
                }

                var stopper = monitor.CancellationToken.Register(oper.Cancel);

                await oper.Task;

                stopper.Dispose();

                if (oper.ExitCode != 0)
                {
                    monitor.ReportError("Custom command failed (exit code: " + oper.ExitCode + ")", null);
                }
            } catch (Win32Exception w32ex) {
                monitor.ReportError(GettextCatalog.GetString("Failed to execute custom command '{0}': {1}",
                                                             cmd.Command, w32ex.Message), null);
                return(false);
            } catch (Exception ex) {
                LoggingService.LogError("Command execution failed", ex);
                throw new UserException(GettextCatalog.GetString("Command execution failed: {0}", ex.Message));
            } finally {
                result = oper != null && oper.ExitCode == 0;
                if (console != null)
                {
                    console.Dispose();
                }
            }
            return(result);
        }
        void ShowTooltipInfo()
        {
            ClearDescriptions();
            headlabel.Markup  = currentTooltipInformation.SignatureMarkup;
            headlabel.Visible = true;
            if (Theme.DrawPager)
            {
                headlabel.WidthRequest = headlabel.RealWidth + 70;
            }

            foreach (var cat in currentTooltipInformation.Categories)
            {
                descriptionBox.PackStart(CreateCategory(TooltipInformationWindow.GetHeaderMarkup(cat.Item1), cat.Item2), true, true, 4);
            }

            if (!string.IsNullOrEmpty(currentTooltipInformation.SummaryMarkup))
            {
                descriptionBox.PackStart(CreateCategory(TooltipInformationWindow.GetHeaderMarkup(GettextCatalog.GetString("Summary")), currentTooltipInformation.SummaryMarkup), true, true, 4);
            }
            descriptionBox.ShowAll();
            QueueResize();
            Show();
        }
예제 #10
0
        public void UpdateTranslations(IProgressMonitor monitor, params Translation[] translations)
        {
            monitor.BeginTask(null, Translations.Count + 1);

            try
            {
                List <Project> projects = new List <Project> ();
                foreach (Project p in ParentSolution.GetAllProjects())
                {
                    if (IsIncluded(p))
                    {
                        projects.Add(p);
                    }
                }
                monitor.BeginTask(GettextCatalog.GetString("Updating message catalog"), projects.Count);
                CreateDefaultCatalog(monitor);
                monitor.Log.WriteLine(GettextCatalog.GetString("Done"));
            }
            finally
            {
                monitor.EndTask();
                monitor.Step(1);
            }
            if (monitor.IsCancelRequested)
            {
                monitor.Log.WriteLine(GettextCatalog.GetString("Operation cancelled."));
                return;
            }

            Dictionary <string, bool> isIncluded = new Dictionary <string, bool> ();

            foreach (Translation translation in translations)
            {
                isIncluded[translation.IsoCode] = true;
            }
            foreach (Translation translation in this.Translations)
            {
                if (!isIncluded.ContainsKey(translation.IsoCode))
                {
                    continue;
                }
                string poFileName = translation.PoFile;
                monitor.BeginTask(GettextCatalog.GetString("Updating {0}", translation.PoFile), 1);
                try
                {
                    var pb = new ProcessArgumentBuilder();
                    pb.Add("-U");
                    pb.AddQuoted(poFileName);
                    pb.Add("-v");
                    pb.AddQuoted(this.BaseDirectory.Combine("messages.po"));

                    var process = Runtime.ProcessService.StartProcess(Translation.GetTool("msgmerge"),
                                                                      pb.ToString(), this.BaseDirectory, monitor.Log, monitor.Log, null);
                    process.WaitForOutput();
                }
                catch (System.ComponentModel.Win32Exception)
                {
                    var msg = GettextCatalog.GetString("Did not find msgmerge. Please ensure that gettext tools are installed.");
                    monitor.ReportError(msg, null);
                }
                catch (Exception ex)
                {
                    monitor.ReportError(GettextCatalog.GetString("Could not update file {0}", translation.PoFile), ex);
                }
                finally
                {
                    monitor.EndTask();
                    monitor.Step(1);
                }
                if (monitor.IsCancelRequested)
                {
                    monitor.Log.WriteLine(GettextCatalog.GetString("Operation cancelled."));
                    return;
                }
            }
        }
        public GitConfigurationDialog(GitRepository repo)
        {
            this.Build();
            this.repo         = repo;
            this.HasSeparator = false;

            this.UseNativeContextMenus();

            // Branches list

            storeBranches               = new ListStore(typeof(Branch), typeof(string), typeof(string), typeof(string));
            listBranches.Model          = storeBranches;
            listBranches.HeadersVisible = true;

            SemanticModelAttribute modelAttr = new SemanticModelAttribute("storeBranches__Branch", "storeBranches__DisplayName", "storeBranches__Tracking", "storeBranches__Name");

            TypeDescriptor.AddAttributes(storeBranches, modelAttr);

            listBranches.AppendColumn(GettextCatalog.GetString("Branch"), new CellRendererText(), "markup", 1);
            listBranches.AppendColumn(GettextCatalog.GetString("Tracking"), new CellRendererText(), "text", 2);

            listBranches.Selection.Changed += delegate {
                TreeIter it;
                bool     anythingSelected =
                    buttonRemoveBranch.Sensitive = buttonEditBranch.Sensitive = buttonSetDefaultBranch.Sensitive = listBranches.Selection.GetSelected(out it);
                if (!anythingSelected)
                {
                    return;
                }

                string currentBranch = repo.GetCurrentBranch();
                var    b             = (Branch)storeBranches.GetValue(it, 0);
                buttonRemoveBranch.Sensitive     = b.FriendlyName != currentBranch;
                buttonSetDefaultBranch.Sensitive = !b.IsCurrentRepositoryHead;
            };
            buttonRemoveBranch.Sensitive = buttonEditBranch.Sensitive = buttonSetDefaultBranch.Sensitive = false;

            // Sources tree

            storeRemotes               = new TreeStore(typeof(Remote), typeof(string), typeof(string), typeof(string), typeof(string));
            treeRemotes.Model          = storeRemotes;
            treeRemotes.HeadersVisible = true;

            SemanticModelAttribute remotesModelAttr = new SemanticModelAttribute("storeRemotes__Remote", "storeRemotes__Name", "storeRemotes__Url", "storeRemotes__BranchName", "storeRemotes__FullName");

            TypeDescriptor.AddAttributes(storeRemotes, remotesModelAttr);

            treeRemotes.AppendColumn("Remote Source / Branch", new CellRendererText(), "markup", 1);
            treeRemotes.AppendColumn("Url", new CellRendererText(), "text", 2);

            treeRemotes.Selection.Changed += delegate {
                TreeIter it;
                bool     anythingSelected = treeRemotes.Selection.GetSelected(out it);
                buttonTrackRemote.Sensitive = false;
                buttonFetch.Sensitive       = buttonEditRemote.Sensitive = buttonRemoveRemote.Sensitive = anythingSelected;
                if (!anythingSelected)
                {
                    return;
                }
                string branchName = (string)storeRemotes.GetValue(it, 3);
                if (branchName != null)
                {
                    buttonTrackRemote.Sensitive = true;
                }
            };
            buttonTrackRemote.Sensitive = buttonFetch.Sensitive = buttonEditRemote.Sensitive = buttonRemoveRemote.Sensitive = false;

            // Tags list

            storeTags               = new ListStore(typeof(string));
            listTags.Model          = storeTags;
            listTags.HeadersVisible = true;

            SemanticModelAttribute tagsModelAttr = new SemanticModelAttribute("storeTags__Name");

            TypeDescriptor.AddAttributes(storeTags, tagsModelAttr);

            listTags.AppendColumn(GettextCatalog.GetString("Tag"), new CellRendererText(), "text", 0);

            listTags.Selection.Changed += delegate {
                TreeIter it;
                buttonRemoveTag.Sensitive = buttonPushTag.Sensitive = listTags.Selection.GetSelected(out it);
            };
            buttonRemoveTag.Sensitive = buttonPushTag.Sensitive = false;

            // Fill data

            FillBranches();
            FillRemotes();
            FillTags();
        }
예제 #12
0
        internal static void SearchReplace(string findPattern, string replacePattern, Scope scope, FilterOptions options, System.Action UpdateStopButton)
        {
            if (find != null && find.IsRunning)
            {
                if (!MessageService.Confirm(GettextCatalog.GetString("There is a search already in progress. Do you want to stop it?"), AlertButton.Stop))
                {
                    return;
                }
            }
            searchTokenSource.Cancel();

            if (scope == null)
            {
                return;
            }

            find = new FindReplace();

            string pattern = findPattern;

            if (String.IsNullOrEmpty(pattern))
            {
                return;
            }
            if (!find.ValidatePattern(options, pattern))
            {
                MessageService.ShowError(GettextCatalog.GetString("Search pattern is invalid"));
                return;
            }

            if (replacePattern != null && !find.ValidatePattern(options, replacePattern))
            {
                MessageService.ShowError(GettextCatalog.GetString("Replace pattern is invalid"));
                return;
            }
            var cancelSource = new CancellationTokenSource();

            searchTokenSource = cancelSource;
            var token = cancelSource.Token;

            currentTask = Task.Run(delegate {
                using (SearchProgressMonitor searchMonitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor(true, cancellationTokenSource: cancelSource)) {
                    searchMonitor.PathMode = scope.PathMode;

                    searchMonitor.ReportStatus(scope.GetDescription(options, pattern, null));
                    if (UpdateStopButton != null)
                    {
                        Application.Invoke(delegate {
                            UpdateStopButton();
                        });
                    }

                    DateTime timer      = DateTime.Now;
                    string errorMessage = null;

                    try {
                        var results = new List <SearchResult> ();
                        foreach (SearchResult result in find.FindAll(scope, searchMonitor, pattern, replacePattern, options, token))
                        {
                            if (token.IsCancellationRequested)
                            {
                                return;
                            }
                            results.Add(result);
                        }
                        searchMonitor.ReportResults(results);
                    } catch (Exception ex) {
                        errorMessage = ex.Message;
                        LoggingService.LogError("Error while search", ex);
                    }

                    string message;
                    if (errorMessage != null)
                    {
                        message = GettextCatalog.GetString("The search could not be finished: {0}", errorMessage);
                        searchMonitor.ReportError(message, null);
                    }
                    else if (searchMonitor.CancellationToken.IsCancellationRequested)
                    {
                        message = GettextCatalog.GetString("Search cancelled.");
                        searchMonitor.ReportWarning(message);
                    }
                    else
                    {
                        string matches = string.Format(GettextCatalog.GetPluralString("{0} match found", "{0} matches found", find.FoundMatchesCount), find.FoundMatchesCount);
                        string files   = string.Format(GettextCatalog.GetPluralString("in {0} file.", "in {0} files.", find.SearchedFilesCount), find.SearchedFilesCount);
                        message        = GettextCatalog.GetString("Search completed.") + Environment.NewLine + matches + " " + files;
                        searchMonitor.ReportSuccess(message);
                    }
                    searchMonitor.ReportStatus(message);
                    searchMonitor.Log.WriteLine(GettextCatalog.GetString("Search time: {0} seconds."), (DateTime.Now - timer).TotalSeconds);
                }
                if (UpdateStopButton != null)
                {
                    Application.Invoke(delegate {
                        UpdateStopButton();
                    });
                }
            });
        }
예제 #13
0
        FindInFilesDialog(bool showReplace)
        {
            Build();

            properties = PropertyService.Get("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties());
            SetButtonIcon(toggleReplaceInFiles, "gtk-find-and-replace");
            SetButtonIcon(toggleFindInFiles, "gtk-find");

            // If we have an active floating window, attach the dialog to it. Otherwise use the main IDE window.
            var current_toplevel = Gtk.Window.ListToplevels().FirstOrDefault(x => x.IsActive);

            if (current_toplevel is Components.DockNotebook.DockWindow)
            {
                TransientFor = current_toplevel;
            }
            else
            {
                TransientFor = IdeApp.Workbench.RootWindow;
            }

            toggleReplaceInFiles.Active = showReplace;
            toggleFindInFiles.Active    = !showReplace;

            toggleFindInFiles.Toggled += delegate {
                if (toggleFindInFiles.Active)
                {
                    Title = GettextCatalog.GetString("Find in Files");
                    HideReplaceUI();
                }
            };

            toggleReplaceInFiles.Toggled += delegate {
                if (toggleReplaceInFiles.Active)
                {
                    Title = GettextCatalog.GetString("Replace in Files");
                    ShowReplaceUI();
                }
            };

            buttonSearch.Clicked += HandleSearchClicked;
            buttonClose.Clicked  += (sender, e) => Destroy();
            DeleteEvent          += (o, args) => Destroy();
            buttonSearch.GrabDefault();

            buttonStop.Clicked += ButtonStopClicked;
            var scopeStore = new ListStore(typeof(string));

            var workspace = IdeApp.Workspace;

            if (workspace != null && workspace.GetAllSolutions().Count() == 1)
            {
                scopeStore.AppendValues(GettextCatalog.GetString("Whole solution"));
            }
            else
            {
                scopeStore.AppendValues(GettextCatalog.GetString("All solutions"));
            }
            scopeStore.AppendValues(GettextCatalog.GetString("Current project"));
            scopeStore.AppendValues(GettextCatalog.GetString("All open files"));
            scopeStore.AppendValues(GettextCatalog.GetString("Directories"));
            scopeStore.AppendValues(GettextCatalog.GetString("Current document"));
            scopeStore.AppendValues(GettextCatalog.GetString("Selection"));
            comboboxScope.Model = scopeStore;

            comboboxScope.Changed += HandleScopeChanged;

            InitFromProperties();

            if (showReplace)
            {
                toggleReplaceInFiles.Toggle();
            }
            else
            {
                toggleFindInFiles.Toggle();
            }

            if (IdeApp.Workbench.ActiveDocument != null)
            {
                var view = IdeApp.Workbench.ActiveDocument.Editor;
                if (view != null)
                {
                    string selectedText = FormatPatternToSelectionOption(view.SelectedText, properties.Get("RegexSearch", false));
                    if (!string.IsNullOrEmpty(selectedText))
                    {
                        if (selectedText.Any(c => c == '\n' || c == '\r'))
                        {
//							comboboxScope.Active = ScopeSelection;
                        }
                        else
                        {
                            if (comboboxScope.Active == (int)SearchScope.Selection)
                            {
                                comboboxScope.Active = (int)SearchScope.CurrentDocument;
                            }
                            comboboxentryFind.Entry.Text = selectedText;
                        }
                    }
                    else if (comboboxScope.Active == (int)SearchScope.Selection)
                    {
                        comboboxScope.Active = (int)SearchScope.CurrentDocument;
                    }
                }
            }
            comboboxentryFind.Entry.SelectRegion(0, comboboxentryFind.ActiveText.Length);
            comboboxentryFind.GrabFocus();
            DeleteEvent += delegate { Destroy(); };
            UpdateStopButton();
            UpdateSensitivity();
            if (!buttonSearch.Sensitive)
            {
                comboboxScope.Active = (int)SearchScope.Directories;
            }

            Child.Show();
            updateTimer = GLib.Timeout.Add(750, delegate {
                UpdateSensitivity();
                return(true);
            });
        }
예제 #14
0
 public SaveProjectChange(Project project)
 {
     this.Project     = project;
     this.Description = string.Format(GettextCatalog.GetString("Save project {0}"), project.Name);
 }
예제 #15
0
 public MergeView(VersionControlDocumentInfo info) : base(GettextCatalog.GetString("Merge"), GettextCatalog.GetString("Shows the merge view for the current file"))
 {
     this.info = info;
 }
        string GetSomePackageSourcesCouldNotBeReachedErrorMessage(MonoDevelopAggregateRepository repository)
        {
            string message = GettextCatalog.GetString("Some package sources could not be reached.");

            return(new AggregateExceptionErrorMessage(message, repository.GetAggregateException()).ToString());
        }
예제 #17
0
        public StackTracePad()
        {
            this.ShadowType = ShadowType.None;

            ActionCommand evalCmd = new ActionCommand("StackTracePad.EvaluateMethodParams", GettextCatalog.GetString("Evaluate Method Parameters"));
            ActionCommand gotoCmd = new ActionCommand("StackTracePad.ActivateFrame", GettextCatalog.GetString("Activate Stack Frame"));

            menuSet = new CommandEntrySet();
            menuSet.Add(evalCmd);
            menuSet.Add(gotoCmd);
            menuSet.AddSeparator();
            menuSet.AddItem(EditCommands.SelectAll);
            menuSet.AddItem(EditCommands.Copy);

            store = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Pango.Style), typeof(object), typeof(int), typeof(bool));

            tree                   = new PadTreeView(store);
            tree.RulesHint         = true;
            tree.HeadersVisible    = true;
            tree.Selection.Mode    = SelectionMode.Multiple;
            tree.SearchEqualFunc   = Search;
            tree.EnableSearch      = true;
            tree.SearchColumn      = 1;
            tree.ButtonPressEvent += HandleButtonPressEvent;
            tree.DoPopupMenu       = ShowPopup;

            TreeViewColumn col = new TreeViewColumn();
            CellRenderer   crp = new CellRendererIcon();

            col.PackStart(crp, false);
            col.AddAttribute(crp, "stock_id", IconColumn);
            tree.AppendColumn(col);

            TreeViewColumn FrameCol = new TreeViewColumn();

            FrameCol.Title = GettextCatalog.GetString("Name");
            refresh        = new CellRendererIcon();
            refresh.Pixbuf = ImageService.GetPixbuf(Gtk.Stock.Refresh).ScaleSimple(12, 12, Gdk.InterpType.Hyper);
            FrameCol.PackStart(refresh, false);
            FrameCol.AddAttribute(refresh, "visible", CanRefreshColumn);
            FrameCol.PackStart(tree.TextRenderer, true);
            FrameCol.AddAttribute(tree.TextRenderer, "text", MethodColumn);
            FrameCol.AddAttribute(tree.TextRenderer, "foreground", ForegroundColumn);
            FrameCol.AddAttribute(tree.TextRenderer, "style", StyleColumn);
            FrameCol.Resizable = true;
            FrameCol.Alignment = 0.0f;
            tree.AppendColumn(FrameCol);

            col       = new TreeViewColumn();
            col.Title = GettextCatalog.GetString("File");
            col.PackStart(tree.TextRenderer, false);
            col.AddAttribute(tree.TextRenderer, "text", FileColumn);
            col.AddAttribute(tree.TextRenderer, "foreground", ForegroundColumn);
            tree.AppendColumn(col);

            col       = new TreeViewColumn();
            col.Title = GettextCatalog.GetString("Language");
            col.PackStart(tree.TextRenderer, false);
            col.AddAttribute(tree.TextRenderer, "text", LangColumn);
            col.AddAttribute(tree.TextRenderer, "foreground", ForegroundColumn);
            tree.AppendColumn(col);

            col       = new TreeViewColumn();
            col.Title = GettextCatalog.GetString("Address");
            col.PackStart(tree.TextRenderer, false);
            col.AddAttribute(tree.TextRenderer, "text", AddrColumn);
            col.AddAttribute(tree.TextRenderer, "foreground", ForegroundColumn);
            tree.AppendColumn(col);

            Add(tree);
            ShowAll();

            current_backtrace = DebuggingService.CurrentCallStack;
            UpdateDisplay();

            DebuggingService.CallStackChanged    += (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnClassStackChanged));
            DebuggingService.CurrentFrameChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnFrameChanged));
            tree.RowActivated += OnRowActivated;
        }
예제 #18
0
 string GetStartingMessage()
 {
     return(String.Format(
                GettextCatalog.GetString(StartingMessageFormat),
                GetPackageId()));
 }
예제 #19
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            buttonCancel.Accessible.Name        = "Dialogs.Options.Cancel";
            buttonCancel.Accessible.Description = GettextCatalog.GetString("Close the options dialog and discard any changes");
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            buttonOk.Accessible.Name        = "Dialogs.Options.Ok";
            buttonOk.Accessible.Description = GettextCatalog.GetString("Close the options dialog and keep the changes");
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            mainHBox.Accessible.SetShouldIgnore(true);
            tree = new TreeView();
            tree.Accessible.Name        = "Dialogs.Options.Categories";
            tree.Accessible.Description = GettextCatalog.GetString("The categories of options that are available in this dialog");

            var sw = new ScrolledWindow();

            sw.Accessible.SetShouldIgnore(true);
            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.Accessible.SetShouldIgnore(true);

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            vbox.Accessible.SetShouldIgnore(true);
            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            headerBox.Accessible.SetShouldIgnore(true);

            labelTitle = new Label();
            labelTitle.Accessible.Name = "Dialogs.Options.PageTitle";
            labelTitle.Xalign          = 0;
            textHeader = new Alignment(0, 0, 1, 1);
            textHeader.Accessible.SetShouldIgnore(true);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            var imageHeaderWidget = imageHeader.ToGtkWidget();

            imageHeaderWidget.Accessible.SetShouldIgnore(true);
            headerBox.PackStart(imageHeaderWidget);

            var fboxHeader = new HeaderBox();

            fboxHeader.Accessible.SetShouldIgnore(true);
            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            pageFrame.Accessible.SetShouldIgnore(true);
            var fbox = new HeaderBox();

            fbox.Accessible.SetShouldIgnore(true);
            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
예제 #20
0
        void ReportPowerShellScriptWarning()
        {
            string message = GettextCatalog.GetString("WARNING: {0} Package contains PowerShell scripts which will not be run.", GetPackageId());

            packageManagementEvents.OnPackageOperationMessageLogged(MessageLevel.Info, message);
        }
        protected override void Update(CommandArrayInfo ainfo)
        {
            var doc = IdeApp.Workbench.ActiveDocument;

            if (doc == null || doc.FileName == FilePath.Null || doc.ParsedDocument == null)
            {
                return;
            }
            var semanticModel = doc.ParsedDocument.GetAst <SemanticModel> ();

            if (semanticModel == null)
            {
                return;
            }
            var  info  = RefactoringSymbolInfo.GetSymbolInfoAsync(doc, doc.Editor).Result;
            bool added = false;

            var ext = doc.GetContent <CodeActionEditorExtension> ();

            if (ext != null && !ext.GetCurrentFixes().IsEmpty)
            {
                var fixMenu = CreateFixMenu(doc.Editor, doc, ext.GetCurrentFixes());
                if (fixMenu.CommandInfos.Count > 0)
                {
                    ainfo.Add(fixMenu, null);
                    added = true;
                }
            }
            var ciset = new CommandInfoSet();

            ciset.Text = GettextCatalog.GetString("Refactor");

            bool canRename = RenameHandler.CanRename(info.Symbol ?? info.DeclaredSymbol);

            if (canRename)
            {
                ciset.CommandInfos.Add(IdeApp.CommandService.GetCommandInfo(MonoDevelop.Ide.Commands.EditCommands.Rename), new Action(async delegate {
                    await new MonoDevelop.Refactoring.Rename.RenameRefactoring().Rename(info.Symbol ?? info.DeclaredSymbol);
                }));
                added = true;
            }
            bool first = true;

            if (ext != null)
            {
                foreach (var fix in ext.GetCurrentFixes().CodeRefactoringActions)
                {
                    if (added & first && ciset.CommandInfos.Count > 0)
                    {
                        ciset.CommandInfos.AddSeparator();
                    }
                    var info2 = new CommandInfo(fix.CodeAction.Title);
                    ciset.CommandInfos.Add(info2, new Action(async() => await new CodeActionEditorExtension.ContextActionRunner(fix.CodeAction, doc.Editor, doc).Run()));
                    added = true;
                    first = false;
                }
            }

            if (ciset.CommandInfos.Count > 0)
            {
                ainfo.Add(ciset, null);
                added = true;
            }

            var gotoDeclarationSymbol = info.Symbol;

            if (gotoDeclarationSymbol == null && info.DeclaredSymbol != null && info.DeclaredSymbol.Locations.Length > 1)
            {
                gotoDeclarationSymbol = info.DeclaredSymbol;
            }
            if (IdeApp.ProjectOperations.CanJumpToDeclaration(gotoDeclarationSymbol) || gotoDeclarationSymbol == null && IdeApp.ProjectOperations.CanJumpToDeclaration(info.CandidateSymbols.FirstOrDefault()))
            {
                var type = (gotoDeclarationSymbol ?? info.CandidateSymbols.FirstOrDefault()) as INamedTypeSymbol;
                if (type != null && type.Locations.Length > 1)
                {
                    var declSet = new CommandInfoSet();
                    declSet.Text = GettextCatalog.GetString("_Go to Declaration");
                    foreach (var part in type.Locations)
                    {
                        var loc = part.GetLineSpan();
                        declSet.CommandInfos.Add(string.Format(GettextCatalog.GetString("{0}, Line {1}"), FormatFileName(part.SourceTree.FilePath), loc.StartLinePosition.Line + 1), new Action(() => IdeApp.ProjectOperations.JumpTo(type, part, doc.Project)));
                    }
                    ainfo.Add(declSet);
                }
                else
                {
                    ainfo.Add(IdeApp.CommandService.GetCommandInfo(RefactoryCommands.GotoDeclaration), new Action(() => GotoDeclarationHandler.Run(doc)));
                }
                added = true;
            }


            if (info.DeclaredSymbol != null && GotoBaseDeclarationHandler.CanGotoBase(info.DeclaredSymbol))
            {
                ainfo.Add(GotoBaseDeclarationHandler.GetDescription(info.DeclaredSymbol), new Action(() => GotoBaseDeclarationHandler.GotoBase(doc, info.DeclaredSymbol)));
                added = true;
            }

            var sym = info.Symbol ?? info.DeclaredSymbol;

            if (doc.HasProject && sym != null)
            {
                ainfo.Add(IdeApp.CommandService.GetCommandInfo(RefactoryCommands.FindReferences), new System.Action(() => {
                    if (sym.Kind == SymbolKind.Local || sym.Kind == SymbolKind.Parameter || sym.Kind == SymbolKind.TypeParameter)
                    {
                        FindReferencesHandler.FindRefs(sym);
                    }
                    else
                    {
                        RefactoringService.FindReferencesAsync(sym.GetDocumentationCommentId());
                    }
                }));
                try {
                    if (Microsoft.CodeAnalysis.FindSymbols.SymbolFinder.FindSimilarSymbols(sym, semanticModel.Compilation).Count() > 1)
                    {
                        ainfo.Add(IdeApp.CommandService.GetCommandInfo(RefactoryCommands.FindAllReferences), new System.Action(() => RefactoringService.FindAllReferencesAsync(sym.GetDocumentationCommentId())));
                    }
                } catch (Exception) {
                    // silently ignore roslyn bug.
                }
            }
            added = true;

            if (info.DeclaredSymbol != null)
            {
                string description;
                if (FindDerivedSymbolsHandler.CanFindDerivedSymbols(info.DeclaredSymbol, out description))
                {
                    ainfo.Add(description, new Action(() => FindDerivedSymbolsHandler.FindDerivedSymbols(info.DeclaredSymbol)));
                    added = true;
                }

                if (FindMemberOverloadsHandler.CanFindMemberOverloads(info.DeclaredSymbol, out description))
                {
                    ainfo.Add(description, new Action(() => FindMemberOverloadsHandler.FindOverloads(info.DeclaredSymbol)));
                    added = true;
                }

                if (FindExtensionMethodHandler.CanFindExtensionMethods(info.DeclaredSymbol, out description))
                {
                    ainfo.Add(description, new Action(() => FindExtensionMethodHandler.FindExtensionMethods(info.DeclaredSymbol)));
                    added = true;
                }
            }
        }
 void LogCheckingForUpdates(string projectName)
 {
     Log(GettextCatalog.GetString("Checking {0} for updates...", projectName));
 }
        void SetupAccessibility()
        {
            label76.Accessible.Role = Atk.Role.Filler;
            label75.Accessible.Role = Atk.Role.Filler;
            label74.Accessible.Role = Atk.Role.Filler;
            compileTargetCombo.SetCommonAccessibilityAttributes("CodeGeneration.CompileTarget", label86,
                                                                GettextCatalog.GetString("Select the compile target for the code generation"));

            mainClassEntry.SetCommonAccessibilityAttributes("CodeGeneration.MainClass", label88,
                                                            GettextCatalog.GetString("Enter the main class for the code generation"));

            iconEntry.SetEntryAccessibilityAttributes("CodeGeneration.WinIcon", "",
                                                      GettextCatalog.GetString("Enter the file to use as the icon on Windows"));
            iconEntry.SetAccessibilityLabelRelationship(label3);

            codepageEntry.SetCommonAccessibilityAttributes("CodeGeneration.CodePage", label1,
                                                           GettextCatalog.GetString("Select the compiler code page"));

            noStdLibCheckButton.SetCommonAccessibilityAttributes("CodeGeneration.NoStdLib", "", GettextCatalog.GetString("Whether or not to include a reference to mscorlib.dll"));

            langVerCombo.SetCommonAccessibilityAttributes("CodeGeneration.LanguageVersion", label2,
                                                          GettextCatalog.GetString("Select the version of C# to use"));

            allowUnsafeCodeCheckButton.SetCommonAccessibilityAttributes("CodeGeneration.AllowUnsafe", "",
                                                                        GettextCatalog.GetString("Check to allow 'unsafe' code"));
        }
예제 #24
0
        public override List <Change> PerformChanges(RefactoringOptions options, object prop)
        {
            RenameProperties properties       = (RenameProperties)prop;
            List <Change>    result           = new List <Change> ();
            IEnumerable <MemberReference> col = null;

            using (var monitor = new MessageDialogProgressMonitor(true, false, false, true)) {
                col = ReferenceFinder.FindReferences(options.SelectedItem, properties.IncludeOverloads, monitor);
                if (col == null)
                {
                    return(result);
                }

                if (properties.RenameFile && options.SelectedItem is IType)
                {
                    var cls            = ((IType)options.SelectedItem).GetDefinition();
                    int currentPart    = 1;
                    var alreadyRenamed = new HashSet <string> ();
                    foreach (var part in cls.Parts)
                    {
                        if (alreadyRenamed.Contains(part.Region.FileName))
                        {
                            continue;
                        }
                        alreadyRenamed.Add(part.Region.FileName);

                        string oldFileName = System.IO.Path.GetFileNameWithoutExtension(part.Region.FileName);
                        string newFileName;
                        var    newName = properties.NewName;
                        if (string.IsNullOrEmpty(oldFileName) || string.IsNullOrEmpty(newName))
                        {
                            continue;
                        }
                        if (oldFileName.ToUpper() == newName.ToUpper() || oldFileName.ToUpper().EndsWith("." + newName.ToUpper(), StringComparison.Ordinal))
                        {
                            continue;
                        }
                        int idx = oldFileName.IndexOf(cls.Name, StringComparison.Ordinal);
                        if (idx >= 0)
                        {
                            newFileName = oldFileName.Substring(0, idx) + newName + oldFileName.Substring(idx + cls.Name.Length);
                        }
                        else
                        {
                            newFileName = currentPart != 1 ? newName + currentPart : newName;
                            currentPart++;
                        }

                        int t = 0;
                        while (System.IO.File.Exists(GetFullFileName(newFileName, part.Region.FileName, t)))
                        {
                            t++;
                        }
                        result.Add(new RenameFileChange(part.Region.FileName, GetFullFileName(newFileName, part.Region.FileName, t)));
                    }
                }

                foreach (var memberRef in col)
                {
                    TextReplaceChange change = new TextReplaceChange();
                    change.FileName     = memberRef.FileName;
                    change.Offset       = memberRef.Offset;
                    change.RemovedChars = memberRef.Length;
                    change.InsertedText = properties.NewName;
                    change.Description  = string.Format(GettextCatalog.GetString("Replace '{0}' with '{1}'"), memberRef.GetName(), properties.NewName);
                    result.Add(change);
                }
            }
            return(result);
        }
예제 #25
0
        protected override void OnAdd(FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
        {
            foreach (FilePath path in localPaths)
            {
                if (IsVersioned(path) && File.Exists(path) && !Directory.Exists(path))
                {
                    if (RootPath.IsNull)
                    {
                        throw new UserException(GettextCatalog.GetString("Project publishing failed. There is a stale .svn folder in the path '{0}'", path.ParentDirectory));
                    }
                    VersionInfo srcInfo = GetVersionInfo(path, VersionInfoQueryFlags.IgnoreCache);
                    if (srcInfo.HasLocalChange(VersionStatus.ScheduledDelete))
                    {
                        // It is a file that was deleted. It can be restored now since it's going
                        // to be added again.
                        // First of all, make a copy of the file
                        string tmp = Path.GetTempFileName();
                        File.Copy(path, tmp, true);

                        // Now revert the status of the file
                        Revert(path, false, monitor);

                        // Copy the file over the old one and clean up
                        File.Copy(tmp, path, true);
                        File.Delete(tmp);
                        continue;
                    }
                }
                else
                {
                    if (!IsVersioned(path.ParentDirectory))
                    {
                        // The file/folder belongs to an unversioned folder. We can add it by versioning the parent
                        // folders up to the root of the repository

                        if (!path.IsChildPathOf(RootPath))
                        {
                            throw new InvalidOperationException("File outside the repository directory");
                        }

                        List <FilePath> dirChain  = new List <FilePath> ();
                        FilePath        parentDir = path.CanonicalPath;
                        do
                        {
                            parentDir = parentDir.ParentDirectory;
                            if (IsVersioned(parentDir))
                            {
                                break;
                            }
                            dirChain.Add(parentDir);
                        }while (parentDir != RootPath);

                        // Found all parent unversioned dirs. Versin them now.
                        dirChain.Reverse();
                        FileUpdateEventArgs args = new FileUpdateEventArgs();
                        foreach (var d in dirChain)
                        {
                            Svn.Add(d, false, monitor);
                            args.Add(new FileUpdateEventInfo(this, d, true));
                        }
                        VersionControlService.NotifyFileStatusChanged(args);
                    }
                }
                Svn.Add(path, recurse, monitor);
            }
        }
예제 #26
0
 static string GetAboutCommandText()
 {
     return(GettextCatalog.GetString("About {0}", ApplicationMenuName));
 }
예제 #27
0
        protected virtual void OnButtonAddClicked(object sender, System.EventArgs e)
        {
            var dlg = new SelectFolderDialog(GettextCatalog.GetString("Select the mono installation prefix"))
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            //set a platform-dependent default folder for the dialog if possible
            if (Platform.IsWindows)
            {
                // ProgramFilesX86 is broken on 32-bit WinXP
                string programFilesX86 = GetProgramFilesX86();
                if (!string.IsNullOrEmpty(programFilesX86) && System.IO.Directory.Exists(programFilesX86))
                {
                    dlg.CurrentFolder = programFilesX86;
                }
            }
            else
            {
                if (System.IO.Directory.Exists("/usr"))
                {
                    dlg.CurrentFolder = "/usr";
                }
            }

            if (!dlg.Run())
            {
                return;
            }

            var rinfo = new MonoRuntimeInfo(dlg.SelectedFile);

            if (!rinfo.IsValidRuntime)
            {
                MessageService.ShowError(GettextCatalog.GetString("Mono runtime not found"), GettextCatalog.GetString("Please provide a valid directory prefix where mono is installed (for example, /usr)"));
                return;
            }
            newInfos.Add(rinfo);
            store.AppendValues(rinfo.DisplayName, rinfo);
        }
예제 #28
0
 static string GetHideWindowCommandText()
 {
     return(GettextCatalog.GetString("Hide {0}", ApplicationMenuName));
 }
예제 #29
0
        public void ShowCaretState(int line, int column, int selectedChars, bool isInInsertMode)
        {
            DispatchService.AssertGuiThread();
            string cursorText = selectedChars > 0 ? String.Format("{0,3} : {1,-3} - {2}", line, column, selectedChars) : String.Format("{0,3} : {1,-3}", line, column);

            if (cursorLabel.Text != cursorText)
            {
                cursorLabel.Text = cursorText;
            }

            string modeStatusText = isInInsertMode ? GettextCatalog.GetString("INS") : GettextCatalog.GetString("OVR");

            if (modeLabel.Text != modeStatusText)
            {
                modeLabel.Text = modeStatusText;
            }
        }
        public ComponentSelectorDialog(IToolboxConsumer currentConsumer)
        {
            using (ProgressMonitor monitor = new MessageDialogProgressMonitor(true, true, false, true)) {
                index = DesignerSupport.Service.ToolboxService.GetComponentIndex(monitor);
            }

            this.ApplyTheme();
            this.Build();

            store = new TreeStore(typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Xwt.Drawing.Image), typeof(ItemToolboxNode), typeof(bool), typeof(int));

            TreeViewColumn col;

            col = new TreeViewColumn();
            Gtk.CellRendererToggle crt = new CellRendererToggle();
            col.PackStart(crt, false);
            col.AddAttribute(crt, "active", ColChecked);
            col.AddAttribute(crt, "visible", ColShowCheck);
            crt.Toggled     += OnToggleItem;
            col.SortColumnId = ColChecked;
            listView.AppendColumn(col);

            col         = new TreeViewColumn();
            col.Spacing = 3;
            col.Title   = GettextCatalog.GetString("Name");
            var crp = new CellRendererImage();
            CellRendererText crx = new CellRendererText();

            crx.Width = 150;
            col.PackStart(crp, false);
            col.PackStart(crx, false);
            col.AddAttribute(crp, "image", ColIcon);
            col.AddAttribute(crp, "visible", ColShowCheck);
            col.AddAttribute(crx, "text", ColName);
            col.AddAttribute(crx, "weight", ColBold);
            listView.AppendColumn(col);
            col.Resizable    = true;
            col.SortColumnId = ColName;

            col              = listView.AppendColumn(GettextCatalog.GetString("Library"), new CellRendererText(), "text", ColLibrary);
            col.Resizable    = true;
            col.SortColumnId = ColLibrary;

            col              = listView.AppendColumn(GettextCatalog.GetString("Location"), new CellRendererText(), "text", ColPath);
            col.Resizable    = true;
            col.SortColumnId = ColPath;

            store.SetSortColumnId(ColName, SortType.Ascending);
            listView.SearchColumn = ColName;
            listView.Model        = store;

            foreach (ItemToolboxNode it in DesignerSupport.Service.ToolboxService.UserItems)
            {
                currentItems [it] = it;
            }

            List <string> list = new List <string> ();

            foreach (ComponentIndexFile ifile in index.Files)
            {
                foreach (ItemToolboxNode co in ifile.Components)
                {
                    if (!list.Contains(co.ItemDomain))
                    {
                        list.Add(co.ItemDomain);
                    }
                }
            }

            string defaultDomain = null;

            if (currentConsumer != null)
            {
                defaultDomain = currentConsumer.DefaultItemDomain;
            }

            comboType.AppendText(GettextCatalog.GetString("All"));
            comboType.Active = 0;

            for (int n = 0; n < list.Count; n++)
            {
                string s = list [n];
                comboType.AppendText(s);
                if (s == defaultDomain)
                {
                    comboType.Active = n + 1;
                }
            }
        }