Changeset 8835 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-10-07T23:30:22+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r8681 r8835 888 888 active = editEntryDialog.active(); 889 889 } 890 activeSourcesModel.addSource(new SourceEntry(890 final SourceEntry entry = new SourceEntry( 891 891 editEntryDialog.getURL(), 892 null, editEntryDialog.getTitle(), active)); 892 null, editEntryDialog.getTitle(), active); 893 entry.title = getTitleForSourceEntry(entry); 894 activeSourcesModel.addSource(entry); 893 895 activeSourcesModel.fireTableDataChanged(); 894 896 } … … 951 953 if (e.title != null || !"".equals(editEntryDialog.getTitle())) { 952 954 e.title = editEntryDialog.getTitle(); 953 if ("".equals(e.title)) { 954 e.title = null; 955 } 955 e.title = getTitleForSourceEntry(e); 956 956 } 957 957 e.url = editEntryDialog.getURL(); … … 1657 1657 ); 1658 1658 } 1659 1660 protected String getTitleForSourceEntry(SourceEntry entry) { 1661 return "".equals(entry.title) ? null : entry.title; 1662 } 1659 1663 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r8510 r8835 21 21 import org.openstreetmap.josm.Main; 22 22 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 23 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 23 24 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 24 25 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; … … 160 161 } 161 162 163 @Override 164 protected String getTitleForSourceEntry(SourceEntry entry) { 165 final String title = getTitleFromSourceEntry(entry); 166 return title != null ? title : super.getTitleForSourceEntry(entry); 167 } 168 } 169 170 public static String getTitleFromSourceEntry(SourceEntry entry) { 171 try { 172 final MapCSSStyleSource css = new MapCSSStyleSource(entry); 173 css.loadStyleSource(); 174 if (css.title != null && !css.title.isEmpty()) { 175 return css.title; 176 } 177 } catch (RuntimeException ignore) { 178 } 179 return null; 162 180 } 163 181 -
trunk/src/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreference.java
r7937 r8835 25 25 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; 26 26 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 27 import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference; 27 28 28 29 /** … … 114 115 } 115 116 } 117 118 @Override 119 protected String getTitleForSourceEntry(SourceEntry entry) { 120 final String title = MapPaintPreference.getTitleFromSourceEntry(entry); 121 return title != null ? title : super.getTitleForSourceEntry(entry); 122 } 116 123 } 117 124
Note:
See TracChangeset
for help on using the changeset viewer.