Java Code Examples for org.apache.tools.ant.types.PatternSet#getIncludePatterns()

The following examples show how to use org.apache.tools.ant.types.PatternSet#getIncludePatterns() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PatternMatchedFilter.java    From yGuard with MIT License 5 votes vote down vote up
protected boolean match( TypePatternSet.Type type, String str, PatternMatchedSection section ) {

    PatternSet patternSet = section.getPatternSet( type );

    if ( patternSet != null ) {

      String[] excludePatterns = patternSet.getExcludePatterns( project );
      if ( null != excludePatterns ) {
        for ( String excludePattern : excludePatterns ) {
          if ( SelectorUtils.match( excludePattern, str ) ) {
            return false;
          }
        }
      }

      String[] includePatterns = patternSet.getIncludePatterns( project );
      if ( null != includePatterns ) {
        for ( String includePattern : includePatterns ) {
          if ( SelectorUtils.match( includePattern, str ) ) {
            return true;
          }
        }
      } else {
        return true; // no include given: include all
      }
    } else {
      return true; // no patternset for type given: include all
    }
    return false; // str wasnt contained in includes / excludes
  }
 
Example 2
Source File: LocFiles.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private String fixJarName(String prefixDir, String name) {
    if (prefixDir.endsWith("locale/") && baseFiles != null) {
        prefixDir = prefixDir.substring(0, prefixDir.length() - 7);
        PatternSet bf = (PatternSet)getProject().getReference(baseFiles);
        for (String p : bf.getIncludePatterns(getProject())) {
            if (p.startsWith(prefixDir)) {
                String realName = p.substring(prefixDir.length());
                if (realName.indexOf('/') != -1 || realName.indexOf('\\') != -1) {
                    continue;
                }
                int indx = realName.indexOf(name);
                if (indx == -1) {
                    continue;
                }
                return realName.substring(0, indx + name.length());
            }
        }
    }
    
    
    if (name.equals("autoupdate-ui_nb")) {
        return "org-netbeans-modules-autoupdate-ui_nb";
    }
    if (name.equals("options-api_nb")) {
        return "org-netbeans-modules-options-api_nb";
    }
    if (name.equals("uihandler_nb")) {
        return "org-netbeans-modules-uihandler_nb";
    }
    return name;
}
 
Example 3
Source File: JarBundler.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
/**
 * Setter for the "jars" attribute (required if no "jarfileset" is present)
 * 
 * @deprecated Use <jarfileset> and/or <jarfilelist> nested tasks instead. 
 * 
 * @param s A list of jar files or patternsets (space or comma seperated)
 */
public void setJars(String s) {
	PatternSet patset = new PatternSet();
	patset.setIncludes(s);

	String[] jarNames = patset.getIncludePatterns(getProject());

	for (int i = 0; i < jarNames.length; i++)
		mJarAttrs.add(getProject().resolveFile(jarNames[i]));
}
 
Example 4
Source File: JarBundler.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
/**
 * Setter for the "execs" attribute
 * 
 * @deprecated Use &lt;execfileset/&gt; or &lt;execfilelist/&gt; nested tasks instead.
 * 
 * @param s A list of files or patternsets (space or comma seperated)
 */
public void setExecs(String s) {
	PatternSet patset = new PatternSet();
	patset.setIncludes(s);

	String[] execNames = patset.getIncludePatterns(getProject());

	for (int i = 0; i < execNames.length; i++) {
		File f = new File(execNames[i]);
		mExecAttrs.add(f);
	}
}
 
Example 5
Source File: JarBundler.java    From JarBundler with Apache License 2.0 5 votes vote down vote up
/**
 * Setter for the "extraclasspath" attribute (optional)
 * 
 * @param s A list of files or patternsets (space or comma seperated)
 */
public void setExtraclasspath(String s) {
	if (s == null || s.trim().equals("")) return;
	PatternSet patset = new PatternSet();
	patset.setIncludes(s);

	String[] cpNames = patset.getIncludePatterns(getProject());

	for (int i = 0; i < cpNames.length; i++) {
		File f = new File(cpNames[i]);
		mExtraClassPathAttrs.add(f);
	}
}