本文整理汇总了Java中com.intellij.openapi.roots.libraries.LibraryType类的典型用法代码示例。如果您正苦于以下问题:Java LibraryType类的具体用法?Java LibraryType怎么用?Java LibraryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LibraryType类属于com.intellij.openapi.roots.libraries包,在下文中一共展示了LibraryType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Override
public Library createLibrary(@NotNull NewLibraryEditor libraryEditor,
@NotNull LibraryLevel level) {
LibraryTableModifiableModelProvider provider = getProvider(level);
if (provider == null) {
LOG.error("cannot create module library in this context");
}
LibraryTable.ModifiableModel model = provider.getModifiableModel();
final LibraryType<?> type = libraryEditor.getType();
Library library = model.createLibrary(getUniqueLibraryName(libraryEditor.getName(), model), type == null ? null : type.getKind());
ExistingLibraryEditor createdLibraryEditor = ((LibrariesModifiableModel)model).getLibraryEditor(library);
createdLibraryEditor.setProperties(libraryEditor.getProperties());
libraryEditor.applyTo(createdLibraryEditor);
return library;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LibrariesContainerFactory.java
示例2: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Nullable
public static Library createLibrary(@Nullable final LibraryType type, @NotNull final JComponent parentComponent,
@NotNull final Project project, @NotNull final LibrariesModifiableModel modifiableModel) {
final NewLibraryConfiguration configuration = createNewLibraryConfiguration(type, parentComponent, project);
if (configuration == null) return null;
final LibraryType<?> libraryType = configuration.getLibraryType();
final Library library = modifiableModel.createLibrary(
LibraryEditingUtil.suggestNewLibraryName(modifiableModel, configuration.getDefaultLibraryName()),
libraryType != null ? libraryType.getKind() : null);
final NewLibraryEditor editor = new NewLibraryEditor(libraryType, configuration.getProperties());
configuration.addRoots(editor);
final Library.ModifiableModel model = library.getModifiableModel();
editor.applyTo((LibraryEx.ModifiableModelEx)model);
AccessToken token = WriteAction.start();
try {
model.commit();
}
finally {
token.finish();
}
return library;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CreateNewLibraryAction.java
示例3: LibraryRootsComponent
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
public LibraryRootsComponent(@Nullable Project project, @NotNull Computable<LibraryEditor> libraryEditorComputable) {
myProject = project;
myLibraryEditorComputable = libraryEditorComputable;
final LibraryEditor editor = getLibraryEditor();
final LibraryType type = editor.getType();
if (type != null) {
myDescriptor = type.createLibraryRootsComponentDescriptor();
//noinspection unchecked
myPropertiesEditor = type.createPropertiesEditor(this);
if (myPropertiesEditor != null) {
myPropertiesPanel.add(myPropertiesEditor.createComponent(), BorderLayout.CENTER);
}
}
if (myDescriptor == null) {
myDescriptor = new DefaultLibraryRootsComponentDescriptor();
}
init(new LibraryTreeStructure(this, myDescriptor));
updatePropertiesLabel();
onRootsChanged();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LibraryRootsComponent.java
示例4: chooseTypeAndCreate
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
public static void chooseTypeAndCreate(final ClasspathPanel classpathPanel,
final StructureConfigurableContext context,
final JButton contextButton, @NotNull final LibraryCreatedCallback callback) {
if (LibraryEditingUtil.hasSuitableTypes(classpathPanel)) {
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(LibraryEditingUtil.createChooseTypeStep(classpathPanel, new ParameterizedRunnable<LibraryType>() {
@Override
public void run(LibraryType libraryType) {
doCreateLibrary(classpathPanel, context, callback, contextButton, libraryType);
}
}));
popup.showUnderneathOf(contextButton);
}
else {
doCreateLibrary(classpathPanel, context, callback, contextButton, null);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AddNewLibraryDependencyAction.java
示例5: getLibraryRoots
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@NotNull
public static VirtualFile[] getLibraryRoots(@NotNull LibraryOrderEntry orderEntry) {
Library library = orderEntry.getLibrary();
if (library == null) return VirtualFile.EMPTY_ARRAY;
OrderRootType[] rootTypes = LibraryType.DEFAULT_EXTERNAL_ROOT_TYPES;
if (library instanceof LibraryEx) {
if (((LibraryEx)library).isDisposed()) return VirtualFile.EMPTY_ARRAY;
PersistentLibraryKind<?> libKind = ((LibraryEx)library).getKind();
if (libKind != null) {
rootTypes = LibraryType.findByKind(libKind).getExternalRootTypes();
}
}
final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
for (OrderRootType rootType : rootTypes) {
files.addAll(Arrays.asList(library.getFiles(rootType)));
}
return VfsUtilCore.toVirtualFileArray(files);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:LibraryGroupNode.java
示例6: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Override
public Library createLibrary(@NotNull NewLibraryEditor libraryEditor,
@NotNull LibraryLevel level) {
LibraryTableModifiableModelProvider provider = getProvider(level);
if (provider == null) {
LOG.error("cannot create module library in this context");
}
LibraryTableBase.ModifiableModelEx model = (LibraryTableBase.ModifiableModelEx)provider.getModifiableModel();
final LibraryType<?> type = libraryEditor.getType();
Library library = model.createLibrary(getUniqueLibraryName(libraryEditor.getName(), model), type == null ? null : type.getKind());
ExistingLibraryEditor createdLibraryEditor = ((LibrariesModifiableModel)model).getLibraryEditor(library);
createdLibraryEditor.setProperties(libraryEditor.getProperties());
libraryEditor.applyTo(createdLibraryEditor);
return library;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:LibrariesContainerFactory.java
示例7: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Nullable
public static Library createLibrary(@Nullable final LibraryType type, @NotNull final JComponent parentComponent,
@NotNull final Project project, @NotNull final LibrariesModifiableModel modifiableModel) {
final NewLibraryConfiguration configuration = createNewLibraryConfiguration(type, parentComponent, project);
if (configuration == null) return null;
final LibraryType<?> libraryType = configuration.getLibraryType();
final Library library = modifiableModel.createLibrary(
LibraryEditingUtil.suggestNewLibraryName(modifiableModel, configuration.getDefaultLibraryName()), libraryType != null ? libraryType.getKind() : null);
final NewLibraryEditor editor = new NewLibraryEditor(libraryType, configuration.getProperties());
configuration.addRoots(editor);
final Library.ModifiableModel model = library.getModifiableModel();
editor.applyTo((LibraryEx.ModifiableModelEx)model);
AccessToken token = WriteAction.start();
try {
model.commit();
}
finally {
token.finish();
}
return library;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:CreateNewLibraryAction.java
示例8: LibraryRootsComponent
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
public LibraryRootsComponent(@Nullable Project project, @NotNull Computable<LibraryEditor> libraryEditorComputable) {
myProject = project;
myLibraryEditorComputable = libraryEditorComputable;
final LibraryEditor editor = getLibraryEditor();
final LibraryType type = editor.getType();
if (type != null) {
myDescriptor = type.createLibraryRootsComponentDescriptor();
//noinspection unchecked
myPropertiesEditor = type.createPropertiesEditor(this);
if (myPropertiesEditor != null) {
myPropertiesPanel.add(myPropertiesEditor.createComponent(), BorderLayout.CENTER);
}
}
if (myDescriptor == null) {
myDescriptor = new DefaultLibraryRootsComponentDescriptor();
}
init(new LibraryTreeStructure(this, myDescriptor));
updatePropertiesLabel();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:LibraryRootsComponent.java
示例9: createLibraryFromRoots
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的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
示例10: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Override
public Library createLibrary(@Nonnull NewLibraryEditor libraryEditor,
@Nonnull LibraryLevel level) {
LibraryTableModifiableModelProvider provider = getProvider(level);
if (provider == null) {
LOG.error("cannot create module library in this context");
}
LibraryTableBase.ModifiableModelEx model = (LibraryTableBase.ModifiableModelEx)provider.getModifiableModel();
final LibraryType<?> type = libraryEditor.getType();
Library library = model.createLibrary(getUniqueLibraryName(libraryEditor.getName(), model), type == null ? null : type.getKind());
ExistingLibraryEditor createdLibraryEditor = ((LibrariesModifiableModel)model).getLibraryEditor(library);
createdLibraryEditor.setProperties(libraryEditor.getProperties());
libraryEditor.applyTo(createdLibraryEditor);
return library;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:LibrariesContainerFactory.java
示例11: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Nullable
public static Library createLibrary(@Nullable final LibraryType type,
@Nonnull final JComponent parentComponent,
@Nonnull final Project project,
@Nonnull final LibrariesModifiableModel modifiableModel) {
final NewLibraryConfiguration configuration = createNewLibraryConfiguration(type, parentComponent, project);
if (configuration == null) return null;
final LibraryType<?> libraryType = configuration.getLibraryType();
final Library library = modifiableModel
.createLibrary(LibraryEditingUtil.suggestNewLibraryName(modifiableModel, configuration.getDefaultLibraryName()),
libraryType != null ? libraryType.getKind() : null);
final NewLibraryEditor editor = new NewLibraryEditor(libraryType, configuration.getProperties());
configuration.addRoots(editor);
final Library.ModifiableModel model = library.getModifiableModel();
editor.applyTo((LibraryEx.ModifiableModelEx)model);
AccessToken token = WriteAction.start();
try {
model.commit();
}
finally {
token.finish();
}
return library;
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:CreateNewLibraryAction.java
示例12: createNewLibraryConfiguration
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Nullable
public static NewLibraryConfiguration createNewLibraryConfiguration(@Nullable LibraryType type,
@Nonnull JComponent parentComponent,
@Nonnull Project project) {
final NewLibraryConfiguration configuration;
final VirtualFile baseDir = project.getBaseDir();
if (type != null) {
configuration = type.createNewLibrary(parentComponent, baseDir, project);
}
else {
configuration = LibraryTypeService.getInstance()
.createLibraryFromFiles(new DefaultLibraryRootsComponentDescriptor(), parentComponent, baseDir, null, project);
}
if (configuration == null) return null;
return configuration;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:CreateNewLibraryAction.java
示例13: LibraryRootsComponent
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
public LibraryRootsComponent(@Nullable Project project, @Nonnull Computable<LibraryEditor> libraryEditorComputable) {
myProject = project;
myLibraryEditorComputable = libraryEditorComputable;
final LibraryEditor editor = getLibraryEditor();
final LibraryType type = editor.getType();
if (type != null) {
myDescriptor = type.createLibraryRootsComponentDescriptor();
//noinspection unchecked
myPropertiesEditor = type.createPropertiesEditor(this);
if (myPropertiesEditor != null) {
myPropertiesPanel.add(myPropertiesEditor.createComponent(), BorderLayout.CENTER);
}
}
if (myDescriptor == null) {
myDescriptor = new DefaultLibraryRootsComponentDescriptor();
}
init(new LibraryTreeStructure(this, myDescriptor));
updatePropertiesLabel();
onRootsChanged();
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:LibraryRootsComponent.java
示例14: getLibraryRoots
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Nonnull
static VirtualFile[] getLibraryRoots(@Nonnull LibraryOrderEntry orderEntry) {
Library library = orderEntry.getLibrary();
if (library == null) return VirtualFile.EMPTY_ARRAY;
OrderRootType[] rootTypes = LibraryType.DEFAULT_EXTERNAL_ROOT_TYPES;
if (library instanceof LibraryEx) {
if (((LibraryEx)library).isDisposed()) return VirtualFile.EMPTY_ARRAY;
PersistentLibraryKind<?> libKind = ((LibraryEx)library).getKind();
if (libKind != null) {
rootTypes = LibraryType.findByKind(libKind).getExternalRootTypes();
}
}
final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
for (OrderRootType rootType : rootTypes) {
files.addAll(Arrays.asList(library.getFiles(rootType)));
}
return VfsUtilCore.toVirtualFileArray(files);
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:LibraryGroupNode.java
示例15: createLibraryInTable
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@NotNull
private static Library createLibraryInTable(final @NotNull NewLibraryEditor editor, final LibraryTable table) {
LibraryTable.ModifiableModel modifiableModel = table.getModifiableModel();
final String name = StringUtil.isEmpty(editor.getName()) ? null : getUniqueLibraryName(editor.getName(), modifiableModel);
final LibraryType<?> type = editor.getType();
Library library = modifiableModel.createLibrary(name, type == null ? null : type.getKind());
final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
editor.applyTo(model);
model.commit();
modifiableModel.commit();
return library;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:LibrariesContainerFactory.java
示例16: createLibrary
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@NotNull
public Library createLibrary() {
final LibraryTable.ModifiableModel modifiableModel = getTableModifiableModel();
final LibraryType<?> type = myLibraryEditor.getType();
final Library library = modifiableModel.createLibrary(myLibraryEditor.getName(), type != null ? type.getKind() : null);
final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx)library.getModifiableModel();
myLibraryEditor.applyTo(model);
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
model.commit();
}
}.execute();
return library;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:CreateNewLibraryDialog.java
示例17: createNewLibraryConfiguration
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Nullable
public static NewLibraryConfiguration createNewLibraryConfiguration(@Nullable LibraryType type, @NotNull JComponent parentComponent, @NotNull Project project) {
final NewLibraryConfiguration configuration;
final VirtualFile baseDir = project.getBaseDir();
if (type != null) {
configuration = type.createNewLibrary(parentComponent, baseDir, project);
}
else {
configuration = LibraryTypeService
.getInstance().createLibraryFromFiles(new DefaultLibraryRootsComponentDescriptor(), parentComponent, baseDir, null, project);
}
if (configuration == null) return null;
return configuration;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:CreateNewLibraryAction.java
示例18: createActionOrGroup
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
public static AnAction[] createActionOrGroup(@NotNull String text, @NotNull BaseLibrariesConfigurable librariesConfigurable, final @NotNull Project project) {
final LibraryType<?>[] extensions = LibraryType.EP_NAME.getExtensions();
List<LibraryType<?>> suitableTypes = new ArrayList<LibraryType<?>>();
if (librariesConfigurable instanceof ProjectLibrariesConfigurable || !project.isDefault()) {
final ModuleStructureConfigurable configurable = ModuleStructureConfigurable.getInstance(project);
for (LibraryType<?> extension : extensions) {
if (!LibraryEditingUtil.getSuitableModules(configurable, extension.getKind(), null).isEmpty()) {
suitableTypes.add(extension);
}
}
}
else {
Collections.addAll(suitableTypes, extensions);
}
if (suitableTypes.isEmpty()) {
return new AnAction[]{new CreateNewLibraryAction(text, PlatformIcons.LIBRARY_ICON, null, librariesConfigurable, project)};
}
List<AnAction> actions = new ArrayList<AnAction>();
actions.add(new CreateNewLibraryAction(IdeBundle.message("create.default.library.type.action.name"), PlatformIcons.LIBRARY_ICON, null, librariesConfigurable, project));
for (LibraryType<?> type : suitableTypes) {
final String actionName = type.getCreateActionName();
if (actionName != null) {
actions.add(new CreateNewLibraryAction(actionName, type.getIcon(null), type, librariesConfigurable, project));
}
}
return actions.toArray(new AnAction[actions.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:CreateNewLibraryAction.java
示例19: updatePropertiesLabel
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
public void updatePropertiesLabel() {
StringBuilder text = new StringBuilder();
final LibraryType<?> type = getLibraryEditor().getType();
final Set<LibraryKind> excluded =
type != null ? Collections.<LibraryKind>singleton(type.getKind()) : Collections.<LibraryKind>emptySet();
for (String description : LibraryPresentationManager.getInstance().getDescriptions(getLibraryEditor().getFiles(OrderRootType.CLASSES),
excluded)) {
if (text.length() > 0) {
text.append("\n");
}
text.append(description);
}
myPropertiesLabel.setText(text.toString());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:LibraryRootsComponent.java
示例20: createSubStep
import com.intellij.openapi.roots.libraries.LibraryType; //导入依赖的package包/类
@Override
public PopupStep createSubStep() {
return LibraryEditingUtil.createChooseTypeStep(myClasspathPanel, new ParameterizedRunnable<LibraryType>() {
@Override
public void run(LibraryType libraryType) {
new AddNewLibraryDependencyAction(myClasspathPanel, myContext, libraryType).execute();
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AddLibraryDependencyAction.java
注:本文中的com.intellij.openapi.roots.libraries.LibraryType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论