/// <summary>
        /// Duplicate the build tool collection.
        /// </summary>
        /// <returns></returns>
        public BuildToolCollection Clone()
        {
            BuildToolCollection collection = new BuildToolCollection();

            Dictionary <String, BuildTool> tools =
                new Dictionary <String, BuildTool>();

            foreach (string key in _tools.Keys)
            {
                tools[key] = _tools[key].Clone();
            }

            Dictionary <String, DocumentTypeAction> selectedTools =
                new Dictionary <String, DocumentTypeAction>();

            foreach (string key in _selectedTools.Keys)
            {
                selectedTools[key] = _selectedTools[key].Clone();
            }

            collection.Tools         = tools;
            collection.SelectedTools = selectedTools;

            return(collection);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new instance of the form. The form is responsible for retrieving and updating
        /// the tool definition in the build tool collection.
        /// </summary>
        /// <param name="buildTools">The collection of build tools registered with the build system.</param>
        /// <param name="toolId">The build tool to be configured.</param>
        public BuildToolForm(BuildToolCollection buildTools, string toolId)
        {
            InitializeComponent();

            _buildToolManager = BuildToolManager.GetInstance();
            _buildTools       = buildTools;
            _toolId           = toolId;

            List <String> documentTypes =
                _buildToolManager.GetAvailableDocumentTypes();

            if (documentTypes.Count == 0)
            {
                DisableForm();
            }
            else
            {
                foreach (string documentType in documentTypes)
                {
                    _documentTypeComboBox.Items.Add(documentType);
                }

                LoadTool();
            }

            /*
             * Allow client applications to modify the form.
             */

            BuildToolFormProxy.GetInstance().
            UpdateFormControls(Controls);
        }
Esempio n. 3
0
        private BuildToolManager()
        {
            _buildTools = new BuildToolCollection();

            _pinnedFiles = new PinnedFilesCollection();

            _applicationManager = ApplicationManager.GetInstance();

            _persistenceManager = _applicationManager.
                                  GetPersistenceManager(Constants.PLUGIN_NAME);

            _buildCommandHandlers =
                new List <BuildCommandDelegateListItem>();

            _lineParsers =
                new Dictionary <String, OutputLineParserListItem>();
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new instance of the options page.
        /// </summary>
        public BuildToolOptionsPage()
        {
            _buildToolManager = BuildToolManager.GetInstance();

            /*
             * Copy the build tools so we can abandon changes on cancel.
             */

            _buildTools = _buildToolManager.BuildTools.Clone();

            Name      = Constants.UI_OPTIONS_BUILD_TOOLS_PAGE;
            PageText  = Resources.OptionsPageTextTools;
            GroupText = Resources.OptionsGroupText;

            _listView                 = new ListView();
            _typeColumnHeader         = new ColumnHeader();
            _actionColumnHeader       = new ColumnHeader();
            _nameColumnHeader         = new ColumnHeader();
            _listViewContextMenuStrip = new ContextMenuStrip();
            UI_MENU_TOOL_NEW          = new ToolStripMenuItem();
            UI_MENU_TOOL_EDIT         = new ToolStripMenuItem();
            UI_MENU_TOOL_CLONE        = new ToolStripMenuItem();
            UI_MENU_TOOL_DELETE       = new ToolStripMenuItem();

            Controls.Add(this._listView);

            #region Form layout

            _listView.Columns.AddRange(new ColumnHeader[] {
                _typeColumnHeader,
                _actionColumnHeader,
                _nameColumnHeader
            });
            _listView.ContextMenuStrip = _listViewContextMenuStrip;
            _listView.Font             = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            _listView.FullRowSelect    = true;
            _listView.HeaderStyle      = ColumnHeaderStyle.Nonclickable;
            _listView.Location         = new Point(0, 0);
            _listView.MultiSelect      = false;
            _listView.Name             = m_listView;
            _listView.Size             = new Size(430, 250);
            _listView.TabIndex         = 0;
            _listView.UseCompatibleStateImageBehavior = false;
            _listView.View = View.Details;

            _typeColumnHeader.Text  = Resources.ToolColumnType;
            _typeColumnHeader.Name  = m_typeColumnHeader;
            _typeColumnHeader.Width = 45;

            _actionColumnHeader.Text  = Resources.ToolColumnAction;
            _actionColumnHeader.Name  = m_actionColumnHeader;
            _actionColumnHeader.Width = 80;

            _nameColumnHeader.Text  = Resources.ToolColumnName;
            _nameColumnHeader.Name  = m_nameColumnHeader;
            _nameColumnHeader.Width = 280;

            _listViewContextMenuStrip.Items.AddRange(new ToolStripItem[] {
                UI_MENU_TOOL_NEW,
                UI_MENU_TOOL_EDIT,
                UI_MENU_TOOL_CLONE,
                UI_MENU_TOOL_DELETE
            });
            _listViewContextMenuStrip.Name = m_listViewContextMenuStrip;
            _listViewContextMenuStrip.Size = new Size(153, 92);

            UI_MENU_TOOL_NEW.Name = Constants.UI_MENU_TOOL_NEW;
            UI_MENU_TOOL_NEW.Text = Resources.ToolMenuNew;

            UI_MENU_TOOL_EDIT.Name = Constants.UI_MENU_TOOL_EDIT;
            UI_MENU_TOOL_EDIT.Text = Resources.ToolMenuEdit;

            UI_MENU_TOOL_CLONE.Name = Constants.UI_MENU_TOOL_CLONE;
            UI_MENU_TOOL_CLONE.Text = Resources.ToolMenuClone;

            UI_MENU_TOOL_DELETE.Name = Constants.UI_MENU_TOOL_DELETE;
            UI_MENU_TOOL_DELETE.Text = Resources.ToolMenuDelete;

            #endregion

            _listViewContextMenuStrip.Opening += delegate { OpenContextMenu(); };
            UI_MENU_TOOL_NEW.Click            += delegate { CreateTool(); };
            UI_MENU_TOOL_EDIT.Click           += delegate { EditTool(); };
            UI_MENU_TOOL_CLONE.Click          += delegate { CloneTool(); };
            UI_MENU_TOOL_DELETE.Click         += delegate { DeleteTool(); };
            _listView.DoubleClick             += delegate { EditTool(); };

            Load();
        }