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();
        }
        /// <summary>
        /// Processes type metadata.
        /// </summary>
        /// <param name="asmName">The name of the current assembly.</param>
        /// <param name="typeElement">The XML node that defines the type metadata.</param>
        private static void ProcessMetadataType(String asmName, XElement typeElement)
        {
            var name = typeElement.AttributeValueString("Name");

            if (String.IsNullOrEmpty(name))
            {
                throw new InvalidOperationException("Invalid type name.");
            }

            var typeName = String.Format("{0}, {1}", name, asmName);
            var type     = Type.GetType(typeName, false);

            if (type == null)
            {
                throw new InvalidOperationException(String.Format("Invalid type name '{0}'", typeName));
            }

            var attributes = new List <Attribute>();

            foreach (var attributeElement in typeElement.Elements())
            {
                switch (attributeElement.Name.LocalName)
                {
                case "Editor":
                    attributes.Add(CreateEditorAttribute(attributeElement));
                    break;

                case "TypeConverter":
                    attributes.Add(CreateTypeConverterAttribute(attributeElement));
                    break;

                case "DefaultValue":
                    attributes.Add(CreateDefaultValueAttribute(attributeElement, type));
                    break;

                case "Properties":
                    break;

                default:
                    throw new InvalidOperationException(String.Format("Invalid element '{0}' in '{1}'", attributeElement.Name.LocalName, typeName));
                }
            }
            if (attributes.Any())
            {
                TypeDescriptor.AddAttributes(type, attributes.ToArray());
            }

            var properties          = typeElement.Element("Properties");
            var propertyDescriptors = new List <PropertyDescriptor>();

            if (properties != null)
            {
                foreach (var propertyElement in properties.Elements())
                {
                    var propertyDescriptor = ProcessMetadataProperty(type, propertyElement);
                    propertyDescriptors.Add(propertyDescriptor);
                }
            }

            var providerParent = TypeDescriptor.GetProvider(type);
            var provider       = new XmlDrivenCustomTypeDescriptionProvider(providerParent, propertyDescriptors);

            TypeDescriptor.AddProvider(provider, type);
        }
 private void SetUpObjectesForPropertyGrid()
 {
     TypeDescriptor.AddAttributes(typeof(ExternalReporteeBE), new TypeConverterAttribute(typeof(ExpandableObjectConverter)));
     TypeDescriptor.AddAttributes(typeof(Guid), new TypeConverterAttribute(typeof(ExpandableObjectConverter)));
 }
 static MicroPipelineComponentFixture()
 {
     // PipelineComponentFixture<MicroPipelineComponent> assumes and needs the following converter
     TypeDescriptor.AddAttributes(typeof(IEnumerable <IMicroComponent>), new TypeConverterAttribute(typeof(MicroComponentEnumerableConverter)));
 }
