• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NewLibraryConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.roots.libraries.NewLibraryConfiguration的典型用法代码示例。如果您正苦于以下问题:Java NewLibraryConfiguration类的具体用法?Java NewLibraryConfiguration怎么用?Java NewLibraryConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NewLibraryConfiguration类属于com.intellij.openapi.roots.libraries包,在下文中一共展示了NewLibraryConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例2: createNewLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例3: chooseLibraryAndDownload

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Nullable
public static NewLibraryConfiguration chooseLibraryAndDownload(final @NotNull Project project,
                                                               final @Nullable String initialFilter,
                                                               JComponent parentComponent) {
  RepositoryAttachDialog dialog = new RepositoryAttachDialog(project, initialFilter);
  dialog.setTitle("Download Library From Maven Repository");
  dialog.show();
  if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
    return null;
  }

  String copyTo = dialog.getDirectoryPath();
  String coord = dialog.getCoordinateText();
  boolean attachJavaDoc = dialog.getAttachJavaDoc();
  boolean attachSources = dialog.getAttachSources();
  List<MavenRepositoryInfo> repositories = dialog.getRepositories();
  NewLibraryConfiguration configuration = resolveAndDownload(project, coord, attachJavaDoc, attachSources, copyTo, repositories);
  if (configuration == null) {
    Messages.showErrorDialog(parentComponent, ProjectBundle.message("maven.downloading.failed", coord), CommonBundle.getErrorTitle());
  }
  return configuration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:RepositoryAttachHandler.java


示例4: resolveAndDownload

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例5: createLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例6: edit

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Override
protected void edit() {
  final Project project = myEditorComponent.getProject();
  final NewLibraryConfiguration configuration = RepositoryAttachHandler.chooseLibraryAndDownload(project,
                                                                                                 myEditorComponent.getProperties().getMavenId(),
                                                                                                 getMainPanel());
  if (configuration == null) return;

  final LibraryEditorBase target = (LibraryEditorBase)myEditorComponent.getLibraryEditor();
  target.removeAllRoots();
  myEditorComponent.renameLibrary(configuration.getDefaultLibraryName());
  target.setType(myLibraryType);
  target.setProperties(configuration.getProperties());
  configuration.addRoots(target);
  myEditorComponent.updateRootsTree();
  setModified();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:RepositoryLibraryEditor.java


示例7: chooseLibraryAndDownload

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Nullable
public static NewLibraryConfiguration chooseLibraryAndDownload(final @NotNull Project project,
                                                               final @Nullable String initialFilter,
                                                               JComponent parentComponent) {
  RepositoryAttachDialog dialog = new RepositoryAttachDialog(project, initialFilter);
  dialog.setTitle("Download Library From Maven Repository");
  dialog.show();
  if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
    return null;
  }

  String copyTo = dialog.getDirectoryPath();
  String coord = dialog.getCoordinateText();
  boolean attachJavaDoc = dialog.getAttachJavaDoc();
  boolean attachSources = dialog.getAttachSources();
  List<MavenRepositoryInfo> repositories = dialog.getRepositories();
  NewLibraryConfiguration configuration = resolveAndDownload(project, coord, attachJavaDoc, attachSources, copyTo, repositories);
  if (configuration == null) {
    Messages.showErrorDialog(parentComponent, "No files were downloaded for " + coord, CommonBundle.getErrorTitle());
  }
  return configuration;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:RepositoryAttachHandler.java


示例8: createNewLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例9: chooseLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Nullable
public static NewLibraryConfiguration chooseLibrary(final @NotNull Project project,
                                                    JComponent parentComponent) {
  LibraryAttachDialog dialog = new LibraryAttachDialog(project);
  dialog.setTitle("Attach Library");
  dialog.show();
  if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
    return null;
  }

  NewLibraryConfiguration configuration = attachLibrary(project, dialog.getRegistryEntries());
  if (configuration == null) {
    Messages.showErrorDialog(parentComponent, "No libraries attached", CommonBundle.getErrorTitle());
  }
  return configuration;
}
 
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:17,代码来源:LibraryAttachHandler.java


