jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From FSchumacher <...@git.apache.org>
Subject [GitHub] jmeter pull request #432: Bug 62870 / Templates : Add ability to provide par...
Date Tue, 20 Nov 2018 19:04:23 GMT
Github user FSchumacher commented on a diff in the pull request:

    https://github.com/apache/jmeter/pull/432#discussion_r235121173
  
    --- Diff: src/core/org/apache/jmeter/gui/action/SelectTemplatesDialog.java ---
    @@ -207,19 +290,35 @@ private void init() { // WARNING: called from ctor so must not be
overridden (i.
         public void actionPerformed(ActionEvent e) {
             final Object source = e.getSource();
             if (source == cancelButton) {
    -            this.setVisible(false);
    -            return;
    +            resetJDialog();
    +            this.dispose();
             } else if (source == applyTemplateButton) {
    -            checkDirtyAndLoad(e);            
    -        } else if (source == reloadTemplateButton) {
    -            templateList.setValues(TemplateManager.getInstance().reset().getTemplateNames());
    +            String selectedTemplate = templateList.getText();
    +            Template template = TemplateManager.getInstance().getTemplateByName(selectedTemplate);
    +            if(template.getParameters() != null && !template.getParameters().isEmpty())
{
    --- End diff --
    
    I find negations harder to read. I would prefer to use `params == null || params.isEmpty()`
and inverse the code blocks and/or introduce a private method `isEmpty(template.getParameters)`.


---

Mime
View raw message