示例#5
0
        void CreateControl()
        {
            control = new HPaned();

            store = new Gtk.TreeStore(typeof(Xwt.Drawing.Image),               // image - type
                                      typeof(bool),                            // read?
                                      typeof(TaskListEntry),                   // read? -- use Pango weight
                                      typeof(string));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Type", "store__Read", "store__Task", "store__Description");

            TypeDescriptor.AddAttributes(store, modelAttr);

            TreeModelFilterVisibleFunc filterFunct = new TreeModelFilterVisibleFunc(FilterTasks);

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = filterFunct;

            sort = new TreeModelSort(filter);
            sort.SetSortFunc(VisibleColumns.Type, SeverityIterSort);
            sort.SetSortFunc(VisibleColumns.Project, ProjectIterSort);
            sort.SetSortFunc(VisibleColumns.File, FileIterSort);

            view = new PadTreeView(sort);
            view.ShowExpanders = true;
            view.RulesHint     = true;
            view.DoPopupMenu   = (evnt) => IdeApp.CommandService.ShowContextMenu(view, evnt, CreateMenu());
            AddColumns();
            LoadColumnsVisibility();
            view.Columns[VisibleColumns.Type].SortColumnId    = VisibleColumns.Type;
            view.Columns[VisibleColumns.Project].SortColumnId = VisibleColumns.Project;
            view.Columns[VisibleColumns.File].SortColumnId    = VisibleColumns.File;

            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(view);
            TaskService.Errors.TasksRemoved += ShowResults;
            TaskService.Errors.TasksAdded   += TaskAdded;
            TaskService.Errors.TasksChanged += TaskChanged;
            TaskService.Errors.CurrentLocationTaskChanged += HandleTaskServiceErrorsCurrentLocationTaskChanged;

            IdeApp.Workspace.FirstWorkspaceItemOpened += OnCombineOpen;
            IdeApp.Workspace.LastWorkspaceItemClosed  += OnCombineClosed;

            view.RowActivated += new RowActivatedHandler(OnRowActivated);

            iconWarning = ImageService.GetIcon(Ide.Gui.Stock.Warning, Gtk.IconSize.Menu);
            iconError   = ImageService.GetIcon(Ide.Gui.Stock.Error, Gtk.IconSize.Menu);
            iconInfo    = ImageService.GetIcon(Ide.Gui.Stock.Information, Gtk.IconSize.Menu);
            iconEmpty   = ImageService.GetIcon(Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);

            control.Add1(sw);

            outputView = new LogView {
                Name = "buildOutput"
            };
            control.Add2(outputView);

            control.ShowAll();

            control.SizeAllocated += HandleControlSizeAllocated;

            bool outputVisible = OutputViewVisible;

            if (outputVisible)
            {
                outputView.Visible = true;
                logBtn.Active      = true;
            }
            else
            {
                outputView.Hide();
            }

            sw.SizeAllocated += HandleSwSizeAllocated;

            // Load existing tasks
            foreach (TaskListEntry t in TaskService.Errors)
            {
                AddTask(t);
            }

            control.FocusChain = new Gtk.Widget [] { sw };
        }
示例#6
0
        public TestResultsPad()
        {
            UnitTestService.TestSuiteChanged     += new EventHandler(OnTestSuiteChanged);
            IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;

            panel = new VBox {
                Name = "testResultBox"
            };

            // Results notebook

            book = new HPaned();
            panel.PackStart(book, true, true, 0);
            panel.FocusChain = new Gtk.Widget [] { book };

            // Failures tree
            failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView {
                Name = "testResultsTree"
            };
            failuresTreeView.HeadersVisible = false;
            failuresStore = new TreeStore(typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int), typeof(int));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Image", "store__Message", "store__RootTest",
                                                                          "store__FileName", "store__FileNumber", "store__ErrorOrStackTrace");

            TypeDescriptor.AddAttributes(failuresStore, modelAttr);

            var pr = new CellRendererImage();
            CellRendererText tr  = new CellRendererText();
            TreeViewColumn   col = new TreeViewColumn();

            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 0);
            col.PackStart(tr, false);
            col.AddAttribute(tr, "markup", 1);
            failuresTreeView.AppendColumn(col);
            failuresTreeView.Model = failuresStore;

            var sw = new MonoDevelop.Components.CompactScrolledWindow();

            sw.ShadowType = ShadowType.None;
            sw.Add(failuresTreeView);
            book.Pack1(sw, true, true);

            outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView {
                Name = "testResultOutput"
            };
            outputView.ModifyFont(FontService.MonospaceFont);
            outputView.Editable = false;
            bold        = new TextTag("bold");
            bold.Weight = Pango.Weight.Bold;
            outputView.Buffer.TagTable.Add(bold);
            sw            = new MonoDevelop.Components.CompactScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(outputView);
            book.Pack2(sw, true, true);
            outputViewScrolled = sw;

            failuresTreeView.RowActivated      += OnRowActivated;
            failuresTreeView.Selection.Changed += OnRowSelected;
            failuresTreeView.DoPopupMenu        = delegate(EventButton evt) {
                IdeApp.CommandService.ShowContextMenu(failuresTreeView, evt,
                                                      "/MonoDevelop/UnitTesting/ContextMenu/TestResultsPad");
            };

            panel.ShowAll();

            outputViewScrolled.Hide();
        }
