本文整理汇总了Java中com.intellij.openapi.roots.RootPolicy类的典型用法代码示例。如果您正苦于以下问题:Java RootPolicy类的具体用法?Java RootPolicy怎么用?Java RootPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RootPolicy类属于com.intellij.openapi.roots包,在下文中一共展示了RootPolicy类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isOrphanProjectLibrary
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
private static boolean isOrphanProjectLibrary(@NotNull final Library library,
@NotNull final IdeModifiableModelsProvider modelsProvider) {
RootPolicy<Boolean> visitor = new RootPolicy<Boolean>() {
@Override
public Boolean visitLibraryOrderEntry(LibraryOrderEntry ideDependency, Boolean value) {
return !ideDependency.isModuleLevel() && library == ideDependency.getLibrary();
}
};
for (Module module : modelsProvider.getModules()) {
for (OrderEntry entry : modelsProvider.getOrderEntries(module)) {
if (entry.accept(visitor, false)) return false;
}
}
return true;
}
示例2: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(RootPolicy<R> rRootPolicy, @Nullable R r)
{
if(rRootPolicy instanceof DotNetRootPolicy)
{
return (R) ((DotNetRootPolicy) rRootPolicy).visitDotNetLibrary(this, r);
}
else
{
return rRootPolicy.visitOrderEntry(this, r);
}
}
示例3: test2
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
public void test2() throws Exception {
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
ModuleRootModificationUtil.setSdkInherited(myModule);
assertTrue("JDK is inherited after inheritSdk()", rootManager.isSdkInherited());
assertNull("No JDK assigned", rootManager.getSdk());
final Sdk mockJdk = IdeaTestUtil.getMockJdk17("mock 1.4");
ApplicationManager.getApplication().runWriteAction(() -> {
ProjectJdkTable.getInstance().addJdk(mockJdk);
});
final ProjectRootManagerEx projectRootManager = ProjectRootManagerEx.getInstanceEx(myProject);
ApplicationManager.getApplication().runWriteAction(() -> {
projectRootManager.setProjectSdk(mockJdk);
});
assertTrue(rootManager.isSdkInherited());
assertEquals("mockJdk inherited", mockJdk, rootManager.getSdk());
ApplicationManager.getApplication().runWriteAction(() -> {
projectRootManager.setProjectSdkName("jdk1");
});
assertTrue(rootManager.isSdkInherited());
Assert.assertEquals("Correct non-existing JDK inherited", "jdk1",
rootManager.orderEntries().process(new RootPolicy<String>() {
@Override
public String visitInheritedJdkOrderEntry(InheritedJdkOrderEntry inheritedJdkOrderEntry, String s) {
return inheritedJdkOrderEntry.getJdkName();
}
}, null));
assertNull("Non-existing JDK", rootManager.getSdk());
final Sdk jdk1 = IdeaTestUtil.getMockJdk17("jdk1");
ApplicationManager.getApplication().runWriteAction(() -> {
ProjectJdkTable.getInstance().addJdk(jdk1);
});
assertTrue(rootManager.isSdkInherited());
assertNotNull("JDK appeared", rootManager.getSdk());
assertEquals("jdk1 found", jdk1, rootManager.getSdk());
}
示例4: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
return policy.visitInheritedJdkOrderEntry(this, initialValue);
}
示例5: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
return policy.visitModuleJdkOrderEntry(this, initialValue);
}
示例6: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
return policy.visitLibraryOrderEntry(this, initialValue);
}
示例7: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
return policy.visitModuleOrderEntry(this, initialValue);
}
示例8: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(@NotNull RootPolicy<R> policy, R initialValue) {
return policy.visitModuleJdkOrderEntry(this, initialValue);
}
示例9: createFakeOrderEntry
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@NotNull
private static OrderEntry createFakeOrderEntry(@NotNull final Module ownerModule) {
return new OrderEntry() {
@NotNull
@Override
public VirtualFile[] getFiles(OrderRootType type) {
throw new IncorrectOperationException();
}
@NotNull
@Override
public String[] getUrls(OrderRootType rootType) {
throw new IncorrectOperationException();
}
@NotNull
@Override
public String getPresentableName() {
throw new IncorrectOperationException();
}
@Override
public boolean isValid() {
throw new IncorrectOperationException();
}
@NotNull
@Override
public Module getOwnerModule() {
return ownerModule;
}
@Override
public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
throw new IncorrectOperationException();
}
@Override
public int compareTo(OrderEntry o) {
throw new IncorrectOperationException();
}
@Override
public boolean isSynthetic() {
throw new IncorrectOperationException();
}
};
}
示例10: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(RootPolicy<R> policy, @Nullable R initialValue) {
return policy.visitOrderEntry(this, initialValue);
}
示例11: accept
import com.intellij.openapi.roots.RootPolicy; //导入依赖的package包/类
@Override
public <R> R accept(@Nonnull RootPolicy<R> policy, R initialValue) {
return policy.visitModuleExtensionSdkOrderEntry(this, initialValue);
}