Changeset 3127 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
- Timestamp:
- 2010-03-13T10:23:39+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/ProjectionPreference.java
r2990 r3127 109 109 String projname = proj.getClass().getName(); 110 110 Collection<String> prefs = null; 111 if(proj HasPrefs(proj)) {111 if(proj instanceof ProjectionSubPrefs) { 112 112 prefs = ((ProjectionSubPrefs) proj).getPreferences(projSubPrefPanel); 113 113 } … … 121 121 } 122 122 123 return false;124 }125 126 /**127 * Finds out if the given projection implements the ProjectionPreference128 * interface129 * @param proj130 * @return131 */132 @SuppressWarnings("unchecked")133 static private boolean projHasPrefs(Projection proj) {134 Class[] ifaces = proj.getClass().getInterfaces();135 for(int i = 0; i < ifaces.length; i++) {136 if(ifaces[i].getSimpleName().equals("ProjectionSubPrefs"))137 return true;138 }139 123 return false; 140 124 } … … 167 151 String sname = name.substring(name.lastIndexOf(".")+1); 168 152 Main.pref.putCollection("projection.sub."+sname, coll); 169 if( projHasPrefs(Main.proj)) {153 if(Main.proj instanceof ProjectionSubPrefs) { 170 154 ((ProjectionSubPrefs) Main.proj).setPreferences(coll); 171 155 } … … 200 184 */ 201 185 private void selectedProjectionChanged(Projection proj) { 202 if(! projHasPrefs(proj)) {186 if(!(proj instanceof ProjectionSubPrefs)) { 203 187 projSubPrefPanel = new JPanel(); 204 188 } else { … … 229 213 String name = proj.getClass().getName(); 230 214 String sname = name.substring(name.lastIndexOf(".")+1); 231 if(proj HasPrefs(proj)) {215 if(proj instanceof ProjectionSubPrefs) { 232 216 ((ProjectionSubPrefs) proj).setPreferences(Main.pref.getCollection("projection.sub."+sname, null)); 233 217 }
Note:
See TracChangeset
for help on using the changeset viewer.
