Exemplo n.º 1
0
  private boolean hasRequiredAttributes() {
    // Verify that all the required attributes are
    // defined.
    if (id == null) return false;
    if (version == null) return false;

    for (int i = 0; i < fChildren.size(); i++) {
      IFeatureChild child = (IFeatureChild) fChildren.elementAt(i);
      if (child.getId() == null || child.getVersion() == null) return false;
    }
    for (int i = 0; i < fPlugins.size(); i++) {
      IFeaturePlugin plugin = (IFeaturePlugin) fPlugins.elementAt(i);
      if (plugin.getId() == null || plugin.getVersion() == null) return false;
    }
    for (int i = 0; i < fData.size(); i++) {
      IFeatureData entry = (IFeatureData) fData.elementAt(i);
      if (entry.getId() == null) return false;
    }
    for (int i = 0; i < fImports.size(); i++) {
      IFeatureImport iimport = (IFeatureImport) fImports.elementAt(i);
      if (iimport.getId() == null) return false;
    }
    return true;
  }
Exemplo n.º 2
0
  public void write(String indent, PrintWriter writer) {
    if (fCopyright != null) {
      writer.println("<!--" + fCopyright + "-->"); // $NON-NLS-1$ //$NON-NLS-2$
    }
    writer.print(indent + "<feature"); // $NON-NLS-1$
    String indent2 = indent + INDENT;
    String indenta = indent + INDENT + INDENT;
    writeIfDefined(indenta, writer, "id", getId()); // $NON-NLS-1$
    writeIfDefined(indenta, writer, "label", getWritableString(getLabel())); // $NON-NLS-1$
    writeIfDefined(indenta, writer, "version", getVersion()); // $NON-NLS-1$
    writeIfDefined(
        indenta,
        writer,
        "provider-name", //$NON-NLS-1$
        getWritableString(fProviderName));
    writeIfDefined(
        indenta,
        writer,
        "plugin", //$NON-NLS-1$
        getPlugin());
    writeIfDefined(indenta, writer, "os", fOs); // $NON-NLS-1$
    writeIfDefined(indenta, writer, "ws", fWs); // $NON-NLS-1$
    writeIfDefined(indenta, writer, "nl", fNl); // $NON-NLS-1$
    writeIfDefined(indenta, writer, "arch", fArch); // $NON-NLS-1$
    if (fImageName != null)
      writeIfDefined(indenta, writer, "image", getWritableString(fImageName)); // $NON-NLS-1$
    if (isPrimary()) {
      writer.println();
      writer.print(indenta + "primary=\"true\""); // $NON-NLS-1$
    }
    if (isExclusive()) {
      writer.println();
      writer.print(indenta + "exclusive=\"true\""); // $NON-NLS-1$
    }
    writeIfDefined(indenta, writer, "colocation-affinity", fColocationAffinity); // $NON-NLS-1$
    writeIfDefined(indenta, writer, "application", fApplication); // $NON-NLS-1$

    writer.println(">"); // $NON-NLS-1$
    if (fHandler != null) {
      fHandler.write(indent2, writer);
    }

    for (int i = 0; i < 3; i++) {
      IFeatureInfo info = fInfos[i];
      if (info != null && !info.isEmpty()) info.write(indent2, writer);
    }

    if (fUrl != null) {
      fUrl.write(indent2, writer);
    }
    for (int i = 0; i < fChildren.size(); i++) {
      IFeatureChild child = (IFeatureChild) fChildren.elementAt(i);
      writer.println();
      child.write(indent2, writer);
    }
    if (fImports.size() > 0) {
      writer.println();
      writer.println(indent2 + "<requires>"); // $NON-NLS-1$
      for (int i = 0; i < fImports.size(); i++) {
        IFeatureImport iimport = (IFeatureImport) fImports.get(i);
        iimport.write(indenta, writer);
      }
      writer.println(indent2 + "</requires>"); // $NON-NLS-1$
    }
    for (int i = 0; i < fPlugins.size(); i++) {
      IFeaturePlugin plugin = (IFeaturePlugin) fPlugins.elementAt(i);
      writer.println();
      plugin.write(indent2, writer);
    }
    for (int i = 0; i < fData.size(); i++) {
      IFeatureData entry = (IFeatureData) fData.elementAt(i);
      writer.println();
      entry.write(indent2, writer);
    }
    writer.println();
    writer.println(indent + "</feature>"); // $NON-NLS-1$
  }