当前位置: 首页>>代码示例>>Java>>正文


Java IAccessRule类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.IAccessRule的典型用法代码示例。如果您正苦于以下问题:Java IAccessRule类的具体用法?Java IAccessRule怎么用?Java IAccessRule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IAccessRule类属于org.eclipse.jdt.core包,在下文中一共展示了IAccessRule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDependenciesToClasspath

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private void addDependenciesToClasspath(IProject project, IFolder folder,
    IProgressMonitor monitor)  throws CoreException {
  List<IClasspathEntry> newEntries = new ArrayList<>();

  IClasspathAttribute[] nonDependencyAttribute =
      new IClasspathAttribute[] {UpdateClasspathAttributeUtil.createNonDependencyAttribute()};

  // Add all the jars under lib folder to the classpath
  File libFolder = folder.getLocation().toFile();
  for (File file : libFolder.listFiles()) {
    IPath path = Path.fromOSString(file.toPath().toString());
    newEntries.add(JavaCore.newLibraryEntry(path, null, null, new IAccessRule[0],
        nonDependencyAttribute, false /* isExported */));
  }

  ClasspathUtil.addClasspathEntries(project, newEntries, monitor);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:18,代码来源:CreateAppEngineFlexWtpProject.java

示例2: newAccessRule

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private static IAccessRule newAccessRule(final String pattern, final boolean accessible) {
  return new IAccessRule() {

    @Override
    public boolean ignoreIfBetter() {
      return false;
    }

    @Override
    public IPath getPattern() {
      return new Path(pattern);
    }

    @Override
    public int getKind() {
      if (accessible) {
        return IAccessRule.K_ACCESSIBLE;
      } else {
        return IAccessRule.K_NON_ACCESSIBLE;
      }
    }
  };
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:LibraryClasspathContainerSerializerTest.java

示例3: isFiltered

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
public static boolean isFiltered(TypeNameMatch match) {
  boolean filteredByPattern = getDefault().filter(match.getFullyQualifiedName());
  if (filteredByPattern) return true;

  int accessibility = match.getAccessibility();
  switch (accessibility) {
    case IAccessRule.K_NON_ACCESSIBLE:
      return JavaCore.ENABLED.equals(
          JavaCore.getOption(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK));
    case IAccessRule.K_DISCOURAGED:
      return JavaCore.ENABLED.equals(
          JavaCore.getOption(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK));
    default:
      return false;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:TypeFilter.java

示例4: addRules

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
/**
 * Adds the access rules to each list in the given collection. If the last rule in a given
 * collection is the wild card pattern then no more rules are added to that collection.
 *
 * @param accessRules the list of {@link org.eclipse.jdt.core.IAccessRule}s
 * @param collect the array of lists to collect the {@link org.eclipse.jdt.core.IAccessRule}s in
 */
private void addRules(IAccessRule[][] accessRules, ArrayList<List<IAccessRule>> collect) {
  for (int i = 0; i < accessRules.length; i++) {
    IAccessRule[] libRules = accessRules[i];
    List<IAccessRule> list = collect.get(i);
    // if the last rule is a **/* pattern, don't add any more rules, as they will have no effect
    if (!list.isEmpty()) {
      IAccessRule lastRule = list.get(list.size() - 1);
      if (lastRule.getPattern().equals(ALL_PATTERN)) {
        continue;
      }
    }
    for (int j = 0; j < libRules.length; j++) {
      list.add(libRules[j]);
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:ExecutionEnvironment.java

示例5: equals

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
  IAccessRule[][] rules = null;
  if (obj instanceof RuleEntry) {
    rules = ((RuleEntry) obj).fRules;
  }
  if (obj instanceof IAccessRule[][]) {
    rules = (IAccessRule[][]) obj;
  }
  if (fRules == rules) {
    return true;
  }
  if (rules != null) {
    if (fRules.length == rules.length) {
      for (int i = 0; i < fRules.length; i++) {
        if (!rulesEqual(fRules[i], rules[i])) {
          return false;
        }
      }
      return true;
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:JREContainer.java

示例6: canEdit

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private boolean canEdit(List<Object> list) {
	if (list.size() != 1)
		return false;

	Object firstElement= list.get(0);
	if (firstElement instanceof IAccessRule)
		return false;
	if (firstElement instanceof CPListElementAttribute) {
		CPListElementAttribute attrib= (CPListElementAttribute) firstElement;
		if (!attrib.isBuiltIn()) {
			ClasspathAttributeConfiguration config= fAttributeDescriptors.get(attrib.getKey());
			return config != null && config.canEdit(attrib.getClasspathAttributeAccess());
		}
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:UserLibraryPreferencePage.java

示例7: removeEntry

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private void removeEntry() {
	List<Object> selElements= fProjectsList.getSelectedElements();
	for (int i= selElements.size() - 1; i >= 0 ; i--) {
		Object elem= selElements.get(i);
		if (elem instanceof CPListElementAttribute) {
			CPListElementAttribute attrib= (CPListElementAttribute) elem;
			if (attrib.isBuiltIn()) {
				String key= attrib.getKey();
				Object value= null;
				if (key.equals(CPListElement.ACCESSRULES)) {
					value= new IAccessRule[0];
				}
				attrib.getParent().setAttribute(key, value);
			} else {
				removeCustomAttribute(attrib);
			}
			selElements.remove(i);
		}
	}
	if (selElements.isEmpty()) {
		fProjectsList.refresh();
		fClassPathList.dialogFieldChanged(); // validate
	} else {
		fProjectsList.removeElements(selElements);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:ProjectsWorkbookPage.java

示例8: getText

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
@Override
public String getText(Object element) {
	if (element instanceof CPListElement) {
		return getCPListElementText((CPListElement) element);
	} else if (element instanceof CPListElementAttribute) {
		CPListElementAttribute attribute= (CPListElementAttribute) element;
		String text= getCPListElementAttributeText(attribute);
		if (attribute.isNonModifiable()) {
			return Messages.format(NewWizardMessages.CPListLabelProvider_non_modifiable_attribute, text);
		}
		return text;
	} else if (element instanceof CPUserLibraryElement) {
		return getCPUserLibraryText((CPUserLibraryElement) element);
	} else if (element instanceof IAccessRule) {
		IAccessRule rule= (IAccessRule) element;
		return Messages.format(NewWizardMessages.CPListLabelProvider_access_rules_label, new String[] { AccessRulesLabelProvider.getResolutionLabel(rule.getKind()), BasicElementLabels.getPathLabel(rule.getPattern(), false)});
	}
	return super.getText(element);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:CPListLabelProvider.java

示例9: category

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
@Override
public int category(Object obj) {
	if (obj instanceof CPListElement) {
		CPListElement element= (CPListElement) obj;
		if (element.getParentContainer() != null) {
			return CONTAINER_ENTRY;
		}
		switch (element.getEntryKind()) {
		case IClasspathEntry.CPE_LIBRARY:
			return LIBRARY;
		case IClasspathEntry.CPE_PROJECT:
			return PROJECT;
		case IClasspathEntry.CPE_SOURCE:
			return SOURCE;
		case IClasspathEntry.CPE_VARIABLE:
			return VARIABLE;
		case IClasspathEntry.CPE_CONTAINER:
			return CONTAINER;
		}
	} else if (obj instanceof CPListElementAttribute) {
		return ATTRIBUTE;
	} else if (obj instanceof IAccessRule) {
		return ATTRIBUTE;
	}
	return OTHER;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:CPListElementSorter.java

示例10: acceptUnresolvedName

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
public void acceptUnresolvedName(char[] name) {
	int relevance = computeBaseRelevance();
	relevance += computeRelevanceForResolution(false);
	relevance += computeRelevanceForInterestingProposal();
	relevance += computeRelevanceForCaseMatching(this.completionToken, name);
	relevance += computeRelevanceForQualification(false);
	relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for local variable
	CompletionEngine.this.noProposal = false;
	if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
		InternalCompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.LOCAL_VARIABLE_REF, CompletionEngine.this.actualCompletionPosition);
		proposal.setSignature(JAVA_LANG_OBJECT_SIGNATURE);
		proposal.setPackageName(JAVA_LANG_NAME);
		proposal.setTypeName(OBJECT);
		proposal.setName(name);
		proposal.setCompletion(name);
		proposal.setFlags(Flags.AccDefault);
		proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
		proposal.setTokenRange(this.tokenStart - this.offset, this.tokenEnd - this.offset);
		proposal.setRelevance(relevance);
		CompletionEngine.this.requestor.accept(proposal);
		if(DEBUG) {
			CompletionEngine.this.printDebug(proposal);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:CompletionEngine.java

示例11: writeAccessRules

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private void writeAccessRules(IvyClasspathContainerImpl ivycp, Document document, Node cpEntryNode,
        IAccessRule[] accessRules) {
    if (accessRules == null) {
        return;
    }
    Node accessRulesNode = document.createElement(ACCESS_RULES);
    cpEntryNode.appendChild(accessRulesNode);

    for (IAccessRule accessRule : accessRules) {
        Node accessRuleNode = document.createElement(RULE);
        accessRulesNode.appendChild(accessRuleNode);

        NamedNodeMap attributes = accessRuleNode.getAttributes();
        Attr attr = document.createAttribute(PATTERN);
        attr.setValue(accessRule.getPattern().toString());
        attributes.setNamedItem(attr);

        attr = document.createAttribute(KIND);
        attr.setValue(Integer.toString(accessRule.getKind()));
        attributes.setNamedItem(attr);

    }
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:24,代码来源:IvyClasspathContainerSerializer.java

示例12: doBuildEntry

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private IClasspathEntry doBuildEntry(ArtifactDownloadReport artifact, IPath classpathArtifact,
        IAccessRule[] rules) {
    IPath sourcesArtifact = getArtifactPath(artifact, sourceArtifactMatcher,
        mapping.isMapIfOnlyOneSource(), "");
    IPath javadocArtifact = getArtifactPath(artifact, javadocArtifactMatcher,
        mapping.isMapIfOnlyOneJavadoc(), "");
    IPath sources = attachmentManager.getSourceAttachment(classpathArtifact, sourcesArtifact);
    IPath sourcesRoot = attachmentManager.getSourceAttachmentRoot(classpathArtifact,
        sourcesArtifact);
    IClasspathAttribute[] att = getExtraAttribute(classpathArtifact, javadocArtifact);

    if (sources != null) {
        IvyDEMessage.debug("Attaching sources " + sources + " to " + classpathArtifact);
    }
    if (javadocArtifact != null) {
        IvyDEMessage.debug("Attaching javadoc " + javadocArtifact + " to " + classpathArtifact);
    }
    if (rules != null) {
        IvyDEMessage.debug("Setting OSGi access rules on  " + classpathArtifact);
    }
    return JavaCore.newLibraryEntry(classpathArtifact, sources, sourcesRoot, rules, att, false);
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:23,代码来源:IvyClasspathContainerMapper.java

示例13: addJunit4ToClasspath

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private static void addJunit4ToClasspath(IProject newProject, IProgressMonitor monitor)
    throws CoreException {
  IClasspathAttribute nonDependencyAttribute =
      UpdateClasspathAttributeUtil.createNonDependencyAttribute();
  IClasspathEntry junit4Container = JavaCore.newContainerEntry(
      JUnitCore.JUNIT4_CONTAINER_PATH,
      new IAccessRule[0],
      new IClasspathAttribute[] {nonDependencyAttribute},
      false);
  ClasspathUtil.addClasspathEntry(newProject, junit4Container, monitor);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:12,代码来源:CreateAppEngineWtpProject.java

示例14: setUp

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
@Before
public void setUp() throws IOException, CoreException {
  serializedContainer = loadFile("testdata/serializedContainer.json");
  
  List<IClasspathEntry> classpathEntries = Arrays.asList(
      newClasspathEntry(IClasspathEntry.CPE_LIBRARY, "/test/path/to/jar",
          "/test/path/to/src", new IClasspathAttribute[] {newAttribute("attrName", "attrValue")},
          new IAccessRule[] {newAccessRule("/com/example/accessible", true /* accessible */),
              newAccessRule("/com/example/nonaccessible", false /* accessible */)},
          true));

  doAnswer(new Answer<Void>() {
    @Override
    public Void answer(InvocationOnMock invocation) throws Throwable {
      IJavaProject project = invocation.getArgumentAt(0, IJavaProject.class);
      String fileId = invocation.getArgumentAt(1, String.class);
      IPath path = stateLocationProvider.getContainerStateFile(project, fileId, false);
      if (path != null && path.toFile() != null) {
        path.toFile().delete();
      }
      return null;
    }
  }).when(stateLocationProvider).removeContainerStateFile(any(IJavaProject.class), anyString());

  when(binaryBaseLocationProvider.getBaseLocation()).thenReturn(new Path("/test"));
  when(sourceBaseLocationProvider.getBaseLocation()).thenReturn(new Path("/test"));
  MavenCoordinates coordinates = new MavenCoordinates.Builder()
      .setGroupId("com.google").setArtifactId("jarartifact").build();
  LibraryFile libraryFile = new LibraryFile(coordinates);
  List<LibraryFile> libraryFiles = new ArrayList<>();
  libraryFiles.add(libraryFile);
  container = new LibraryClasspathContainer(new Path(CONTAINER_PATH), CONTAINER_DESCRIPTION,
      classpathEntries, libraryFiles);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:35,代码来源:LibraryClasspathContainerSerializerTest.java

示例15: compare

import org.eclipse.jdt.core.IAccessRule; //导入依赖的package包/类
private static void compare(LibraryClasspathContainer expected,
    LibraryClasspathContainer actual) {
  assertEquals(expected.getPath(), actual.getPath());
  assertEquals(expected.getKind(), actual.getKind());
  assertEquals(expected.getDescription(), actual.getDescription());
  for (int i = 0; i < expected.getClasspathEntries().length; i++) {
    IClasspathEntry classpathEntry = expected.getClasspathEntries()[i];
    IClasspathEntry otherClasspathEntry = actual.getClasspathEntries()[i];
    assertEquals(classpathEntry.getPath(), otherClasspathEntry.getPath());
    assertEquals(classpathEntry.getEntryKind(), otherClasspathEntry.getEntryKind());
    assertEquals(classpathEntry.getSourceAttachmentPath(),
        otherClasspathEntry.getSourceAttachmentPath());
    assertEquals(classpathEntry.isExported(), otherClasspathEntry.isExported());
    for (int j = 0; j < classpathEntry.getAccessRules().length; j++) {
      IAccessRule accessRule = classpathEntry.getAccessRules()[j];
      IAccessRule otherAccessRule = otherClasspathEntry.getAccessRules()[j];
      assertEquals(accessRule.getKind(), otherAccessRule.getKind());
      assertEquals(accessRule.getPattern(), otherAccessRule.getPattern());
    }
    for (int k = 0; k < classpathEntry.getExtraAttributes().length; k++) {
      IClasspathAttribute classpathAttribute = classpathEntry.getExtraAttributes()[k];
      IClasspathAttribute otherClasspathAttribute = otherClasspathEntry.getExtraAttributes()[k];
      assertEquals(classpathAttribute.getName(), otherClasspathAttribute.getName());
      assertEquals(classpathAttribute.getValue(), otherClasspathAttribute.getValue());
    }
  }
  
  List<LibraryFile> libraryFiles = actual.getLibraryFiles();
  if (libraryFiles.size() != 0) {
    for (int i = 0; i < libraryFiles.size(); i++) {
      assertEquals(libraryFiles.get(i), actual.getLibraryFiles().get(i));
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:35,代码来源:LibraryClasspathContainerSerializerTest.java


注:本文中的org.eclipse.jdt.core.IAccessRule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。