#65124: Simple fixes shall be done in simple way mkleint_new_mode_names_base
authorjtulach@netbeans.org
Fri, 30 Sep 2005 06:40:36 +0000
changeset 67826f7ac0c4ca
parent 66 a566e3b899dd
child 68 f692e5873720
#65124: Simple fixes shall be done in simple way
openide.util/src/org/openide/util/lookup/AbstractLookup.java
openide.util/src/org/openide/util/lookup/MetaInfServicesLookup.java
     1.1 --- a/openide.util/src/org/openide/util/lookup/AbstractLookup.java	Thu Sep 29 23:03:35 2005 +0000
     1.2 +++ b/openide.util/src/org/openide/util/lookup/AbstractLookup.java	Fri Sep 30 06:40:36 2005 +0000
     1.3 @@ -223,6 +223,25 @@
     1.4      protected final void setPairs(Collection collection) {
     1.5          notifyCollectedListeners(setPairsAndCollectListeners(collection));
     1.6      }
     1.7 +    
     1.8 +    /** Getter for set of pairs. Package private contract with MetaInfServicesLookup.
     1.9 +     * @return a LinkedHashSet that can be modified
    1.10 +     */
    1.11 +    final LinkedHashSet getPairsAsLHS() {
    1.12 +        AbstractLookup.Storage t = enterStorage();
    1.13 +
    1.14 +        try {
    1.15 +            Enumeration en = t.lookup(Object.class);
    1.16 +			LinkedHashSet arr = new LinkedHashSet();
    1.17 +            while (en.hasMoreElements()) {
    1.18 +                Pair item = (Pair) en.nextElement();
    1.19 +				arr.add(item);
    1.20 +            }
    1.21 +			return arr;
    1.22 +        } finally {
    1.23 +            exitStorage();
    1.24 +        }
    1.25 +    }
    1.26  
    1.27      /** Collects listeners without notification. Needed in MetaInfServicesLookup
    1.28       * right now, but maybe will become an API later.
     2.1 --- a/openide.util/src/org/openide/util/lookup/MetaInfServicesLookup.java	Thu Sep 29 23:03:35 2005 +0000
     2.2 +++ b/openide.util/src/org/openide/util/lookup/MetaInfServicesLookup.java	Fri Sep 30 06:40:36 2005 +0000
     2.3 @@ -81,7 +81,7 @@
     2.4          synchronized (this) {
     2.5              if (classes.add(c)) {
     2.6                  // Added new class, search for it.
     2.7 -                Collection arr = new LinkedHashSet(lookup(new Template(Object.class)).allItems());
     2.8 +                Collection arr = getPairsAsLHS();
     2.9                  search(c, arr);
    2.10  
    2.11                  // listeners are notified under while holding lock on class c,