jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: svn commit: r1815703 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/gui/util/ src/core/org/apache/jmeter/resources/ xdocs/
Date Sun, 19 Nov 2017 10:11:08 GMT
Am 18.11.2017 um 23:45 schrieb agomes@apache.org:
> Author: agomes
> Date: Sat Nov 18 22:45:15 2017
> New Revision: 1815703
>
> URL: http://svn.apache.org/viewvc?rev=1815703&view=rev
> Log:
> Bug 61785 - Group nighty builds and create an issue menu in a useful links menu
>
> Added:
>      jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java
> Removed:
>      jmeter/trunk/src/core/org/apache/jmeter/gui/action/LinkBugTracker.java
>      jmeter/trunk/src/core/org/apache/jmeter/gui/action/LinkNightlyBuild.java
> Modified:
>      jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
>      jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
>      jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
>      jmeter/trunk/xdocs/changes.xml
>
> Added: jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java?rev=1815703&view=auto
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java (added)
> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/OpenLinkAction.java Sat Nov 18
22:45:15 2017
> @@ -0,0 +1,52 @@
> +package org.apache.jmeter.gui.action;
> +
> +import java.awt.event.ActionEvent;
> +import java.io.IOException;
> +import java.util.HashSet;
> +import java.util.Set;
> +
> +import org.slf4j.Logger;
> +import org.slf4j.LoggerFactory;
> +
> +public class OpenLinkAction extends AbstractAction {
> +
> +    private static final Logger log = LoggerFactory.getLogger(OpenLinkAction.class);
> +
> +    private static final Set<String> commands = new HashSet<>();
> +
> +    static {
> +        commands.add(ActionNames.LINK_BUG_TRACKER);
> +        commands.add(ActionNames.LINK_NIGHTLY_BUILD);
> +    }
> +
> +
> +    /**
> +     * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
> +     */
> +    @Override
> +    public void doAction(ActionEvent e) {
> +        String url = null;
> +        if (e.getActionCommand().equals(ActionNames.LINK_BUG_TRACKER)) {
> +            url = "https://jmeter.apache.org/issues.html";
Should we hardcode URLs in the source code?
> +        } else if (e.getActionCommand().equals(ActionNames.LINK_NIGHTLY_BUILD)) {
> +            url = "https://jmeter.apache.org/nightly.html";
> +        }
What happens, when url is still null? Should we still try to open a browser?
> +        try {
> +            java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
> +        } catch (IOException err) {
> +            log.error("OpenLinkAction: User default browser is not found, or it fails
to be launched, or the default handler application failed to be launched on {}", err);
> +        } catch (UnsupportedOperationException err) {
> +            log.error("OpenLinkAction: Current platform does not support the Desktop.Action.BROWSE
actionon {}", err);
> +        } catch (SecurityException err) {
> +            log.error("OpenLinkAction: Security problem on {}", err);
> +        } catch (Exception err) {
> +            log.error("OpenLinkAction on {}", err);
> +        }
> +    }
> +
> +    @Override
> +    public Set<String> getActionNames() {
> +        return commands;
> +    }
> +
> +}
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java?rev=1815703&r1=1815702&r2=1815703&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java Sat Nov 18 22:45:15
2017
> @@ -302,9 +302,18 @@ public class JMeterMenuBar extends JMenu
>   
>           JMenuItem threadDump = makeMenuItemRes("thread_dump", ActionNames.THREAD_DUMP);//$NON-NLS-1$
>           
> -        JMenuItem linkBugTracker = makeMenuItemRes("link_bug_tracker", ActionNames.LINK_BUG_TRACKER);//$NON-NLS-1$
> -
> -        JMenuItem linkNightlyBuild = makeMenuItemRes("link_nightly_build", ActionNames.LINK_NIGHTLY_BUILD);//$NON-NLS-1$
> +        JMenu usefulLinks = makeMenuRes("useful_links");//$NON-NLS-1$
> +        JMenuItem menuItem;
> +        menuItem = new JMenuItem(JMeterUtils.getLocaleString("link_bug_tracker"));
> +        menuItem.addActionListener(ActionRouter.getInstance());
> +        menuItem.setActionCommand(ActionNames.LINK_BUG_TRACKER);
> +        menuItem.setName("link_bug_tracker");
I would have extracted the creation if the JMenuItem into a private 
method, as the same code fragment is used below with two different 
parameters: "link_nightly_build" and ActionNames.LINK_NIGHTLY_BUILD.

Oh, there is one already: makeMenuItemRes (used below) does exactly that.

Regards,
  Felix

> +        usefulLinks.add(menuItem);
> +        menuItem = new JMenuItem(JMeterUtils.getLocaleString("link_nightly_build"));
> +        menuItem.addActionListener(ActionRouter.getInstance());
> +        menuItem.setActionCommand(ActionNames.LINK_NIGHTLY_BUILD);
> +        menuItem.setName("link_nightly_build");
> +        usefulLinks.add(menuItem);
>   
>           helpAbout = makeMenuItemRes("about", 'A', ActionNames.ABOUT); //$NON-NLS-1$
>   
> @@ -319,8 +328,7 @@ public class JMeterMenuBar extends JMenu
>           addPluginsMenuItems(helpMenu, menuCreators, MENU_LOCATION.HELP);
>           
>           helpMenu.addSeparator();
> -        helpMenu.add(linkBugTracker);
> -        helpMenu.add(linkNightlyBuild);
> +        helpMenu.add(usefulLinks);
>           helpMenu.addSeparator();
>           helpMenu.add(helpAbout);
>       }
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1815703&r1=1815702&r2=1815703&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Sat Nov 18
22:45:15 2017
> @@ -1256,6 +1256,7 @@ use_multipart_for_http_post=Use multipar
>   use_multipart_mode_browser=Browser-compatible headers
>   use_recording_controller=Use Recording Controller
>   use_system_dns_resolver=Use system DNS resolver
> +useful_links=Useful links
>   user=User
>   user_defined_test=User Defined Test
>   user_defined_variables=User Defined Variables
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1815703&r1=1815702&r2=1815703&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties Sat Nov
18 22:45:15 2017
> @@ -1246,6 +1246,7 @@ use_multipart_for_http_post=Multipart/fo
>   use_multipart_mode_browser=Ent\u00EAtes compat. navigateur
>   use_recording_controller=Utiliser un contr\u00F4leur enregistreur
>   use_system_dns_resolver=Utiliser le r\u00E9solveur DNS syst\u00E8me (JVM)
> +useful_links=Liens utiles
>   user=Utilisateur
>   user_defined_test=Test d\u00E9fini par l'utilisateur
>   user_defined_variables=Variables pr\u00E9-d\u00E9finies
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1815703&r1=1815702&r2=1815703&view=diff
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Nov 18 22:45:15 2017
> @@ -168,6 +168,7 @@ Summary
>       <li><bug>61640</bug>JSR223 Test Elements : Enable by default
caching. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
>       <li><bug>61774</bug>Add a link to help menu to create an issue
(it open the browser with the link to issues)</li>
>       <li><bug>61775</bug>Add a link to help menu to download nighty
builds (it open the browser with the correct link)</li>
> +    <li><bug>61785</bug>Group "nighty builds" and "create an issue"
menu in a "useful links" menu</li>
>   </ul>
>   
>   <ch_section>Non-functional changes</ch_section>
>
>


Mime
View raw message