Ejemplo n.º 1
0
 private void getParents(List<Entry> list) {
   for (Entry entry : parents) {
     if (entry.install && !list.contains(entry)) {
       list.add(entry);
       entry.getParents(list);
     }
   }
 }
Ejemplo n.º 2
0
    // {{{ setSelectAll() method
    public void setSelectAll(boolean b) {
      if (isDownloadingList()) return;

      int length = getRowCount();
      for (int i = 0; i < length; i++) {
        if (b) setValueAt(Boolean.TRUE, i, 0);
        else {
          Entry entry = (Entry) filteredEntries.get(i);
          entry.parents = new LinkedList<Entry>();
          entry.install = false;
        }
      }
      fireTableChanged(new TableModelEvent(this));
    } // }}}
Ejemplo n.º 3
0
    // {{{ setValueAt() method
    @Override
    public void setValueAt(Object aValue, int row, int column) {
      if (column != 0) return;

      Object obj = filteredEntries.get(row);
      if (obj instanceof String) return;

      Entry entry = (Entry) obj;
      boolean before = entry.install;
      entry.install = Boolean.TRUE.equals(aValue);
      if (before == entry.install) return;
      if (!entry.install) deselectParents(entry);

      List<PluginList.Dependency> deps = entry.plugin.getCompatibleBranch().deps;

      for (int i = 0; i < deps.size(); i++) {
        PluginList.Dependency dep = deps.get(i);
        if ("plugin".equals(dep.what)) {
          boolean found = false;
          for (int j = 0; j < filteredEntries.size(); j++) {
            Entry temp = (Entry) filteredEntries.get(j);
            if (temp.plugin == dep.plugin) {
              found = true;
              if (entry.install) {
                temp.parents.add(entry);
                setValueAt(Boolean.TRUE, j, 0);
              } else temp.parents.remove(entry);

              break;
            }
          }
          if (!found) {
            // the dependency was not found in the filtered list so we search in
            // global list.
            for (int a = 0; a < entries.size(); a++) {
              Entry temp = (Entry) entries.get(a);
              if (temp.plugin == dep.plugin) {
                if (entry.install) {
                  temp.parents.add(entry);
                  temp.install = true;
                } else temp.parents.remove(entry);
                break;
              }
            }
          }
        }
      }
      updateFilteredEntries();
    } // }}}
Ejemplo n.º 4
0
    // {{{ deselectParents() method
    private void deselectParents(Entry entry) {
      Entry[] parents = entry.getParents();

      if (parents.length == 0) return;

      String[] args = {entry.name};
      int result = GUIUtilities.listConfirm(window, "plugin-manager.dependency", args, parents);
      if (result != JOptionPane.OK_OPTION) {
        entry.install = true;
        return;
      }

      for (int i = 0; i < parents.length; i++) parents[i].install = false;

      fireTableRowsUpdated(0, getRowCount() - 1);
    } // }}}