本文整理汇总了Java中com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor.addRoot方法的典型用法代码示例。如果您正苦于以下问题:Java LibraryEditor.addRoot方法的具体用法?Java LibraryEditor.addRoot怎么用?Java LibraryEditor.addRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor
的用法示例。
在下文中一共展示了LibraryEditor.addRoot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNewLibrary
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, VirtualFile contextDirectory) {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, false, true, false, false, true);
descriptor.setTitle(IdeBundle.message("new.library.file.chooser.title"));
descriptor.setDescription(IdeBundle.message("new.library.file.chooser.description"));
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, parentComponent, null, contextDirectory);
if (files.length == 0) {
return null;
}
return new NewLibraryConfiguration(myDefaultLibraryName, getDownloadableLibraryType(), new LibraryVersionProperties()) {
@Override
public void addRoots(@NotNull LibraryEditor editor) {
for (VirtualFile file : files) {
editor.addRoot(file, OrderRootType.CLASSES);
}
}
};
}
示例2: fillLibrary
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
@Override
protected void fillLibrary(String path, LibraryEditor libraryEditor) {
File srcRoot = new File(path + "/src/main");
if (srcRoot.exists()) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(srcRoot), OrderRootType.SOURCES);
}
File[] jars;
File libDir = new File(path + "/lib");
if (libDir.exists()) {
jars = libDir.listFiles();
} else {
jars = new File(path + "/embeddable").listFiles();
}
if (jars != null) {
for (File file : jars) {
if (file.getName().endsWith(".jar")) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
}
}
}
}
示例3: fillLibrary
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
@Override
protected void fillLibrary(String path, LibraryEditor libraryEditor) {
File srcRoot = new File(path + "/src/main");
if (srcRoot.exists()) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(srcRoot), OrderRootType.SOURCES);
}
// Add Gant jars
File lib = new File(path + "/lib");
File[] jars = lib.exists() ? lib.listFiles() : new File[0];
if (jars != null) {
for (File file : jars) {
if (file.getName().endsWith(".jar")) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
}
}
}
}
示例4: addSources
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
private static void addSources(LibraryEditor libraryEditor, File srcRoot) {
File compilerSrc = new File(srcRoot, "Compiler/src");
if (compilerSrc.exists()) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(compilerSrc), OrderRootType.SOURCES);
}
File stdLibSrc = new File(srcRoot, "StdLib/src");
if (stdLibSrc.exists()) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(stdLibSrc), OrderRootType.SOURCES);
}
File mainSrc = new File(srcRoot, "main");
if (mainSrc.exists()) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(mainSrc), OrderRootType.SOURCES);
}
}
示例5: createNewLibrary
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent jComponent, @Nullable VirtualFile virtualFile,
@NotNull Project project) {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createAllButJarContentsDescriptor();
descriptor.setTitle(LuaBundle.message("new.library.file.chooser.title"));
descriptor.setDescription(LuaBundle.message("new.library.file.chooser.description"));
final VirtualFile[] files = FileChooser.chooseFiles(descriptor, jComponent, project, virtualFile);
if (files.length == 0) {
return null;
}
return new NewLibraryConfiguration("Lua Library", this, new DummyLibraryProperties()) {
@Override
public void addRoots(@NotNull LibraryEditor editor) {
for (VirtualFile file : files) {
editor.addRoot(file, OrderRootType.CLASSES);
}
}
};
}
示例6: addRoots
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
@Override
public void addRoots(@NotNull LibraryEditor editor)
{
final List<File> libs = muleSdk.getLibraryEntries();
for (File file : libs)
{
editor.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
}
}
示例7: fillLibrary
import com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor; //导入方法依赖的package包/类
@Override
protected void fillLibrary(String path, LibraryEditor libraryEditor) {
File lib = new File(path + "/lib");
File[] jars = lib.exists() ? lib.listFiles() : new File[0];
if (jars != null) {
for (File file : jars) {
if (file.getName().endsWith(".jar")) {
libraryEditor.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
}
}
}
}