Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/10 10:38:19 (14 years ago)
Author:
gkronber
Message:

Implemented changes in plugin infrastructure requested by reviewers. #989 (Implement review comments in plugin infrastructure)

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.Designer.cs

    r3608 r3624  
    116116      this.tabControl.Size = new System.Drawing.Size(598, 392);
    117117      this.tabControl.TabIndex = 16;
     118      this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
    118119      //
    119120      // updateAllPluginsTabPage
     
    213214      this.pluginEditor.PluginManager = null;
    214215      this.pluginEditor.Size = new System.Drawing.Size(578, 354);
     216      this.pluginEditor.StatusView = null;
    215217      this.pluginEditor.TabIndex = 0;
    216218      //
     
    235237      this.productEditor.Name = "productEditor";
    236238      this.productEditor.Size = new System.Drawing.Size(578, 354);
     239      this.productEditor.StatusView = null;
    237240      this.productEditor.TabIndex = 0;
    238241      //
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.cs

    r3612 r3624  
    145145      new ConnectionSetupView().ShowDialog();
    146146    }
     147    private void tabControl_SelectedIndexChanged(object sender, EventArgs e) {
     148      toolStripStatusLabel.Text = string.Empty;
     149    }
    147150    #endregion
    148151
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/LocalPluginsView.Designer.cs

    r3608 r3624  
    4646    private void InitializeComponent() {
    4747      this.components = new System.ComponentModel.Container();
    48       System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Active Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    49       System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Disabled Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    50       this.updateSelectedButton = new System.Windows.Forms.Button();
    51       this.removeButton = new System.Windows.Forms.Button();
     48      System.Windows.Forms.ListViewGroup listViewGroup3 = new System.Windows.Forms.ListViewGroup("Active Plugins", System.Windows.Forms.HorizontalAlignment.Left);
     49      System.Windows.Forms.ListViewGroup listViewGroup4 = new System.Windows.Forms.ListViewGroup("Disabled Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    5250      this.localPluginsListView = new HeuristicLab.PluginInfrastructure.Advanced.MultiSelectListView();
    5351      this.nameHeader = new System.Windows.Forms.ColumnHeader();
    5452      this.versionHeader = new System.Windows.Forms.ColumnHeader();
    5553      this.descriptionHeader = new System.Windows.Forms.ColumnHeader();
     54      this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    5655      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    57       this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
     56      this.refreshButton = new System.Windows.Forms.Button();
     57      this.removeButton = new System.Windows.Forms.Button();
     58      this.updateSelectedButton = new System.Windows.Forms.Button();
    5859      this.SuspendLayout();
    59       //
    60       // updateSelectedButton
    61       //
    62       this.updateSelectedButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    63       this.updateSelectedButton.Enabled = false;
    64       this.updateSelectedButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_Objects_Internet;
    65       this.updateSelectedButton.Location = new System.Drawing.Point(3, 483);
    66       this.updateSelectedButton.Name = "updateSelectedButton";
    67       this.updateSelectedButton.Size = new System.Drawing.Size(114, 25);
    68       this.updateSelectedButton.TabIndex = 6;
    69       this.updateSelectedButton.Text = "Update Selected";
    70       this.updateSelectedButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
    71       this.toolTip.SetToolTip(this.updateSelectedButton, "Update all selected plugins");
    72       this.updateSelectedButton.UseVisualStyleBackColor = true;
    73       this.updateSelectedButton.Click += new System.EventHandler(this.updateSelectedButton_Click);
    74       //
    75       // removeButton
    76       //
    77       this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    78       this.removeButton.Enabled = false;
    79       this.removeButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_CommonElements_Actions_Remove;
    80       this.removeButton.Location = new System.Drawing.Point(123, 483);
    81       this.removeButton.Name = "removeButton";
    82       this.removeButton.Size = new System.Drawing.Size(110, 25);
    83       this.removeButton.TabIndex = 12;
    84       this.removeButton.Text = "Delete Selected";
    85       this.removeButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
    86       this.toolTip.SetToolTip(this.removeButton, "Delete all selected plugins from disk");
    87       this.removeButton.UseVisualStyleBackColor = true;
    88       this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
    8960      //
    9061      // localPluginsListView
     
    9869            this.versionHeader,
    9970            this.descriptionHeader});
    100       listViewGroup1.Header = "Active Plugins";
    101       listViewGroup1.Name = "activePluginsGroup";
    102       listViewGroup2.Header = "Disabled Plugins";
    103       listViewGroup2.Name = "disabledPluginsGroup";
     71      listViewGroup3.Header = "Active Plugins";
     72      listViewGroup3.Name = "activePluginsGroup";
     73      listViewGroup4.Header = "Disabled Plugins";
     74      listViewGroup4.Name = "disabledPluginsGroup";
    10475      this.localPluginsListView.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
    105             listViewGroup1,
    106             listViewGroup2});
     76            listViewGroup3,
     77            listViewGroup4});
    10778      this.localPluginsListView.Location = new System.Drawing.Point(0, 0);
    10879      this.localPluginsListView.Name = "localPluginsListView";
    10980      this.localPluginsListView.Size = new System.Drawing.Size(539, 477);
    11081      this.localPluginsListView.SmallImageList = this.pluginImageList;
     82      this.localPluginsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    11183      this.localPluginsListView.SuppressItemCheckedEvents = false;
    11284      this.localPluginsListView.TabIndex = 13;
     
    137109      this.pluginImageList.TransparentColor = System.Drawing.Color.Transparent;
    138110      //
     111      // refreshButton
     112      //
     113      this.refreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     114      this.refreshButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.RepeatHS1;
     115      this.refreshButton.Location = new System.Drawing.Point(0, 483);
     116      this.refreshButton.Name = "refreshButton";
     117      this.refreshButton.Size = new System.Drawing.Size(96, 25);
     118      this.refreshButton.TabIndex = 14;
     119      this.refreshButton.Text = "Refresh List";
     120      this.refreshButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     121      this.toolTip.SetToolTip(this.refreshButton, "Refresh List of Installed Plugins");
     122      this.refreshButton.UseVisualStyleBackColor = true;
     123      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
     124      //
     125      // removeButton
     126      //
     127      this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     128      this.removeButton.Enabled = false;
     129      this.removeButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_CommonElements_Actions_Remove;
     130      this.removeButton.Location = new System.Drawing.Point(222, 483);
     131      this.removeButton.Name = "removeButton";
     132      this.removeButton.Size = new System.Drawing.Size(110, 25);
     133      this.removeButton.TabIndex = 12;
     134      this.removeButton.Text = "Delete Selected";
     135      this.removeButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     136      this.toolTip.SetToolTip(this.removeButton, "Delete all selected plugins from disk");
     137      this.removeButton.UseVisualStyleBackColor = true;
     138      this.removeButton.Click += new System.EventHandler(this.removeButton_Click);
     139      //
     140      // updateSelectedButton
     141      //
     142      this.updateSelectedButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     143      this.updateSelectedButton.Enabled = false;
     144      this.updateSelectedButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_Objects_Internet;
     145      this.updateSelectedButton.Location = new System.Drawing.Point(102, 483);
     146      this.updateSelectedButton.Name = "updateSelectedButton";
     147      this.updateSelectedButton.Size = new System.Drawing.Size(114, 25);
     148      this.updateSelectedButton.TabIndex = 6;
     149      this.updateSelectedButton.Text = "Update Selected";
     150      this.updateSelectedButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     151      this.toolTip.SetToolTip(this.updateSelectedButton, "Update all selected plugins");
     152      this.updateSelectedButton.UseVisualStyleBackColor = true;
     153      this.updateSelectedButton.Click += new System.EventHandler(this.updateSelectedButton_Click);
     154      //
    139155      // LocalPluginsView
    140156      //
    141157      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    142158      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     159      this.Controls.Add(this.refreshButton);
    143160      this.Controls.Add(this.localPluginsListView);
    144161      this.Controls.Add(this.removeButton);
     
    160177    private System.Windows.Forms.ToolTip toolTip;
    161178    private System.Windows.Forms.ImageList pluginImageList;
     179    private System.Windows.Forms.Button refreshButton;
    162180    // private LocalPluginManagerView localPluginManagerView;
    163181  }
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/LocalPluginsView.cs

    r3608 r3624  
    101101          "There was an error while connecting to the server." + Environment.NewLine +
    102102           "Please check your connection settings and user credentials.");
    103       } else if (e.Cancelled) {
    104         StatusView.ShowMessage(NoUpdatesAvailableMessage);
    105103      }
    106104      StatusView.RemoveMessage(CheckingPluginsMessage);
     
    124122      if (pluginsToUpdate.Count() > 0) {
    125123        installationManager.Update(pluginsToUpdate);
    126         pluginManager.DiscoverAndCheckPlugins();
    127         e.Cancel = false;
    128       } else {
    129         e.Cancel = true;
    130       }
     124      }
     125      pluginManager.DiscoverAndCheckPlugins();
    131126    }
    132127
     
    156151      removeButton.Enabled = localPluginsListView.CheckedItems.Count > 0;
    157152      updateSelectedButton.Enabled = localPluginsListView.CheckedItems.Count > 0;
    158       foreach (ColumnHeader column in localPluginsListView.Columns) {
    159         if (localPluginsListView.Items.Count > 0)
    160           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    161         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    162       }
     153      Util.ResizeColumns(localPluginsListView.Columns.OfType<ColumnHeader>());
    163154    }
    164155
     
    239230      removePluginsBackgroundWorker.RunWorkerAsync(checkedPlugins);
    240231    }
     232
     233    private void refreshButton_Click(object sender, EventArgs e) {
     234      StatusView.LockUI();
     235      StatusView.ShowProgressIndicator();
     236      // refresh = update empty list of plugins (plugins are reloaded)
     237      updatePluginsBackgroundWorker.RunWorkerAsync(new IPluginDescription[0]);
     238    }
    241239  }
    242240}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/LocalPluginsView.resx

    r3608 r3624  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="pluginImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     121    <value>107, 17</value>
     122  </metadata>
    120123  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121124    <value>17, 17</value>
    122125  </metadata>
    123   <metadata name="pluginImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124     <value>107, 17</value>
    125   </metadata>
    126126</root>
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginEditor.Designer.cs

    r3612 r3624  
    6161      this.uploadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    6262      this.uploadButton.Enabled = false;
    63       this.uploadButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_CommonElements_Objects_Arrow_Up;
     63      this.uploadButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.PublishToWebHS;
    6464      this.uploadButton.Location = new System.Drawing.Point(78, 482);
    6565      this.uploadButton.Name = "uploadButton";
     
    101101      this.listView.Size = new System.Drawing.Size(539, 476);
    102102      this.listView.SmallImageList = this.pluginImageList;
     103      this.listView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    103104      this.listView.SuppressItemCheckedEvents = false;
    104105      this.listView.TabIndex = 8;
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginEditor.cs

    r3612 r3624  
    240240        listView.Items.Add(item);
    241241      }
    242       foreach (ColumnHeader column in listView.Columns)
    243         if (listView.Items.Count > 0)
    244           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    245         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     242      Util.ResizeColumns(listView.Columns.OfType<ColumnHeader>());
    246243      ignoreItemCheckedEvents = false;
    247244    }
     
    300297        item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(),
    301298          localAndServerPlugins[plugin].Version.ToString(), localAndServerPlugins[plugin].Description });
     299        if (plugin.Version <= localAndServerPlugins[plugin].Version)
     300          item.ForeColor = Color.Gray;
    302301      } else {
    303302        item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(),
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginView.Designer.cs

    r3573 r3624  
    5757      this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
    5858      this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader();
     59      this.pluginDescriptionHeader = new System.Windows.Forms.ColumnHeader();
    5960      this.pluginsImageList = new System.Windows.Forms.ImageList(this.components);
    6061      this.filesListView = new System.Windows.Forms.ListView();
     
    6970      this.descriptionTextBox = new System.Windows.Forms.TextBox();
    7071      this.errorTextBox = new System.Windows.Forms.TextBox();
    71       this.pluginDescriptionHeader = new System.Windows.Forms.ColumnHeader();
    7272      this.dependenciesGroupBox.SuspendLayout();
    7373      this.filesGroupBox.SuspendLayout();
     
    166166      this.dependenciesListView.Size = new System.Drawing.Size(657, 210);
    167167      this.dependenciesListView.SmallImageList = this.pluginsImageList;
     168      this.dependenciesListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    168169      this.dependenciesListView.TabIndex = 0;
    169170      this.dependenciesListView.UseCompatibleStateImageBehavior = false;
     
    180181      this.pluginVersionHeader.Text = "Version";
    181182      this.pluginVersionHeader.Width = 120;
     183      //
     184      // pluginDescriptionHeader
     185      //
     186      this.pluginDescriptionHeader.Text = "Description";
     187      this.pluginDescriptionHeader.Width = 325;
    182188      //
    183189      // pluginsImageList
     
    271277                  | System.Windows.Forms.AnchorStyles.Right)));
    272278      this.descriptionTextBox.Location = new System.Drawing.Point(78, 90);
     279      this.descriptionTextBox.Multiline = true;
    273280      this.descriptionTextBox.Name = "descriptionTextBox";
    274281      this.descriptionTextBox.ReadOnly = true;
     
    281288                  | System.Windows.Forms.AnchorStyles.Right)));
    282289      this.errorTextBox.Location = new System.Drawing.Point(78, 142);
     290      this.errorTextBox.Multiline = true;
    283291      this.errorTextBox.Name = "errorTextBox";
    284292      this.errorTextBox.ReadOnly = true;
    285293      this.errorTextBox.Size = new System.Drawing.Size(594, 20);
    286294      this.errorTextBox.TabIndex = 21;
    287       //
    288       // pluginDescriptionHeader
    289       //
    290       this.pluginDescriptionHeader.Text = "Description";
    291       this.pluginDescriptionHeader.Width = 325;
    292295      //
    293296      // PluginView
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginView.cs

    r3608 r3624  
    8989        filesListView.Items.Add(fileItem);
    9090      }
    91       foreach (ColumnHeader column in dependenciesListView.Columns) {
    92         if (dependenciesListView.Items.Count > 0)
    93           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    94         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    95       }
    96       foreach (ColumnHeader column in filesListView.Columns) {
    97         if (filesListView.Items.Count > 0)
    98           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    99         else
    100           column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    101       }
     91      Util.ResizeColumns(dependenciesListView.Columns.OfType<ColumnHeader>());
     92      Util.ResizeColumns(filesListView.Columns.OfType<ColumnHeader>());
     93
    10294      licenseButton.Enabled = !string.IsNullOrEmpty(plugin.LicenseText);
    10395    }
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ProductEditor.Designer.cs

    r3612 r3624  
    5959      this.pluginsGroupBox = new System.Windows.Forms.GroupBox();
    6060      this.pluginListView = new HeuristicLab.PluginInfrastructure.Advanced.MultiSelectListView();
     61      this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
     62      this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader();
     63      this.pluginDescriptionHeader = new System.Windows.Forms.ColumnHeader();
    6164      this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    6265      this.versionTextBox = new System.Windows.Forms.TextBox();
     
    6669      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    6770      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    68       this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
    69       this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader();
    70       this.pluginDescriptionHeader = new System.Windows.Forms.ColumnHeader();
    7171      this.splitContainer.Panel1.SuspendLayout();
    7272      this.splitContainer.Panel2.SuspendLayout();
     
    9696      this.uploadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    9797      this.uploadButton.Enabled = false;
    98       this.uploadButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_CommonElements_Objects_Arrow_Up;
     98      this.uploadButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.PublishToWebHS;
    9999      this.uploadButton.Location = new System.Drawing.Point(85, 394);
    100100      this.uploadButton.Name = "uploadButton";
     
    185185      this.productsListView.Size = new System.Drawing.Size(309, 337);
    186186      this.productsListView.SmallImageList = this.productImageList;
     187      this.productsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    187188      this.productsListView.TabIndex = 4;
    188189      this.productsListView.UseCompatibleStateImageBehavior = false;
     
    251252      this.pluginListView.Size = new System.Drawing.Size(322, 330);
    252253      this.pluginListView.SmallImageList = this.pluginImageList;
     254      this.pluginListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    253255      this.pluginListView.SuppressItemCheckedEvents = false;
    254256      this.pluginListView.TabIndex = 7;
    255257      this.pluginListView.UseCompatibleStateImageBehavior = false;
    256258      this.pluginListView.View = System.Windows.Forms.View.Details;
    257       this.pluginListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginListView_ItemChecked);
     259      this.pluginListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked);
     260      //
     261      // pluginNameHeader
     262      //
     263      this.pluginNameHeader.Text = "Name";
     264      //
     265      // pluginVersionHeader
     266      //
     267      this.pluginVersionHeader.Text = "Version";
     268      //
     269      // pluginDescriptionHeader
     270      //
     271      this.pluginDescriptionHeader.Text = "Description";
    258272      //
    259273      // pluginImageList
     
    304318      //
    305319      this.errorProvider.ContainerControl = this;
    306       //
    307       // pluginNameHeader
    308       //
    309       this.pluginNameHeader.Text = "Name";
    310       //
    311       // pluginVersionHeader
    312       //
    313       this.pluginVersionHeader.Text = "Version";
    314       //
    315       // pluginDescriptionHeader
    316       //
    317       this.pluginDescriptionHeader.Text = "Description";
    318320      //
    319321      // ProductEditor
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ProductEditor.cs

    r3612 r3624  
    114114        "There was an error while connecting to the server." + Environment.NewLine +
    115115           "Please check your connection settings and user credentials.");
    116         DisableControls();
     116        this.products.Clear();
     117        this.plugins.Clear();
    117118      } else {
    118119        this.products = new List<DeploymentService.ProductDescription>(
     
    121122          (DeploymentService.PluginDescription[])((object[])e.Result)[1]);
    122123
    123         UpdateProductsList();
    124         dirtyProducts.Clear();
    125124        EnableControls();
    126125      }
     126      UpdateProductsList();
     127      dirtyProducts.Clear();
    127128      StatusView.HideProgressIndicator();
    128129      StatusView.RemoveMessage(DeleteProductMessage);
     
    179180        "There was an error while connecting to the server." + Environment.NewLine +
    180181           "Please check your connection settings and user credentials.");
    181         DisableControls();
     182        this.products.Clear();
     183        this.plugins.Clear();
    182184      } else {
    183185        this.products = new List<DeploymentService.ProductDescription>(
     
    186188          (DeploymentService.PluginDescription[])((object[])e.Result)[1]);
    187189
    188         UpdateProductsList();
    189         dirtyProducts.Clear();
    190         EnableControls();
    191       }
     190      }
     191      UpdateProductsList();
     192      dirtyProducts.Clear();
     193      EnableControls();
    192194      StatusView.HideProgressIndicator();
    193195      StatusView.RemoveMessage(UploadMessage);
     
    222224          "There was an error while connecting to the server." + Environment.NewLine +
    223225                   "Please check your connection settings and user credentials.");
    224         DisableControls();
     226        this.products.Clear();
     227        this.plugins.Clear();
     228
    225229      } else {
    226230        this.products = new List<DeploymentService.ProductDescription>(
     
    228232        this.plugins = new List<DeploymentService.PluginDescription>(
    229233          (DeploymentService.PluginDescription[])((object[])e.Result)[1]);
    230 
    231 
    232         UpdateProductsList();
    233         dirtyProducts.Clear();
    234         EnableControls();
    235       }
     234      }
     235      UpdateProductsList();
     236      dirtyProducts.Clear();
     237      EnableControls();
    236238      StatusView.HideProgressIndicator();
    237239      StatusView.RemoveMessage(RefreshMessage);
     
    241243
    242244    private void UpdateProductsList() {
     245      productsListView.SelectedItems.Clear();
    243246      productsListView.Items.Clear();
    244247      foreach (var prodDesc in products) {
    245248        productsListView.Items.Add(CreateListViewItem(prodDesc));
    246249      }
    247       foreach (ColumnHeader column in productsListView.Columns)
    248         if (productsListView.Items.Count > 0)
    249           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    250         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     250      Util.ResizeColumns(productsListView.Columns.OfType<ColumnHeader>());
    251251    }
    252252
     
    254254      bool productSelected = productsListView.SelectedItems.Count > 0;
    255255      detailsGroupBox.Enabled = productSelected;
    256       deleteProductButton.Enabled = productSelected;
    257       uploadButton.Enabled = dirtyProducts.Count > 0;
     256      UpdateProductButtons();
    258257      if (productSelected) {
    259258        DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)((ListViewItem)productsListView.SelectedItems[0]).Tag;
     
    263262        // populate plugins list view
    264263        ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
     264        pluginListView.SuppressItemCheckedEvents = true;
    265265        foreach (var plugin in plugins.OfType<IPluginDescription>()) {
    266266          pluginListView.Items.Add(CreateListViewItem(plugin));
    267267        }
    268 
    269         pluginListView.CheckItems(from plugin in activeProduct.Plugins
    270                                   let item = FindItemForPlugin(plugin)
    271                                   where item != null
    272                                   select item);
    273 
     268        pluginListView.SuppressItemCheckedEvents = false;
     269        foreach (var plugin in activeProduct.Plugins) {
     270          pluginListView.CheckItems(FindItemsForPlugin(plugin));
     271        }
    274272      } else {
    275273        nameTextBox.Text = string.Empty;
     
    277275        pluginListView.Items.Clear();
    278276      }
     277      Util.ResizeColumns(pluginListView.Columns.OfType<ColumnHeader>());
     278    }
     279
     280    private void UpdateProductButtons() {
     281      uploadButton.Enabled = dirtyProducts.Count > 0;
     282      if (productsListView.SelectedItems.Count > 0) {
     283        var selectedProduct = (DeploymentService.ProductDescription)productsListView.SelectedItems[0].Tag;
     284        deleteProductButton.Enabled = !dirtyProducts.Contains(selectedProduct);
     285      } else {
     286        deleteProductButton.Enabled = false;
     287      }
    279288    }
    280289
     
    283292    private void newProductButton_Click(object sender, EventArgs e) {
    284293      var newProduct = new DeploymentService.ProductDescription("New product", new Version("0.0.0.0"));
    285       ListViewItem item = CreateListViewItem(newProduct);
    286       productsListView.Items.Add(item);
     294      products.Add(newProduct);
     295      UpdateProductsList();
    287296      MarkProductDirty(newProduct);
    288297    }
     
    359368
    360369    #region plugin list view
    361     private void pluginListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     370    private void OnItemChecked(ItemCheckedEventArgs e) {
    362371      ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    363372      DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
     
    366375      MarkProductDirty(activeProduct);
    367376    }
     377
     378    private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     379      List<IPluginDescription> modifiedPlugins = new List<IPluginDescription>();
     380      if (e.Item.Checked) {
     381        foreach (ListViewItem item in pluginListView.SelectedItems) {
     382          var plugin = (IPluginDescription)item.Tag;
     383          // also check all dependencies
     384          if (!modifiedPlugins.Contains(plugin))
     385            modifiedPlugins.Add(plugin);
     386          foreach (var dep in GetAllDependencies(plugin)) {
     387            if (!modifiedPlugins.Contains(dep))
     388              modifiedPlugins.Add(dep);
     389          }
     390        }
     391        pluginListView.CheckItems(modifiedPlugins.Select(x => FindItemsForPlugin(x).Single()));
     392        OnItemChecked(e);
     393      } else {
     394        foreach (ListViewItem item in pluginListView.SelectedItems) {
     395          var plugin = (IPluginDescription)item.Tag;
     396          // also uncheck all dependent plugins
     397          if (!modifiedPlugins.Contains(plugin))
     398            modifiedPlugins.Add(plugin);
     399          foreach (var dep in GetAllDependents(plugin)) {
     400            if (!modifiedPlugins.Contains(dep))
     401              modifiedPlugins.Add(dep);
     402          }
     403
     404        }
     405        pluginListView.UncheckItems(modifiedPlugins.Select(x => FindItemsForPlugin(x).Single()));
     406        OnItemChecked(e);
     407      }
     408    }
     409
     410
    368411    #endregion
    369412
    370413    #region helper
     414    private IEnumerable<IPluginDescription> GetAllDependents(IPluginDescription plugin) {
     415      return from p in plugins
     416             let matchingEntries = from dep in GetAllDependencies(p)
     417                                   where dep.Name == plugin.Name
     418                                   where dep.Version == plugin.Version
     419                                   select dep
     420             where matchingEntries.Any()
     421             select p as IPluginDescription;
     422    }
     423
     424    private IEnumerable<IPluginDescription> GetAllDependencies(IPluginDescription plugin) {
     425      HashSet<IPluginDescription> yieldedPlugins = new HashSet<IPluginDescription>();
     426      foreach (var dep in plugin.Dependencies) {
     427        foreach (var recDep in GetAllDependencies(dep)) {
     428          if (!yieldedPlugins.Contains(recDep)) {
     429            yieldedPlugins.Add(recDep);
     430            yield return recDep;
     431          }
     432        }
     433        if (!yieldedPlugins.Contains(dep)) {
     434          yieldedPlugins.Add(dep);
     435          yield return dep;
     436        }
     437      }
     438    }
    371439    private void MarkProductDirty(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) {
    372440      if (!dirtyProducts.Contains(activeProduct)) {
     
    374442        var item = FindItemForProduct(activeProduct);
    375443        item.ImageIndex = 1;
     444        UpdateProductButtons();
    376445      }
    377446    }
     
    399468              select item).Single();
    400469    }
    401 
    402     private ListViewItem FindItemForPlugin(IPluginDescription plugin) {
    403       return (from i in pluginListView.Items.Cast<ListViewItem>()
    404               let p = i.Tag as IPluginDescription
    405               where p != null
    406               where p.Name == plugin.Name
    407               where p.Version == plugin.Version
    408               select i).SingleOrDefault();
    409     }
    410 
    411     private void DisableControls() {
    412       newProductButton.Enabled = false;
    413       productsListView.Enabled = false;
    414       detailsGroupBox.Enabled = false;
    415       deleteProductButton.Enabled = false;
    416       nameTextBox.Text = string.Empty;
    417       versionTextBox.Text = string.Empty;
    418       pluginListView.Items.Clear();
    419     }
     470    private IEnumerable<ListViewItem> FindItemsForPlugin(IPluginDescription plugin) {
     471      return from item in pluginListView.Items.OfType<ListViewItem>()
     472             let p = item.Tag as IPluginDescription
     473             where p.Name == plugin.Name
     474             where p.Version == plugin.Version
     475             select item;
     476    }
     477
    420478    private void EnableControls() {
    421479      newProductButton.Enabled = true;
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.Designer.cs

    r3612 r3624  
    5656      this.productImageList = new System.Windows.Forms.ImageList(this.components);
    5757      this.productsGroupBox = new System.Windows.Forms.GroupBox();
    58       this.pluginsGroupBox = new System.Windows.Forms.GroupBox();
    59       this.splitContainer = new System.Windows.Forms.SplitContainer();
    60       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    6158      this.showDetailsButton = new System.Windows.Forms.RadioButton();
    6259      this.showLargeIconsButton = new System.Windows.Forms.RadioButton();
    6360      this.installProductsButton = new System.Windows.Forms.Button();
    6461      this.refreshButton = new System.Windows.Forms.Button();
     62      this.pluginsGroupBox = new System.Windows.Forms.GroupBox();
    6563      this.installPluginsButton = new System.Windows.Forms.Button();
     64      this.splitContainer = new System.Windows.Forms.SplitContainer();
     65      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    6666      this.productsGroupBox.SuspendLayout();
    6767      this.pluginsGroupBox.SuspendLayout();
     
    8686      this.pluginsListView.Size = new System.Drawing.Size(266, 502);
    8787      this.pluginsListView.SmallImageList = this.pluginsImageList;
     88      this.pluginsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    8889      this.pluginsListView.SuppressItemCheckedEvents = false;
    8990      this.pluginsListView.TabIndex = 0;
     
    129130      this.productsListView.Size = new System.Drawing.Size(240, 471);
    130131      this.productsListView.SmallImageList = this.productImageList;
     132      this.productsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
    131133      this.productsListView.TabIndex = 18;
    132134      this.productsListView.UseCompatibleStateImageBehavior = false;
     
    170172      this.productsGroupBox.TabStop = false;
    171173      this.productsGroupBox.Text = "Products";
    172       //
    173       // pluginsGroupBox
    174       //
    175       this.pluginsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    176                   | System.Windows.Forms.AnchorStyles.Left)
    177                   | System.Windows.Forms.AnchorStyles.Right)));
    178       this.pluginsGroupBox.Controls.Add(this.pluginsListView);
    179       this.pluginsGroupBox.Controls.Add(this.installPluginsButton);
    180       this.pluginsGroupBox.Location = new System.Drawing.Point(-1, 0);
    181       this.pluginsGroupBox.Name = "pluginsGroupBox";
    182       this.pluginsGroupBox.Size = new System.Drawing.Size(278, 558);
    183       this.pluginsGroupBox.TabIndex = 20;
    184       this.pluginsGroupBox.TabStop = false;
    185       this.pluginsGroupBox.Text = "Plugins";
    186       //
    187       // splitContainer
    188       //
    189       this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    190                   | System.Windows.Forms.AnchorStyles.Left)
    191                   | System.Windows.Forms.AnchorStyles.Right)));
    192       this.splitContainer.Location = new System.Drawing.Point(0, 0);
    193       this.splitContainer.Name = "splitContainer";
    194       //
    195       // splitContainer.Panel1
    196       //
    197       this.splitContainer.Panel1.Controls.Add(this.productsGroupBox);
    198       //
    199       // splitContainer.Panel2
    200       //
    201       this.splitContainer.Panel2.Controls.Add(this.pluginsGroupBox);
    202       this.splitContainer.Size = new System.Drawing.Size(533, 558);
    203       this.splitContainer.SplitterDistance = 252;
    204       this.splitContainer.TabIndex = 21;
    205174      //
    206175      // showDetailsButton
     
    260229      this.refreshButton.Click += new System.EventHandler(this.refreshRemoteButton_Click);
    261230      //
     231      // pluginsGroupBox
     232      //
     233      this.pluginsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     234                  | System.Windows.Forms.AnchorStyles.Left)
     235                  | System.Windows.Forms.AnchorStyles.Right)));
     236      this.pluginsGroupBox.Controls.Add(this.pluginsListView);
     237      this.pluginsGroupBox.Controls.Add(this.installPluginsButton);
     238      this.pluginsGroupBox.Location = new System.Drawing.Point(-1, 0);
     239      this.pluginsGroupBox.Name = "pluginsGroupBox";
     240      this.pluginsGroupBox.Size = new System.Drawing.Size(278, 558);
     241      this.pluginsGroupBox.TabIndex = 20;
     242      this.pluginsGroupBox.TabStop = false;
     243      this.pluginsGroupBox.Text = "Plugins";
     244      //
    262245      // installPluginsButton
    263246      //
     
    274257      this.installPluginsButton.UseVisualStyleBackColor = true;
    275258      this.installPluginsButton.Click += new System.EventHandler(this.installPluginsButton_Click);
     259      //
     260      // splitContainer
     261      //
     262      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     263                  | System.Windows.Forms.AnchorStyles.Left)
     264                  | System.Windows.Forms.AnchorStyles.Right)));
     265      this.splitContainer.Location = new System.Drawing.Point(0, 0);
     266      this.splitContainer.Name = "splitContainer";
     267      //
     268      // splitContainer.Panel1
     269      //
     270      this.splitContainer.Panel1.Controls.Add(this.productsGroupBox);
     271      //
     272      // splitContainer.Panel2
     273      //
     274      this.splitContainer.Panel2.Controls.Add(this.pluginsGroupBox);
     275      this.splitContainer.Size = new System.Drawing.Size(533, 558);
     276      this.splitContainer.SplitterDistance = 252;
     277      this.splitContainer.TabIndex = 21;
    276278      //
    277279      // RemotePluginInstallerView
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.cs

    r3608 r3624  
    208208      allPluginsListViewItem.ImageIndex = 0;
    209209      productsListView.Items.Add(allPluginsListViewItem);
    210       foreach (ColumnHeader column in productsListView.Columns)
    211         if (productsListView.Items.Count > 0)
    212           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    213         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     210      Util.ResizeColumns(productsListView.Columns.OfType<ColumnHeader>());
    214211    }
    215212
     
    237234        }
    238235
    239         foreach (ColumnHeader column in pluginsListView.Columns)
    240           if (pluginsListView.Items.Count > 0)
    241             column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    242           else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    243 
     236        Util.ResizeColumns(pluginsListView.Columns.OfType<ColumnHeader>());
    244237        pluginsListView.SuppressItemCheckedEvents = false;
    245238      }
Note: See TracChangeset for help on using the changeset viewer.