Ignore:
Timestamp:
2009-03-29T20:01:34+02:00 (15 years ago)
Author:
guggis
Message:
 
Location:
applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/TagEditorDialog.java

    r14323 r14338  
    173173                aclViewer = new AutoCompletionListViewer(autoCompletionList);
    174174                tagEditor.setAutoCompletionList(autoCompletionList);
     175                tagEditor.setAutoCompletionCache(acCache);
    175176                aclViewer.addAutoCompletionListListener(tagEditor);             
    176177               
     
    305306         */
    306307        public void startEditSession() {               
    307                 model.initFromJOSMSelection();
     308                model.clearAppliedPresets();
     309                model.initFromJOSMSelection();         
    308310                acCache.initFromJOSMDataset();
    309311                getModel().ensureOneTag();
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/PresetManager.java

    r14325 r14338  
    8585                Item item= (Item)presets.getSelectedItem();
    8686                if (item != null && model !=null) {
    87                         model.removeAppliedItem(item);
     87                        model.removeAppliedPreset(item);
    8888                }
    8989        }
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TableCellEditor.java

    r14325 r14338  
    128128                }
    129129               
     130                logger.info("acCache=" + acCache);
    130131                for (String value : acCache.getValues(forKey)) {
    131132                        autoCompletionList.add(
     
    225226        editor.setAutoCompletionList(autoCompletionList);
    226227    }
     228       
     229        public void setAutoCompletionCache(AutoCompletionCache acCache) {
     230                this.acCache = acCache;
     231        }
    227232
    228233       
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagEditor.java

    r14325 r14338  
    159159                tblTagEditor.setAutoCompletionList(autoCompletionList);
    160160        }
     161       
     162        public void setAutoCompletionCache(AutoCompletionCache acCache) {
     163                tblTagEditor.setAutoCompletionCache(acCache);
     164        }
    161165
    162166        @Override
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagEditorModel.java

    r14325 r14338  
    457457                                } else {
    458458                                        TagModel tagModel = get(tag.getKey());
    459                                         tagModel.setValue(tag.getValue());
     459                                        // only overwrite an existing value if the preset
     460                                        // proposes a value. I.e. don't overwrite
     461                                        // existing values for tag 'name' with an empty string
     462                                        //
     463                                        if (tag.getValue() != null) {
     464                                                tagModel.setValue(tag.getValue());
     465                                        }
    460466                                }
    461467                        }
     
    491497        }
    492498
    493         public void removeAppliedItem(Item item) {
     499        public void removeAppliedPreset(Item item) {
    494500                if (item == null) {
    495501                        return;
     
    520526        }
    521527       
     528        public void clearAppliedPresets() {
     529                appliedPresets.removeAllElements();
     530                fireTableDataChanged();
     531        }
     532       
    522533        public void highlightCurrentPreset() {
    523534                fireTableDataChanged();
  • applications/editors/josm/plugins/tageditor/src/org/openstreetmap/josm/plugins/tageditor/editor/TagTable.java

    r14325 r14338  
    2929import javax.swing.table.TableModel;
    3030
     31import org.openstreetmap.josm.plugins.tageditor.ac.AutoCompletionCache;
    3132import org.openstreetmap.josm.plugins.tageditor.ac.AutoCompletionList;
    3233
     
    402403        }
    403404       
     405        public void setAutoCompletionCache(AutoCompletionCache acCache) {
     406                if (acCache == null) {
     407                        logger.warning("argument acCache should not be null. Aborting.");
     408                        return;
     409                }
     410                if (editor != null) {
     411                        editor.setAutoCompletionCache(acCache);
     412                }
     413        }
     414       
    404415        public AutoCompletionList getAutoCompletionList() {
    405416                if (editor != null) {
Note: See TracChangeset for help on using the changeset viewer.