diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..cf993d6 --- /dev/null +++ b/pom.xml @@ -0,0 +1,44 @@ + + 4.0.0 + + org.openstreetmap.josm.plugins + plugin-root + SNAPSHOT + + PicLayer + + ${plugin.link} + + + Tomasz Stelmach + + + + src + 18494 + Tomasz Stelmach + org.openstreetmap.josm.plugins.piclayer.PicLayerPlugin + This plugin allows to display any picture as a background in the editor and align it with the map. + images/layericon.png + https://josm.openstreetmap.de/wiki/Help/Plugin/PicLayer + true + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + ${plugin.link} + ${plugin.icon} + ${plugin.canloadatruntime} + + + + + + + diff --git a/src/org/openstreetmap/josm/plugins/piclayer/gui/autocalibrate/SelectLayerView.java b/src/org/openstreetmap/josm/plugins/piclayer/gui/autocalibrate/SelectLayerView.java index d0c8096..92f81f6 100644 --- a/src/org/openstreetmap/josm/plugins/piclayer/gui/autocalibrate/SelectLayerView.java +++ b/src/org/openstreetmap/josm/plugins/piclayer/gui/autocalibrate/SelectLayerView.java @@ -9,6 +9,7 @@ import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionListener; +import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; @@ -22,7 +23,6 @@ public class SelectLayerView { - private final String[] labels; private final JList list; private final JFrame frame; private JScrollPane scrollPane; @@ -32,9 +32,7 @@ public class SelectLayerView { public SelectLayerView() { - labels = new String[10]; - getLayerNames(); - list = new JList<>(labels); + list = new JList<>(getLayerNames()); frame = new JFrame("Layer Selector"); frame.setSize(400, 200); @@ -51,11 +49,9 @@ public SelectLayerView() { contentPane.add(buttonBar, BorderLayout.SOUTH); } - private void getLayerNames() { - java.util.List layer = MainApplication.getLayerManager().getLayers(); - for (int i = 0; i < layer.size(); i++) { - labels[i] = layer.get(i).getName(); - } + private static String[] getLayerNames() { + return MainApplication.getLayerManager().getLayers().stream() + .map(Layer::getName).toArray(String[]::new); } public void setVisible(boolean value) {