public List<String> getW32Icons() {
    Xpp3Dom domLauncher = dom.getChild("launcher");
    if (domLauncher == null) {

      return null;
    }
    Xpp3Dom win = domLauncher.getChild("win");
    if (win == null) {
      return null;
    }
    List<String> icons = new ArrayList<String>();
    String useIco = win.getAttribute("useIco");
    if (Boolean.valueOf(useIco)) {
      // for (Xpp3Dom ico : win.getChildren("ico"))
      {
        Xpp3Dom ico = win.getChild("ico");
        // should be only 1
        icons.add(ico.getAttribute("path"));
      }
    } else {
      for (Xpp3Dom bmp : win.getChildren("bmp")) {
        String[] attibuteNames = bmp.getAttributeNames();
        if (attibuteNames != null && attibuteNames.length > 0)
          icons.add(bmp.getAttribute(bmp.getAttributeNames()[0]));
      }
    }
    return icons;
  }
Exemplo n.º 2
0
 public static void parsePluginXml(
     InputStream is, List<String> configurators, List<String> mappingStrategies)
     throws XmlPullParserException, IOException {
   Xpp3Dom plugin = Xpp3DomBuilder.build(is, "UTF-8"); // $NON-NLS-1$
   Xpp3Dom[] extensions = plugin.getChildren("extension"); // $NON-NLS-1$
   for (Xpp3Dom extension : extensions) {
     String extensionPoint = extension.getAttribute("point"); // $NON-NLS-1$
     if (LifecycleMappingFactory.EXTENSION_PROJECT_CONFIGURATORS.equals(extensionPoint)) {
       Xpp3Dom[] configuratorsDom = extension.getChildren("configurator"); // $NON-NLS-1$
       for (Xpp3Dom configurator : configuratorsDom) {
         String id = configurator.getAttribute("id"); // $NON-NLS-1$
         if (id != null) {
           configurators.add(id);
         }
       }
     } else if (LifecycleMappingFactory.EXTENSION_LIFECYCLE_MAPPINGS.equals(extensionPoint)) {
       Xpp3Dom[] lifecycleMappingsDom = extension.getChildren("lifecycleMapping"); // $NON-NLS-1$
       for (Xpp3Dom lifecycleMapping : lifecycleMappingsDom) {
         String id = lifecycleMapping.getAttribute("id"); // $NON-NLS-1$
         if (id != null) {
           mappingStrategies.add(id);
         }
       }
     }
   }
 }
Exemplo n.º 3
0
 protected Map<String, String> initialValue() {
   Map<String, String> map = new HashMap<String, String>();
   ClasspathResourceMap resources =
       scanner
           .matchResource(".*[.]gwt[.]*xml")
           .scan(Thread.currentThread().getContextClassLoader());
   for (StringDataResource resource : resources.findResources("", GWT_XML_PATTERN)) {
     try {
       Xpp3Dom dom = Xpp3DomBuilder.build(resource.open(), "UTF-8");
       String rename = dom.getAttribute("rename-to");
       if (rename != null) {
         String resName = resource.getResourceName().replace('/', '.');
         resName = resName.substring(0, resName.lastIndexOf("gwt") - 1);
         map.put(rename, resName);
         X_Log.trace("Found gwt module rename; ", rename, " -> ", resName);
       }
     } catch (Exception e) {
       X_Log.error(
           "Error reading xml from ",
           resource.getResourceName(),
           e,
           "\nSet xapi.log.level=TRACE to see the faulty xml");
       X_Log.trace("Faulty xml: ", resource.readAll());
     }
   }
   ;
   return map;
 };
  public String getMacIcon() {
    Xpp3Dom domLauncher = dom.getChild("launcher");
    if (domLauncher == null) {

      return null;
    }
    Xpp3Dom linux = domLauncher.getChild("macosx");
    if (linux == null) {
      return null;
    }
    return linux.getAttribute("icon");
  }
Exemplo n.º 5
0
  private void addChildren(final Xpp3Dom xpp3Dom, final ConfigurationElementBuilder builder) {
    builder.setText(xpp3Dom.getValue());
    for (String attributeName : xpp3Dom.getAttributeNames()) {
      String attributeValue = xpp3Dom.getAttribute(attributeName);
      if (attributeValue != null) builder.addAttribute(attributeName, attributeValue);
    }

    for (Xpp3Dom child : xpp3Dom.getChildren()) {
      ConfigurationElementBuilder elementBuilder = builder.addChild(child.getName());
      addChildren(child, elementBuilder);
    }
  }
  private void loadDefaultProfileName(URL url) throws MojoExecutionException {
    Reader reader = null;
    try {
      reader = new InputStreamReader(url.openStream());
      Xpp3Dom dom = Xpp3DomBuilder.build(reader);

      Xpp3Dom[] existingProfiles = dom.getChildren(ELT_PROFILE);
      if (existingProfiles.length != 0) {
        Xpp3Dom firstProfile = existingProfiles[0];
        this.profileName = firstProfile.getAttribute("name");
      }
    } catch (XmlPullParserException e) {
      throw new MojoExecutionException(
          Messages.getString("EclipsePlugin.cantparseexisting", url.toString())); // $NON-NLS-1$
    } catch (IOException e) {
      throw new MojoExecutionException(
          Messages.getString("EclipsePlugin.cantparseexisting", url.toString())); // $NON-NLS-1$
    } finally {
      IOUtil.close(reader);
    }
  }
 public String getName() {
   return dom.getAttribute("name");
 }
 public String getId() {
   return dom.getAttribute("id");
 }
 public String getApplication() {
   return dom.getAttribute("application");
 }
 public String getVersion() {
   return dom.getAttribute("version");
 }
 public boolean includeLaunchers() {
   String attribute = dom.getAttribute("includeLaunchers");
   return attribute == null ? true : Boolean.parseBoolean(attribute);
 }
 public boolean useFeatures() {
   return Boolean.parseBoolean(dom.getAttribute("useFeatures"));
 }
Exemplo n.º 13
0
 public double getTime() {
   return Double.parseDouble(dom.getAttribute("time"));
 }