示例#7
0
 public static void RegisterTypeConverter <T, TC>() where TC : TypeConverter
 {
     TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC)));
 }
示例#8
0
 public void AssignTypeConverter <IType, IConverterType> ()
 {
     TypeDescriptor.AddAttributes(typeof(IType), new TypeConverterAttribute(typeof(IConverterType)));
 }
示例#9
0
        protected override void Initialize(IPadWindow window)
        {
            Id = "MonoDevelop.Debugger.BreakpointPad";
            // Toolbar and menu definitions

            ActionCommand gotoCmd       = new ActionCommand(LocalCommands.GoToFile, GettextCatalog.GetString("Go to File"));
            ActionCommand propertiesCmd = new ActionCommand(LocalCommands.Properties, GettextCatalog.GetString("Properties"), Stock.Properties);

            menuSet = new CommandEntrySet();
            menuSet.Add(gotoCmd);
            menuSet.AddSeparator();
            menuSet.AddItem(DebugCommands.EnableDisableBreakpoint);
            menuSet.AddItem(DebugCommands.ClearAllBreakpoints);
            menuSet.AddItem(DebugCommands.DisableAllBreakpoints);
            menuSet.AddItem(EditCommands.DeleteKey);
            menuSet.AddSeparator();
            menuSet.Add(propertiesCmd);

            CommandEntrySet toolbarSet = new CommandEntrySet();

            toolbarSet.AddItem(DebugCommands.EnableDisableBreakpoint);
            toolbarSet.AddItem(DebugCommands.ClearAllBreakpoints);
            toolbarSet.AddItem(DebugCommands.DisableAllBreakpoints);
            toolbarSet.AddItem(EditCommands.Delete);
            toolbarSet.AddSeparator();
            toolbarSet.Add(propertiesCmd);
            toolbarSet.AddSeparator();
            toolbarSet.Add(new CommandEntry(DebugCommands.NewFunctionBreakpoint)
            {
                DisplayType = CommandEntryDisplayType.IconAndText
            });
            toolbarSet.Add(new CommandEntry(DebugCommands.NewCatchpoint)
            {
                DisplayType = CommandEntryDisplayType.IconAndText
            });

            // The breakpoint list

            store = new TreeStore(typeof(string), typeof(bool), typeof(string), typeof(object), typeof(string), typeof(string), typeof(string), typeof(string));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Icon", "store__Selected", "store_FileName",
                                                                          "store_Breakpoint", "store_Condition", "store_TraceExp", "store_HitCount", "store_LastTrace");

            TypeDescriptor.AddAttributes(store, modelAttr);

            tree                = new PadTreeView();
            tree.Model          = store;
            tree.RulesHint      = true;
            tree.HeadersVisible = true;
            tree.DoPopupMenu    = ShowPopup;
            tree.KeyPressEvent += OnKeyPressEvent;
            tree.Selection.Mode = SelectionMode.Multiple;

            treeState = new TreeViewState(tree, (int)Columns.Breakpoint);

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

            col.PackStart(crp, false);
            col.AddAttribute(crp, "stock_id", (int)Columns.Icon);
            tree.AppendColumn(col);

            Gtk.CellRendererToggle toggleRender = new Gtk.CellRendererToggle();
            toggleRender.Toggled += new ToggledHandler(ItemToggled);
            col = new TreeViewColumn();
            col.PackStart(toggleRender, false);
            col.AddAttribute(toggleRender, "active", (int)Columns.Selected);
            tree.AppendColumn(col);

            TreeViewColumn FrameCol = new TreeViewColumn();
            CellRenderer   crt      = tree.TextRenderer;

            FrameCol.Title = GettextCatalog.GetString("Name");
            FrameCol.PackStart(crt, true);
            FrameCol.AddAttribute(crt, "text", (int)Columns.FileName);
            FrameCol.Resizable = true;
            FrameCol.Alignment = 0.0f;
            tree.AppendColumn(FrameCol);

            col           = tree.AppendColumn(GettextCatalog.GetString("Condition"), crt, "text", (int)Columns.Condition);
            col.Resizable = true;

            col           = tree.AppendColumn(GettextCatalog.GetString("Trace Expression"), crt, "text", (int)Columns.TraceExp);
            col.Resizable = true;

            col           = tree.AppendColumn(GettextCatalog.GetString("Hit Count"), crt, "text", (int)Columns.HitCount);
            col.Resizable = true;

            col           = tree.AppendColumn(GettextCatalog.GetString("Last Trace"), crt, "text", (int)Columns.LastTrace);
            col.Resizable = true;

            sw            = new Gtk.ScrolledWindow();
            sw.ShadowType = ShadowType.None;
            sw.Add(tree);

            control = sw;

            control.ShowAll();

            breakpoints = DebuggingService.Breakpoints;

            UpdateDisplay();

            breakpoints.BreakpointAdded   += OnBreakpointAdded;
            breakpoints.BreakpointRemoved += OnBreakpointRemoved;
            breakpoints.Changed           += OnBreakpointChanged;
            breakpoints.BreakpointUpdated += OnBreakpointUpdated;

            DebuggingService.PausedEvent  += OnDebuggerStatusCheck;
            DebuggingService.ResumedEvent += OnDebuggerStatusCheck;
            DebuggingService.StoppedEvent += OnDebuggerStatusCheck;

            tree.RowActivated += OnRowActivated;

            DockItemToolbar toolbar = window.GetToolbar(DockPositionType.Top);

            toolbar.Add(toolbarSet, sw);
            toolbar.ShowAll();
        }
 internal static void Register()
 => TypeDescriptor.AddAttributes(typeof(PathString), new TypeConverterAttribute(typeof(PathStringConverter)));
