Esempio n. 1
0
 public void setFeatureInfo(IFeatureInfo info, int index) throws CoreException {
   ensureModelEditable();
   Object oldValue = fInfos[index];
   if (oldValue != null) {
     ((FeatureInfo) oldValue).setInTheModel(true);
   }
   fInfos[index] = info;
   String property;
   switch (index) {
     case INFO_DESCRIPTION:
       property = P_DESCRIPTION;
       break;
     case INFO_LICENSE:
       property = P_LICENSE;
       break;
     case INFO_COPYRIGHT:
       property = P_COPYRIGHT;
       break;
     default:
       return;
   }
   firePropertyChanged(property, oldValue, info);
 }
Esempio n. 2
0
  protected void parse(Node node) {
    super.parse(node);
    fProviderName = getNodeAttribute(node, "provider-name"); // $NON-NLS-1$
    fPlugin = getNodeAttribute(node, "plugin"); // $NON-NLS-1$
    fOs = getNodeAttribute(node, "os"); // $NON-NLS-1$
    fWs = getNodeAttribute(node, "ws"); // $NON-NLS-1$
    fNl = getNodeAttribute(node, "nl"); // $NON-NLS-1$
    fArch = getNodeAttribute(node, "arch"); // $NON-NLS-1$
    fImageName = getNodeAttribute(node, "image"); // $NON-NLS-1$
    fColocationAffinity = getNodeAttribute(node, "colocation-affinity"); // $NON-NLS-1$
    fApplication = getNodeAttribute(node, "application"); // $NON-NLS-1$
    fPrimary = getBooleanAttribute(node, "primary"); // $NON-NLS-1$
    fExclusive = getBooleanAttribute(node, "exclusive"); // $NON-NLS-1$
    NodeList children = node.getChildNodes();
    fValid = true;

    for (int i = 0; i < children.getLength(); i++) {
      Node child = children.item(i);
      if (child.getNodeType() == Node.ELEMENT_NODE) {
        String tag = child.getNodeName().toLowerCase(Locale.ENGLISH);
        if (tag.equals("description")) { // $NON-NLS-1$
          IFeatureInfo info = getModel().getFactory().createInfo(IFeature.INFO_DESCRIPTION);
          ((FeatureInfo) info).setInTheModel(true);
          ((FeatureInfo) info).parse(child);
          fInfos[IFeature.INFO_DESCRIPTION] = info;
        } else if (tag.equals("license")) { // $NON-NLS-1$
          IFeatureInfo info = getModel().getFactory().createInfo(IFeature.INFO_LICENSE);
          ((FeatureInfo) info).setInTheModel(true);
          ((FeatureInfo) info).parse(child);
          fInfos[IFeature.INFO_LICENSE] = info;
        } else if (tag.equals("copyright")) { // $NON-NLS-1$
          IFeatureInfo info = getModel().getFactory().createInfo(IFeature.INFO_COPYRIGHT);
          ((FeatureInfo) info).setInTheModel(true);
          ((FeatureInfo) info).parse(child);
          fInfos[IFeature.INFO_COPYRIGHT] = info;
        } else if (tag.equals("url")) { // $NON-NLS-1$
          if (fUrl == null) {
            fUrl = getModel().getFactory().createURL();
            ((FeatureURL) fUrl).setInTheModel(true);
            ((FeatureURL) fUrl).parse(child);
          }
        } else if (tag.equals("requires")) { // $NON-NLS-1$
          parseRequires(child);
        } else if (tag.equals("install-handler")) { // $NON-NLS-1$
          IFeatureInstallHandler handler = getModel().getFactory().createInstallHandler();
          ((FeatureInstallHandler) handler).parse(child);
          ((FeatureInstallHandler) handler).setInTheModel(true);
          this.fHandler = handler;
        } else if (tag.equals("plugin")) { // $NON-NLS-1$
          IFeaturePlugin plugin = getModel().getFactory().createPlugin();
          ((FeaturePlugin) plugin).parse(child);
          ((FeaturePlugin) plugin).setInTheModel(true);
          fPlugins.add(plugin);
        } else if (tag.equals("data")) { // $NON-NLS-1$
          IFeatureData newData = getModel().getFactory().createData();
          ((FeatureData) newData).parse(child);
          ((FeatureData) newData).setInTheModel(true);
          fData.add(newData);
        } else if (tag.equals("includes")) { // $NON-NLS-1$
          IFeatureChild newChild = getModel().getFactory().createChild();
          ((FeatureChild) newChild).parse(child);
          ((FeatureChild) newChild).setInTheModel(true);
          this.fChildren.add(newChild);
        }
      }
    }
    fValid = hasRequiredAttributes();
  }