Example usage for org.eclipse.jdt.internal.compiler.env AccessRuleSet AccessRuleSet

List of usage examples for org.eclipse.jdt.internal.compiler.env AccessRuleSet AccessRuleSet

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.env AccessRuleSet AccessRuleSet.

Prototype

public AccessRuleSet(AccessRule[] accessRules, byte classpathEntryType, String classpathEntryName) 

Source Link

Document

Make a new set of access rules.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.ClasspathEntry.java

License:Open Source License

/**
 * Creates a class path entry of the specified kind with the given path.
 *///  w  w  w  .  j  av a2 s.c  o  m
public ClasspathEntry(int contentKind, int entryKind, IPath path, IPath[] inclusionPatterns,
        IPath[] exclusionPatterns, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
        IPath specificOutputLocation, IClasspathEntry referencingEntry, boolean isExported,
        IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes) {

    this.contentKind = contentKind;
    this.entryKind = entryKind;
    this.path = path;
    this.inclusionPatterns = inclusionPatterns;
    this.exclusionPatterns = exclusionPatterns;
    this.referencingEntry = referencingEntry;

    int length;
    if (accessRules != null && (length = accessRules.length) > 0) {
        AccessRule[] rules = new AccessRule[length];
        System.arraycopy(accessRules, 0, rules, 0, length);
        byte classpathEntryType;
        String classpathEntryName;
        JavaModelManager manager = JavaModelManager.getJavaModelManager();
        if (this.entryKind == CPE_PROJECT || this.entryKind == CPE_SOURCE) { // can be remote source entry when reconciling
            classpathEntryType = AccessRestriction.PROJECT;
            classpathEntryName = manager.intern(getPath().segment(0));
        } else {
            classpathEntryType = AccessRestriction.LIBRARY;
            Object target = JavaModel.getWorkspaceTarget(path);
            if (target == null) {
                classpathEntryName = manager.intern(path.toOSString());
            } else {
                classpathEntryName = manager.intern(path.makeRelative().toString());
            }
        }
        this.accessRuleSet = new AccessRuleSet(rules, classpathEntryType, classpathEntryName);
    }
    //      else { -- implicit!
    //         this.accessRuleSet = null;
    //      }

    this.combineAccessRules = combineAccessRules;
    this.extraAttributes = extraAttributes;

    if (inclusionPatterns != INCLUDE_ALL && inclusionPatterns.length > 0) {
        this.fullInclusionPatternChars = UNINIT_PATTERNS;
    }
    if (exclusionPatterns.length > 0) {
        this.fullExclusionPatternChars = UNINIT_PATTERNS;
    }
    this.sourceAttachmentPath = sourceAttachmentPath;
    this.sourceAttachmentRootPath = sourceAttachmentRootPath;
    this.specificOutputLocation = specificOutputLocation;
    this.isExported = isExported;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.JavaSearchScope.java

License:Open Source License

/**
 * Get access rule set corresponding to a given path.
 *
 * @param relativePath/*from  ww  w  .  ja  va 2  s  .co  m*/
 *         The path user want to have restriction access
 * @return The access rule set for given path or null if none is set for it.
 * Returns specific uninit access rule set when scope does not enclose the given path.
 */
public AccessRuleSet getAccessRuleSet(String relativePath, String containerPath) {
    //   int index = indexOf(containerPath, relativePath);
    //   if (index == -1) {
    //      // this search scope does not enclose given path
    //      return NOT_ENCLOSED;
    //   }
    //   if (this.pathRestrictions == null)
    //      return null;
    //   return this.pathRestrictions[index];
    return new AccessRuleSet(new AccessRule[0], AccessRestriction.LIBRARY, "gwt");
}

From source file:net.sf.j2s.core.builder.State.java

License:Open Source License

private static AccessRuleSet readRestriction(DataInputStream in) throws IOException {
    int length = in.readInt();
    if (length == 0)
        return null; // no restriction specified
    AccessRule[] accessRules = new AccessRule[length];
    for (int i = 0; i < length; i++) {
        char[] pattern = readName(in);
        int problemId = in.readInt();
        accessRules[i] = new ClasspathAccessRule(pattern, problemId);
    }//from   www  .  ja  v a  2 s  .c  o m
    JavaModelManager manager = JavaModelManager.getJavaModelManager();
    return new AccessRuleSet(accessRules, in.readByte(), manager.intern(in.readUTF()));
}

From source file:org.eclipse.che.jdt.internal.core.ClasspathEntry.java

License:Open Source License

/**
 * Creates a class path entry of the specified kind with the given path.
 */// w w w .j  av  a2  s.c o  m
public ClasspathEntry(int contentKind, int entryKind, IPath path, IPath[] inclusionPatterns,
        IPath[] exclusionPatterns, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath,
        IPath specificOutputLocation, IClasspathEntry referencingEntry, boolean isExported,
        IAccessRule[] accessRules, boolean combineAccessRules, IClasspathAttribute[] extraAttributes) {

    this.contentKind = contentKind;
    this.entryKind = entryKind;
    this.path = path;
    this.inclusionPatterns = inclusionPatterns;
    this.exclusionPatterns = exclusionPatterns;
    this.referencingEntry = referencingEntry;

    int length;
    if (accessRules != null && (length = accessRules.length) > 0) {
        AccessRule[] rules = new AccessRule[length];
        System.arraycopy(accessRules, 0, rules, 0, length);
        byte classpathEntryType;
        String classpathEntryName;
        JavaModelManager manager = JavaModelManager.getJavaModelManager();
        if (this.entryKind == CPE_PROJECT || this.entryKind == CPE_SOURCE) { // can be remote source entry when reconciling
            classpathEntryType = AccessRestriction.PROJECT;
            classpathEntryName = manager.intern(getPath().segment(0));
        } else {
            classpathEntryType = AccessRestriction.LIBRARY;
            //                Object target = JavaModel.getWorkspaceTarget(path);
            //                if (target == null) {
            classpathEntryName = manager.intern(path.toOSString());
            //                } else {
            //                    classpathEntryName = manager.intern(path.makeRelative().toString());
            //                }
        }
        this.accessRuleSet = new AccessRuleSet(rules, classpathEntryType, classpathEntryName);
    }
    //      else { -- implicit!
    //         this.accessRuleSet = null;
    //      }

    this.combineAccessRules = combineAccessRules;
    this.extraAttributes = extraAttributes;

    if (inclusionPatterns != INCLUDE_ALL && inclusionPatterns.length > 0) {
        this.fullInclusionPatternChars = UNINIT_PATTERNS;
    }
    if (exclusionPatterns.length > 0) {
        this.fullExclusionPatternChars = UNINIT_PATTERNS;
    }
    this.sourceAttachmentPath = sourceAttachmentPath;
    this.sourceAttachmentRootPath = sourceAttachmentRootPath;
    this.specificOutputLocation = specificOutputLocation;
    this.isExported = isExported;
}