示例#11
0
        public StackTracePadWidget()
        {
            this.ShadowType = ShadowType.None;

            store = new ListStore(typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Pango.Style), typeof(object), typeof(int), typeof(bool));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__Icon", "store__Method", "store_File",
                                                                          "store_Lang", "store_Addr", "store_Foreground", "store_Style", "store_Frame", "store_FrameIndex");

            TypeDescriptor.AddAttributes(store, modelAttr);

            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.DoPopupMenu     = ShowPopup;

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

            col.PackStart(crp, false);
            crp.Image = pointerImage;
            col.AddAttribute(crp, "visible", IconColumn);
            tree.AppendColumn(col);

            col       = new TreeViewColumn();
            col.Title = GettextCatalog.GetString("Name");
            col.PackStart(tree.TextRenderer, true);
            col.AddAttribute(tree.TextRenderer, "text", MethodColumn);
            col.AddAttribute(tree.TextRenderer, "foreground", ForegroundColumn);
            col.AddAttribute(tree.TextRenderer, "style", StyleColumn);
            col.Resizable = true;
            col.Alignment = 0.0f;
            tree.AppendColumn(col);

            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);
            col.Visible = false;            //By default Language column is hidden
            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);
            col.Visible = false;            //By default Address column is hidden
            tree.AppendColumn(col);

            Add(tree);

            LoadColumnsVisibility();

            ShowAll();
            UpdateDisplay();

            DebuggingService.CallStackChanged    += OnClassStackChanged;
            DebuggingService.CurrentFrameChanged += OnFrameChanged;
            DebuggingService.StoppedEvent        += OnDebuggingServiceStopped;

            tree.RowActivated += OnRowActivated;
        }