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


Java LibraryEditor.addRoot方法代码示例

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

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

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

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

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

示例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);
    }
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:10,代码来源:MuleLibraryDescription.java

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


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