本文整理汇总了Java中com.intellij.openapi.roots.libraries.ui.OrderRoot类的典型用法代码示例。如果您正苦于以下问题:Java OrderRoot类的具体用法?Java OrderRoot怎么用?Java OrderRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrderRoot类属于com.intellij.openapi.roots.libraries.ui包,在下文中一共展示了OrderRoot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLibraryFromRoots
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
private Library createLibraryFromRoots(List<OrderRoot> roots, @Nullable final LibraryType libraryType) {
final PersistentLibraryKind kind = libraryType == null ? null : libraryType.getKind();
final Library library = myModuleLibrariesModel.createLibrary(null, kind);
final LibraryEx.ModifiableModelEx libModel = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
if (myDefaultPropertiesFactory != null) {
libModel.setProperties(myDefaultPropertiesFactory.fun(libraryType));
}
for (OrderRoot root : roots) {
if (root.isJarDirectory()) {
libModel.addJarDirectory(root.getFile(), false, root.getType());
}
else {
libModel.addRoot(root.getFile(), root.getType());
}
}
libModel.commit();
return library;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CreateModuleLibraryChooser.java
示例2: findModule
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Nullable
private Module findModule(List<OrderRoot> roots) {
for (OrderRoot root : roots) {
Module module = null;
final VirtualFile local = JarFileSystem.getInstance().getVirtualFileForJar(root.getFile());
if (local != null) {
module = ModuleUtil.findModuleForFile(local, myProject);
}
if (module == null) {
module = ModuleUtil.findModuleForFile(root.getFile(), myProject);
}
if (module != null) {
return module;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CreateLibraryFromFilesDialog.java
示例3: createLibraryFromFiles
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Override
public NewLibraryConfiguration createLibraryFromFiles(@NotNull LibraryRootsComponentDescriptor descriptor,
@NotNull JComponent parentComponent,
@Nullable VirtualFile contextDirectory,
LibraryType<?> type,
final Project project) {
final FileChooserDescriptor chooserDescriptor = descriptor.createAttachFilesChooserDescriptor(null);
chooserDescriptor.setTitle("Select Library Files");
final VirtualFile[] rootCandidates = FileChooser.chooseFiles(chooserDescriptor, parentComponent, project, contextDirectory);
if (rootCandidates.length == 0) {
return null;
}
final List<OrderRoot> roots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, project, descriptor);
if (roots.isEmpty()) return null;
String name = suggestLibraryName(roots);
return doCreate(type, name, roots);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LibraryTypeServiceImpl.java
示例4: addJavaDocAndSources
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
private static boolean addJavaDocAndSources(@NotNull List<OrderRoot> orderRoots, @NotNull VirtualFile dir) {
boolean found = false;
VirtualFile javadocDir = findJavadocDir(dir);
if (javadocDir != null) {
orderRoots.add(new OrderRoot(javadocDir, JavadocOrderRootType.getInstance()));
found = true;
}
VirtualFile sourcesDir = dir.findChild(FD_SOURCES);
if (sourcesDir != null) {
orderRoots.add(new OrderRoot(sourcesDir, SOURCES));
found = true;
}
return found;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidSdkUtils.java
示例5: actionPerformed
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = getEventProject(e);
if (project == null) return;
if (!Projects.isGradleProject(project)) {
myDelegate.actionPerformed(e);
return;
}
final List<VirtualFile> jars = getRoots(e);
if (jars.isEmpty()) {
return;
}
final List<OrderRoot> roots = RootDetectionUtil.detectRoots(jars, null, project, new DefaultLibraryRootsComponentDescriptor());
new CreateGradleLibraryFromFilesDialog(project, roots).show();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CreateLibraryFromFilesAction.java
示例6: CreateGradleLibraryFromFilesDialog
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
public CreateGradleLibraryFromFilesDialog(@NotNull Project project, @NotNull List<OrderRoot> roots) {
super(project, true);
setTitle(COMMAND_TITLE);
myProject = project;
myRoots = roots;
mySettingsFile = GradleSettingsFile.get(myProject);
final FormBuilder builder = LibraryNameAndLevelPanel.createFormBuilder();
myModulesComboBox = new ModulesComboBox();
myModulesComboBox.fillModules(myProject);
myModulesComboBox.setSelectedModule(findModule(roots));
for (Iterator iter = ((SortedListModel)myModulesComboBox.getModel()).iterator(); iter.hasNext(); ) {
Module module = (Module)iter.next();
String path = GradleSettingsFile.getModuleGradlePath(module);
if (path == null || !mySettingsFile.hasBuildFile(path)) {
iter.remove();
}
}
builder.addLabeledComponent("&Add to module:", myModulesComboBox);
myPanel = builder.getPanel();
init();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CreateLibraryFromFilesAction.java
示例7: findModule
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Nullable
private Module findModule(List<OrderRoot> roots) {
for (OrderRoot root : roots) {
Module module = null;
final VirtualFile local = JarFileSystem.getInstance().getVirtualFileForJar(root.getFile());
if (local != null) {
module = ModuleUtilCore.findModuleForFile(local, myProject);
}
if (module == null) {
module = ModuleUtilCore.findModuleForFile(root.getFile(), myProject);
}
if (module != null) {
return module;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CreateLibraryFromFilesAction.java
示例8: resolveAndDownload
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
public static NewLibraryConfiguration resolveAndDownload(final Project project,
final String coord,
boolean attachJavaDoc,
boolean attachSources,
@Nullable final String copyTo,
List<MavenRepositoryInfo> repositories) {
RepositoryLibraryProperties libraryProperties = new RepositoryLibraryProperties(coord);
final List<OrderRoot> roots = MavenDependenciesRemoteManager.getInstance(project)
.downloadDependenciesModal(libraryProperties, attachSources, attachJavaDoc, copyTo);
if (roots == null || roots.size() == 0) {
return null;
}
notifyArtifactsDownloaded(project, roots);
RepositoryLibraryDescription libraryDescription = RepositoryLibraryDescription.findDescription(libraryProperties);
return new NewLibraryConfiguration(
libraryDescription.getDisplayName(libraryProperties.getVersion()),
RepositoryLibraryType.getInstance(),
new RepositoryLibraryProperties(coord)) {
@Override
public void addRoots(@NotNull LibraryEditor editor) {
editor.addRoots(roots);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RepositoryAttachHandler.java
示例9: getLibraryRootsForVersion
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@NotNull
private static List<OrderRoot> getLibraryRootsForVersion(@Nullable final DefracVersion defracVersion) {
if(defracVersion == null) {
return Collections.emptyList();
}
final List<OrderRoot> result = Lists.newLinkedList();
for(final VirtualFile library : defracVersion.getLibraries()) {
result.add(new OrderRoot(library, OrderRootType.CLASSES));
}
for(final DefracPlatform platform : DefracPlatform.values()) {
final VirtualFile javadoc =
VirtualFileManager.getInstance().
findFileByUrl(getJavadocUrl(defracVersion, platform));
if(null != javadoc) {
result.add(new OrderRoot(javadoc, JavadocOrderRootType.getInstance()));
}
}
return result;
}
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:25,代码来源:DefracSdkUtil.java
示例10: createLibraryFromRoots
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
private Library createLibraryFromRoots(List<OrderRoot> roots, @Nullable final LibraryType libraryType) {
final PersistentLibraryKind kind = libraryType == null ? null : libraryType.getKind();
final Library library = ((LibraryTableBase.ModifiableModelEx)myModuleLibrariesModel).createLibrary(null, kind);
final LibraryEx.ModifiableModelEx libModel = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
if (myDefaultPropertiesFactory != null) {
libModel.setProperties(myDefaultPropertiesFactory.fun(libraryType));
}
for (OrderRoot root : roots) {
if (root.isJarDirectory()) {
libModel.addJarDirectory(root.getFile(), false, root.getType());
}
else {
libModel.addRoot(root.getFile(), root.getType());
}
}
libModel.commit();
return library;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:CreateModuleLibraryChooser.java
示例11: attachLibrary
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Nullable
public static NewLibraryConfiguration attachLibrary(final @NotNull Project project,
List<DeftRegistryEntryInfo> registryEntries) {
final Ref<NewLibraryConfiguration> result = Ref.create(null);
for (DeftRegistryEntryInfo registryEntry : registryEntries) {
AccessToken accessToken = WriteAction.start();
try {
final List<OrderRoot> roots = createRoots(registryEntry);
result.set(new NewLibraryConfiguration(registryEntry.getLibraryName(),
DeftLibraryType.getInstance(),
new DeftLibraryProperties(registryEntry.getLibraryName())) {
@Override
public void addRoots(@NotNull LibraryEditor editor) {
editor.addRoots(roots);
}
});
} finally {
accessToken.finish();
}
}
return result.get();
}
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:26,代码来源:LibraryAttachHandler.java
示例12: createLibraryFromRoots
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
private Library createLibraryFromRoots(ModifiableModuleRootLayer layer, List<OrderRoot> roots, @Nullable final LibraryType libraryType) {
final LibraryTable.ModifiableModel moduleLibraryModel = layer.getModuleLibraryTable().getModifiableModel();
final PersistentLibraryKind kind = libraryType == null ? null : libraryType.getKind();
final Library library = ((LibraryTableBase.ModifiableModelEx)moduleLibraryModel).createLibrary(null, kind);
final LibraryEx.ModifiableModelEx libModel = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
for (OrderRoot root : roots) {
if (root.isJarDirectory()) {
libModel.addJarDirectory(root.getFile(), false, root.getType());
}
else {
libModel.addRoot(root.getFile(), root.getType());
}
}
libModel.commit();
return library;
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:FileOrDirectoryDependencyTabContext.java
示例13: createLibraryFromFiles
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Override
public NewLibraryConfiguration createLibraryFromFiles(@Nonnull LibraryRootsComponentDescriptor descriptor,
@Nonnull JComponent parentComponent,
@Nullable VirtualFile contextDirectory,
LibraryType<?> type,
final Project project) {
final FileChooserDescriptor chooserDescriptor = descriptor.createAttachFilesChooserDescriptor(null);
chooserDescriptor.setTitle("Select Library Files");
final VirtualFile[] rootCandidates = FileChooser.chooseFiles(chooserDescriptor, parentComponent, project, contextDirectory);
if (rootCandidates.length == 0) {
return null;
}
final List<OrderRoot> roots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, project, descriptor);
if (roots.isEmpty()) return null;
String name = suggestLibraryName(roots);
return doCreate(type, name, roots);
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:LibraryTypeServiceImpl.java
示例14: createLibrary
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Override
public Library createLibrary(@NotNull @NonNls String name,
@NotNull LibraryLevel level,
@NotNull Collection<? extends OrderRoot> roots) {
final NewLibraryEditor editor = new NewLibraryEditor();
editor.setName(name);
editor.addRoots(roots);
return createLibrary(editor, level);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:LibrariesContainerFactory.java
示例15: addRoots
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Override
public void addRoots(Collection<? extends OrderRoot> roots) {
for (OrderRoot root : roots) {
if (root.isJarDirectory()) {
addJarDirectory(root.getFile(), false, root.getType());
}
else {
addRoot(root.getFile(), root.getType());
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:LibraryEditorBase.java
示例16: scanAndSelectDetectedJavaSourceRoots
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
/**
* This method takes a candidates for the project root, then scans the candidates and
* if multiple candidates or non root source directories are found whithin some
* directories, it shows a dialog that allows selecting or deselecting them.
* @param parent a parent parent or project
* @param rootCandidates a candidates for roots
* @return a array of source folders or empty array if non was selected or dialog was canceled.
*/
public static VirtualFile[] scanAndSelectDetectedJavaSourceRoots(Component parentComponent, final VirtualFile[] rootCandidates) {
final List<OrderRoot> orderRoots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, null,
new LibraryRootsDetectorImpl(Collections.singletonList(JAVA_SOURCE_ROOT_DETECTOR)),
new OrderRootType[0]);
final List<VirtualFile> result = new ArrayList<VirtualFile>();
for (OrderRoot root : orderRoots) {
result.add(root.getFile());
}
return VfsUtil.toVirtualFileArray(result);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PathUIUtils.java
示例17: filterAlreadyAdded
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
private List<OrderRoot> filterAlreadyAdded(final List<OrderRoot> roots) {
if (roots == null || roots.isEmpty()) {
return Collections.emptyList();
}
final List<OrderRoot> result = new ArrayList<OrderRoot>();
final Library[] libraries = myModuleLibrariesModel.getLibraries();
for (OrderRoot root : roots) {
if (!isIncluded(root, libraries)) {
result.add(root);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CreateModuleLibraryChooser.java
示例18: isIncluded
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
private static boolean isIncluded(OrderRoot root, Library[] libraries) {
for (Library library : libraries) {
if (ArrayUtil.contains(root.getFile(), library.getFiles(root.getType()))) {
return true;
}
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CreateModuleLibraryChooser.java
示例19: actionPerformed
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = getEventProject(e);
if (project == null) return;
final List<VirtualFile> jars = getRoots(e);
if (jars.isEmpty()) return;
final List<OrderRoot> roots = RootDetectionUtil.detectRoots(jars, null, project, new DefaultLibraryRootsComponentDescriptor());
new CreateLibraryFromFilesDialog(project, roots).show();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MarkLibraryRootAction.java
示例20: detectRoots
import com.intellij.openapi.roots.libraries.ui.OrderRoot; //导入依赖的package包/类
@NotNull
public static List<OrderRoot> detectRoots(@NotNull final Collection<VirtualFile> rootCandidates,
@Nullable Component parentComponent,
@Nullable Project project,
@NotNull final LibraryRootsComponentDescriptor rootsComponentDescriptor) {
return detectRoots(rootCandidates, parentComponent, project, rootsComponentDescriptor.getRootsDetector(),
rootsComponentDescriptor.getRootTypes());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:RootDetectionUtil.java
注:本文中的com.intellij.openapi.roots.libraries.ui.OrderRoot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论