diff --git a/README.md b/README.md index 862217fd..5b4ab78a 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,5 @@ http://codemetropolis.github.io/CodeMetropolis/ 1. navigate to `sources` folder 1. `mvn clean package` 1. The current distribution will be aviable under `source/distro`. + +## Demo \ No newline at end of file diff --git a/sources/gui/src/main/java/codemetropolis/toolchain/gui/metricgenerators/SourceMeterGenerator.java b/sources/gui/src/main/java/codemetropolis/toolchain/gui/metricgenerators/SourceMeterGenerator.java index 29501635..bedb32a0 100644 --- a/sources/gui/src/main/java/codemetropolis/toolchain/gui/metricgenerators/SourceMeterGenerator.java +++ b/sources/gui/src/main/java/codemetropolis/toolchain/gui/metricgenerators/SourceMeterGenerator.java @@ -1,8 +1,8 @@ package codemetropolis.toolchain.gui.metricgenerators; - +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.File; import java.util.Map; - import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; @@ -42,6 +42,8 @@ public SourceMeterGenerator() { addProjectRootField(); addSourceMeterExecutableField(); + addSourceMeterDownloadButton(); + } /** @@ -66,10 +68,31 @@ public void addSourceMeterExecutableField() { sourceMeterPath = new CMTextField(130, 40, 225, 30); CMButton browseButton = new CMButton(Translations.t("gui_b_browse"), 360, 40, 100, 30); browseButton.addActionListener(new BrowseListener(sourceMeterPath, JFileChooser.FILES_ONLY, EXE_FILTER)); - + add(label); add(sourceMeterPath); add(browseButton); + + } + + /*** + * Adds the Download SourceMeter button to the panel which opens the user default browser. + * @author Taskovics Lorinc Karoly {@literal } + */ + public void addSourceMeterDownloadButton() { + CMButton downloadSrcM = new CMButton("Download SourceMeter", 30, 100, 300, 30); + downloadSrcM.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + try { + String url = "https://sourcemeter.com/download"; + java.awt.Desktop.getDesktop().browse(java.net.URI.create(url)); + } catch (java.io.IOException exp) { + System.out.println(exp.getMessage()); + } + } + }); + add(downloadSrcM); } /**