Beispiel #1
1
  private void initIfNeed() {
    if (myInitialized) return;
    myInitialized = true;
    for (Map.Entry<String, Pair<String, List<String>>> entry : myTree.entrySet()) {
      final String group = entry.getKey();
      if (CORE.equals(group)) continue;

      List<IdSet> idSets = new ArrayList<IdSet>();
      StringBuilder description = new StringBuilder();
      for (String idDescription : entry.getValue().getSecond()) {
        IdSet idSet = new IdSet(idDescription);
        String idSetTitle = idSet.getTitle();
        if (idSetTitle == null) continue;
        idSets.add(idSet);
        if (description.length() > 0) {
          description.append(", ");
        }
        description.append(idSetTitle);
      }
      myGroups.put(group, idSets);

      if (description.length() > MAX_DESCR_LENGTH) {
        int lastWord = description.lastIndexOf(",", MAX_DESCR_LENGTH);
        description.delete(lastWord, description.length()).append("...");
      }
      description.insert(0, "<html><body><center><i>");
      myDescriptions.put(group, description.toString());
    }
  }
Beispiel #2
0
 IdSet getSet(String pluginId) {
   initIfNeed();
   for (List<IdSet> sets : myGroups.values()) {
     for (IdSet set : sets) {
       for (String id : set.getIds()) {
         if (id.equals(pluginId)) return set;
       }
     }
   }
   return null;
 }
Beispiel #3
0
 void setPluginEnabledWithDependencies(final String pluginId, boolean enabled) {
   initIfNeed();
   Set<String> ids = new HashSet<String>();
   collectInvolvedIds(pluginId, enabled, ids);
   Set<IdSet> sets = new HashSet<IdSet>();
   for (String id : ids) {
     IdSet set = getSet(id);
     if (set != null) {
       sets.add(set);
     }
   }
   for (IdSet set : sets) {
     ids.addAll(Arrays.asList(set.getIds()));
   }
   for (String id : ids) {
     if (enabled) {
       myDisabledPluginIds.remove(id);
     } else {
       myDisabledPluginIds.add(id);
     }
   }
 }
Beispiel #4
0
 void setIdSetEnabled(IdSet set, boolean enabled) {
   for (String id : set.getIds()) {
     setPluginEnabledWithDependencies(id, enabled);
   }
 }
Beispiel #5
0
 boolean isIdSetAllEnabled(IdSet set) {
   for (String id : set.getIds()) {
     if (!isPluginEnabled(id)) return false;
   }
   return true;
 }