Hi Felix, 2017-11-19 11:11 GMT+01:00 Felix Schumacher < [email protected]>:
> Am 18.11.2017 um 23:45 schrieb [email protected]: > >> >> + >> + /** >> + * @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? I have hardcoded the URLs in source code because it's only 2 URL and there is little chance they will change. I can improve the code to be more generic, but it will complex it and I don't know if it's useless > > + } else if (e.getActionCommand().equals(A >> ctionNames.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? I will modify it by adding a nullcheck > > + 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/JMeterMenuB >> ar.java >> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apach >> e/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.getLocal >> eString("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. > I will check it > > Regards, > Felix > > > + usefulLinks.add(menuItem); >> + menuItem = new JMenuItem(JMeterUtils.getLocal >> eString("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/apach >> e/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/apach >> e/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> >> >> >> >
