com.intellij.openapi.roots.libraries.NewLibraryConfiguration Java Examples

The following examples show how to use com.intellij.openapi.roots.libraries.NewLibraryConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateNewLibraryAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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);
  WriteAction.run(model::commit);
  return library;
}
 
Example #2
Source File: CreateNewLibraryAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: MuleLibraryDescription.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #4
Source File: MuleLibraryType.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #5
Source File: AndroidModuleLibraryType.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent,
                                                @Nullable VirtualFile contextDirectory,
                                                @NotNull Project project) {
  return null;
}
 
Example #6
Source File: AndroidModuleLibraryType.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent,
                                                @Nullable VirtualFile contextDirectory,
                                                @NotNull Project project) {
  return null;
}
 
Example #7
Source File: PythonLibraryType.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(
  @NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory, @NotNull Project project
) {
  return null;
}
 
Example #8
Source File: FlutterPluginLibraryType.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent component, @Nullable VirtualFile file, @NotNull Project project) {
  return null;
}
 
Example #9
Source File: FlutterPluginLibraryType.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent component, @Nullable VirtualFile file, @NotNull Project project) {
  return null;
}
 
Example #10
Source File: SandLibraryType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@Nonnull JComponent parentComponent, @Nullable VirtualFile contextDirectory, @Nonnull Project project) {
  return null;
}