Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 private void loadScopeSets() {
   sets = new ArrayList();
   IPath location = HelpUIPlugin.getDefault().getStateLocation();
   location = location.append("scope_sets"); // $NON-NLS-1$
   File dir = location.toFile();
   defSet = null;
   if (dir.exists() && dir.isDirectory()) {
     File[] files =
         dir.listFiles(
             new FilenameFilter() {
               public boolean accept(File dir, String name) {
                 return name.endsWith(ScopeSet.EXT) || name.endsWith(HistoryScopeSet.EXT);
               }
             });
     for (int i = 0; i < files.length; i++) {
       File file = files[i];
       String name = file.getName();
       int loc = name.lastIndexOf(ScopeSet.EXT);
       if (loc != -1) {
         ScopeSet set = new ScopeSet(name.substring(0, loc));
         sets.add(set);
         if (set.isDefault()) defSet = set;
         continue;
       }
       loc = name.lastIndexOf(HistoryScopeSet.EXT);
       if (loc != -1) {
         HistoryScopeSet set = new HistoryScopeSet(name.substring(0, loc), null);
         sets.add(set);
       }
     }
   }
   if (sets.size() == 1) {
     activeSet = (ScopeSet) sets.get(0);
   }
   if (defSet == null) {
     defSet = new ScopeSet();
     sets.add(defSet);
   }
 }