Changeset 35262 in osm for applications/editors/josm/plugins/surveyor/src/org
- Timestamp:
- 2019-12-28T15:13:36+01:00 (5 years ago)
- Location:
- applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/ButtonDescription.java
r35252 r35262 175 175 String actionName = tr(getLabel()) + " (" + hotkey + ")"; 176 176 177 Icon icon = ImageProvider.getIfAvailable(iconName); 178 if (icon == null) 179 icon = ImageProvider.getIfAvailable("markers", iconName); 180 if (icon == null) 181 icon = ImageProvider.getIfAvailable("symbols", iconName); 182 if (icon == null) 183 icon = ImageProvider.getIfAvailable("nodes", iconName); 177 Icon icon = null; 178 if (iconName != null) { 179 icon = ImageProvider.getIfAvailable(iconName); 180 if (icon == null) 181 icon = ImageProvider.getIfAvailable("markers", iconName); 182 if (icon == null) 183 icon = ImageProvider.getIfAvailable("symbols", iconName); 184 if (icon == null) 185 icon = ImageProvider.getIfAvailable("nodes", iconName); 186 } 184 187 185 188 MetaAction action = new MetaAction(actionName, icon); -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorComponent.java
r34591 r35262 64 64 */ 65 65 public void setColumns(String columnsString) { 66 System.out.println("setting columns to " +columnsString);67 66 columns = Integer.parseInt(columnsString); 68 67 buttonPanel.setLayout(new GridLayout(rows, columns)); -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/SurveyorShowAction.java
r34591 r35262 23 23 import org.openstreetmap.josm.actions.JosmAction; 24 24 import org.openstreetmap.josm.gui.MainApplication; 25 import org.openstreetmap.josm. plugins.surveyor.util.ResourceLoader;25 import org.openstreetmap.josm.io.CachedFile; 26 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.Logging; … … 107 107 } 108 108 109 public SurveyorComponent createComponent() { 109 public static SurveyorComponent createComponent() { 110 110 String source = Config.getPref().get("surveyor.source"); 111 if (source == null || source. length() == 0) {111 if (source == null || source.isEmpty()) { 112 112 source = DEFAULT_SOURCE; 113 113 Config.getPref().put("surveyor.source", DEFAULT_SOURCE); 114 // <FIXXME date="04.05.2007" author="cdaller">115 // TODO copy xml file to .josm directory if it does not exist!116 // </FIXXME>117 114 } 118 try (InputStream in = ResourceLoader.getInputStream(source)) {115 try (CachedFile cf = new CachedFile(source); InputStream in = cf.getInputStream()) { 119 116 return createComponent(in); 120 117 } catch (IOException e) { … … 134 131 * @throws SAXException if the xml could not be read. 135 132 */ 136 public SurveyorComponent createComponent(InputStream in) throws SAXException { 133 public static SurveyorComponent createComponent(InputStream in) throws SAXException { 137 134 XmlObjectParser parser = new XmlObjectParser(); 138 135 parser.mapOnStart("surveyor", SurveyorComponent.class); … … 146 143 Object object = parser.next(); 147 144 if (object instanceof SurveyorComponent) { 148 //System.out.println("SurveyorComponent " + object);149 145 surveyorComponent = (SurveyorComponent) object; 150 146 } else if (object instanceof ButtonDescription) { 151 //System.out.println("ButtonDescription " + object);152 147 ((ButtonDescription) object).setActions(actions); 153 148 surveyorComponent.addButton(((ButtonDescription) object)); 154 149 actions = new ArrayList<>(); 155 150 } else if (object instanceof SurveyorActionDescription) { 156 //System.out.println("SurveyorActionDescription " + object);157 151 actions.add((SurveyorActionDescription) object); 158 152 } else { -
applications/editors/josm/plugins/surveyor/src/org/openstreetmap/josm/plugins/surveyor/action/PlayAudioAction.java
r34591 r35262 4 4 import java.io.BufferedInputStream; 5 5 import java.io.IOException; 6 import java.io.InputStream;7 6 8 7 import javax.sound.sampled.AudioFormat; … … 15 14 16 15 import org.openstreetmap.josm.gui.MainApplication; 16 import org.openstreetmap.josm.io.CachedFile; 17 17 import org.openstreetmap.josm.plugins.surveyor.GpsActionEvent; 18 import org.openstreetmap.josm.plugins.surveyor.util.ResourceLoader;19 18 import org.openstreetmap.josm.tools.Logging; 20 19 … … 32 31 // run as a separate thread 33 32 MainApplication.worker.execute(() -> { 34 try { 35 if (audioSource == null) { 36 audioSource = getParameters().get(0); 37 } 38 InputStream in = new BufferedInputStream(ResourceLoader.getInputStream(audioSource)); 39 AudioInputStream stream = AudioSystem.getAudioInputStream(in); 33 if (audioSource == null) { 34 audioSource = getParameters().get(0); 35 } 36 try (CachedFile cf = new CachedFile(audioSource)) { 37 AudioInputStream stream = AudioSystem.getAudioInputStream(new BufferedInputStream(cf.getInputStream())); 40 38 41 39 // At present, ALAW and ULAW encodings must be converted
Note:
See TracChangeset
for help on using the changeset viewer.