public ScopeSet[] getScopeSets(boolean implicit) {
   ArrayList result = new ArrayList();
   for (int i = 0; i < sets.size(); i++) {
     ScopeSet set = (ScopeSet) sets.get(i);
     if (set.isImplicit() == implicit) result.add(set);
     if (!implicit && set.isImplicit() && activeSet == set) result.add(set);
   }
   return (ScopeSet[]) result.toArray(new ScopeSet[result.size()]);
 }
 public boolean restoreLastExplicitSet() {
   if (activeSet != null && activeSet.isImplicit() && lastExplicitSet != null) {
     setActiveSet(lastExplicitSet);
     setChanged();
     return true;
   }
   return false;
 }
 public void setActiveSet(ScopeSet set) {
   if (this.activeSet != null) {
     this.activeSet.save();
   }
   this.activeSet = set;
   if (!activeSet.isImplicit()) lastExplicitSet = set;
   setChanged();
 }
 public HistoryScopeSet findSearchSet(String expression) {
   for (int i = 0; i < sets.size(); i++) {
     ScopeSet set = (ScopeSet) sets.get(i);
     if (!set.isImplicit() || !(set instanceof HistoryScopeSet)) continue;
     HistoryScopeSet sset = (HistoryScopeSet) set;
     if (sset.getExpression().equals(expression)) return sset;
   }
   return null;
 }
 public ScopeSet findSet(String name, boolean implicit) {
   ScopeSet defaultSet = null;
   for (int i = 0; i < sets.size(); i++) {
     ScopeSet set = (ScopeSet) sets.get(i);
     if (name != null && set.isImplicit() == implicit) {
       if (set.getName().equals(name)) return set;
     } else if (set.isDefault()) defaultSet = set;
   }
   if (!implicit) return defaultSet;
   return null;
 }
 /** @return Returns the activeSet. */
 public ScopeSet getActiveSet() {
   if (activeSet == null) {
     IDialogSettings settings = HelpUIPlugin.getDefault().getDialogSettings();
     String name = settings.get(ACTIVE_SET);
     activeSet = findSet(name);
     if (activeSet == null) {
       return (ScopeSet) sets.get(0);
     }
     if (!activeSet.isImplicit()) lastExplicitSet = activeSet;
   }
   return activeSet;
 }