JAL-1648 made further abstraction and createda new interface CacheBox in order to...
[jalview.git] / src / jalview / io / cache / AppCache.java
index 9201341..111a99b 100644 (file)
@@ -5,9 +5,6 @@ import java.util.Hashtable;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
-import javax.swing.JComboBox;
-import javax.swing.JComponent;
-
 public class AppCache implements AppCacheI
 {
   private static AppCache instance = null;
@@ -44,11 +41,10 @@ public class AppCache implements AppCacheI
   @Override
   public void updateCache(Cacheable cacheable)
   {
-    JComboBox<String> cacheComboBox = cacheable.getCacheComboBox();
+    CacheBoxI<String> cacheComboBox = cacheable.getCacheComboBox();
     String cacheKey = cacheable.getCacheKey();
-    JComponent nextFocusableComponent = cacheable.getNextFocusableElement();
-    String userInput = cacheComboBox.getEditor().getItem() == null ? ""
-            : cacheComboBox.getEditor().getItem().toString().trim();
+    cacheComboBox.looseFocus();
+    String userInput = cacheComboBox.getUserInput();
 
     if (userInput != null && !userInput.isEmpty())
     {
@@ -58,7 +54,6 @@ public class AppCache implements AppCacheI
     }
 
     String lastSearch = userInput;
-    nextFocusableComponent.requestFocusInWindow();
     if (cacheComboBox.getItemCount() > 0)
     {
       cacheComboBox.removeAllItems();