示例10: attachLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例11: edit

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Override
protected void edit() {
  final Project project = myEditorComponent.getProject();
  final NewLibraryConfiguration configuration = LibraryAttachHandler.chooseLibrary(project,
      getMainPanel());
  if (configuration == null) return;

  final LibraryEditorBase target = (LibraryEditorBase) myEditorComponent.getLibraryEditor();
  target.removeAllRoots();
  myEditorComponent.renameLibrary(configuration.getDefaultLibraryName());
  target.setType(myLibraryType);
  target.setProperties(configuration.getProperties());
  configuration.addRoots(target);
  myEditorComponent.updateRootsTree();
  setModified();
}
 
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:17,代码来源:DeftLibraryEditor.java


示例12: createLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例13: createNewLibraryConfiguration

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例14: createNewLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, VirtualFile contextDirectory)
{
    final MuleSdk muleSdk = new MuleSdkSelectionDialog(parentComponent).open();
    if (muleSdk == null)
        return null;
    return new MuleLibraryConfiguration(muleSdk);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:9,代码来源:MuleLibraryDescription.java


示例15: createNewLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile virtualFile, @NotNull Project project)
{
    final MuleSdk muleSdk = new MuleSdkSelectionDialog(parentComponent).open();
    if (muleSdk == null)
    {
        return null;
    }
    return new MuleLibraryDescription.MuleLibraryConfiguration(muleSdk);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:12,代码来源:MuleLibraryType.java


示例16: createNewLibraryConfiguration

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的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


示例17: doCreate

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
private void doCreate() {
  final NewLibraryConfiguration libraryConfiguration = myLibraryDescription.createNewLibrary(myCreateButton, getBaseDirectory());
  if (libraryConfiguration != null) {
    final NewLibraryEditor libraryEditor = new NewLibraryEditor(libraryConfiguration.getLibraryType(), libraryConfiguration.getProperties());
    libraryEditor.setName(myLibrariesContainer.suggestUniqueLibraryName(libraryConfiguration.getDefaultLibraryName()));
    libraryConfiguration.addRoots(libraryEditor);
    if (myLibraryComboBoxModel.get(0) == null) {
      myLibraryComboBoxModel.remove(0);
    }
    myLibraryComboBoxModel.add(libraryEditor);
    myLibraryComboBoxModel.setSelectedItem(libraryEditor);
    myButtonEnumModel.setSelected(Choice.USE_LIBRARY);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:LibraryOptionsPanel.java


示例18: createNewLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent,
                                                @Nullable VirtualFile contextDirectory,
                                                @NotNull Project project) {
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PythonLibraryType.java


示例19: createNewLibrary

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(
  @NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory, @NotNull Project project
) {
  return null;
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:8,代码来源:PythonLibraryType.java


示例20: doCreate

import com.intellij.openapi.roots.libraries.NewLibraryConfiguration; //导入依赖的package包/类
private void doCreate() {
  final NewLibraryConfiguration libraryConfiguration = mySettings.getLibraryDescription().createNewLibrary(myPanel, getBaseDirectory());
  if (libraryConfiguration != null) {
    final NewLibraryEditor libraryEditor = new NewLibraryEditor(libraryConfiguration.getLibraryType(), libraryConfiguration.getProperties());
    libraryEditor.setName(myLibrariesContainer.suggestUniqueLibraryName(libraryConfiguration.getDefaultLibraryName()));
    libraryConfiguration.addRoots(libraryEditor);
    if (myLibraryComboBoxModel.get(0) == null) {
      myLibraryComboBoxModel.remove(0);
    }
    myLibraryComboBoxModel.add(libraryEditor);
    myLibraryComboBoxModel.setSelectedItem(libraryEditor);
    myButtonEnumModel.setSelected(Choice.USE_LIBRARY);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:LibraryOptionsPanel.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EntityAction类代码示例发布时间:2022-05-23
下一篇:
Java PowerHost类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap