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


Java RootPolicy类代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:LibraryDataService.java

示例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);
	}
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:13,代码来源:DotNetLibraryOrderEntryImpl.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:InheritedJdkTest.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JpsInheritedSdkOrderEntry.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JpsModuleSdkOrderEntry.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JpsLibraryOrderEntry.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JpsModuleOrderEntry.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ModuleJdkOrderEntryImpl.java

示例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();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:49,代码来源:DirectoryInfo.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:UnknownOrderEntryImpl.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ModuleExtensionWithSdkOrderEntryImpl.java


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