public void removeFile(int index) {
    if (_resources != null && selectFile(index)) {
      _file.detach();
      _file = null;
      _dom.setChanged(true);
    }

    ResourcesListener.checkResources(_dom, _parent);
  }
 public boolean selectFile(int index) {
   if (_resources != null) {
     try {
       _file = (Element) _resources.getChildren("file", _dom.getNamespace()).get(index);
       _isNewFile = false;
       return true;
     } catch (Exception e) {
       return false;
     }
   } else return false;
 }
  public void applyFile(String file, String id, String os, String type) {
    if (_resources == null) _resources = ResourcesListener.getResourcesElement(_dom, _parent);

    Utils.setAttribute("file", file, _file);
    Utils.setAttribute("id", id, _file);
    Utils.setAttribute("os", os, _file);
    Utils.setAttribute("type", type, _file);

    if (_isNewFile) _resources.addContent(_file);

    _isNewFile = false;
    _dom.setChanged(true);
  }
 public void fillFiles(Table table) {
   table.removeAll();
   int index = 0;
   if (_resources != null) {
     for (Iterator it = _resources.getChildren("file", _dom.getNamespace()).iterator();
         it.hasNext(); ) {
       Element file = (Element) it.next();
       TableItem item = new TableItem(table, SWT.NONE);
       item.setText(0, Utils.getAttributeValue("file", file));
       item.setText(1, Utils.getAttributeValue("os", file));
       item.setText(2, Utils.getAttributeValue("type", file));
       item.setText(3, Utils.getAttributeValue("id", file));
       if (file.equals(_file)) table.select(index);
       index++;
     }
   }
 }
 public FilesListener(DocumentationDom dom, Element parent) {
   _dom = dom;
   _parent = parent;
   _resources = _parent.getChild("resources", _dom.getNamespace());
 }
 public void setNewFile() {
   _file = new Element("file", _dom.getNamespace());
   Utils.setAttribute("os", _platforms[0], _file);
   Utils.setAttribute("type", _types[0], _file);
   _isNewFile = true;
 }