Exemplo n.º 1
0
 public void restoreProperty(String name, Object oldValue, Object newValue) throws CoreException {
   if (name.equals(P_OS)) {
     setOS((String) newValue);
   } else if (name.equals(P_WS)) {
     setWS((String) newValue);
   } else if (name.equals(P_NL)) {
     setNL((String) newValue);
   } else if (name.equals(P_ARCH)) {
     setArch((String) newValue);
   } else if (name.equals(P_COLLOCATION_AFFINITY)) {
     setColocationAffinity((String) newValue);
   } else if (name.equals(P_APPLICATION)) {
     setApplication((String) newValue);
   } else if (name.equals(P_PRIMARY)) {
     setPrimary(newValue != null ? ((Boolean) newValue).booleanValue() : false);
   } else if (name.equals(P_EXCLUSIVE)) {
     setExclusive(newValue != null ? ((Boolean) newValue).booleanValue() : false);
   } else if (name.equals(P_PROVIDER)) {
     setProviderName((String) newValue);
   } else if (name.equals(P_PLUGIN)) {
     setPlugin((String) newValue);
   } else if (name.equals(P_URL)) {
     setURL((IFeatureURL) newValue);
   } else if (name.equals(P_INSTALL_HANDLER)) {
     setInstallHandler((IFeatureInstallHandler) newValue);
   } else if (name.equals(P_DESCRIPTION)) {
     setFeatureInfo((IFeatureInfo) newValue, INFO_DESCRIPTION);
   } else if (name.equals(P_LICENSE)) {
     setFeatureInfo((IFeatureInfo) newValue, INFO_LICENSE);
   } else if (name.equals(P_COPYRIGHT)) {
     setFeatureInfo((IFeatureInfo) newValue, INFO_COPYRIGHT);
   } else if (name.equals(P_IMAGE)) {
     setImageName((String) newValue);
   } else super.restoreProperty(name, oldValue, newValue);
 }
Exemplo n.º 2
0
 public void reset() {
   super.reset();
   fData.clear();
   fPlugins.clear();
   fImports.clear();
   fChildren.clear();
   fUrl = null;
   fProviderName = null;
   fPlugin = null;
   fOs = null;
   fWs = null;
   fNl = null;
   fArch = null;
   fInfos[0] = null;
   fInfos[1] = null;
   fInfos[2] = null;
   fPrimary = false;
   fExclusive = false;
   fColocationAffinity = null;
   fApplication = null;
   fValid = false;
 }
Exemplo n.º 3
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();
  }