use of com.intellij.openapi.roots.libraries.Library in project intellij-community by JetBrains.
the class CreateNewLibraryAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Library library = createLibrary(myType, myLibrariesConfigurable.getTree(), myProject, myLibrariesConfigurable.getModelProvider().getModifiableModel());
if (library == null)
return;
final BaseLibrariesConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myProject).getConfigurableFor(library);
final DefaultMutableTreeNode libraryNode = MasterDetailsComponent.findNodeByObject((TreeNode) rootConfigurable.getTree().getModel().getRoot(), library);
rootConfigurable.selectNodeInTree(libraryNode);
LibraryEditingUtil.showDialogAndAddLibraryToDependencies(library, myProject, true);
}
use of com.intellij.openapi.roots.libraries.Library in project intellij-community by JetBrains.
the class CreateNewLibraryDialog method createLibrary.
@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;
}
use of com.intellij.openapi.roots.libraries.Library in project intellij-community by JetBrains.
the class AddNewLibraryDependencyAction method doCreateLibrary.
private static void doCreateLibrary(ClasspathPanel classpathPanel, StructureConfigurableContext context, LibraryCreatedCallback callback, final JComponent component, @Nullable final LibraryType libraryType) {
final NewLibraryChooser chooser = new NewLibraryChooser(classpathPanel.getProject(), classpathPanel.getRootModel(), libraryType, context, component);
final Library library = chooser.createLibrary();
if (library != null) {
callback.libraryCreated(library);
}
}
use of com.intellij.openapi.roots.libraries.Library in project intellij-community by JetBrains.
the class ChangeLibraryLevelInClasspathAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent event) {
final OrderEntry entry = myPanel.getSelectedEntry();
if (!(entry instanceof LibraryOrderEntry))
return;
LibraryOrderEntry libraryEntry = (LibraryOrderEntry) entry;
final LibraryEx library = (LibraryEx) libraryEntry.getLibrary();
if (library == null)
return;
final Library copied = doCopy(library);
if (copied == null)
return;
if (!isConvertingToModuleLibrary()) {
OrderEntryUtil.replaceLibrary(myPanel.getRootModel(), library, copied);
} else {
OrderEntryUtil.replaceLibraryEntryByAdded(myPanel.getRootModel(), libraryEntry);
}
}
use of com.intellij.openapi.roots.libraries.Library in project intellij-community by JetBrains.
the class ClasspathPanelImpl method doEdit.
private void doEdit() {
final OrderEntry entry = getSelectedEntry();
if (!(entry instanceof LibraryOrderEntry))
return;
final Library library = ((LibraryOrderEntry) entry).getLibrary();
if (library == null) {
return;
}
final LibraryTable table = library.getTable();
final String tableLevel = table != null ? table.getTableLevel() : LibraryTableImplUtil.MODULE_LEVEL;
final LibraryTablePresentation presentation = LibraryEditingUtil.getLibraryTablePresentation(getProject(), tableLevel);
final LibraryTableModifiableModelProvider provider = getModifiableModelProvider(tableLevel);
EditExistingLibraryDialog dialog = EditExistingLibraryDialog.createDialog(this, provider, library, myState.getProject(), presentation, getStructureConfigurableContext());
dialog.setContextModule(getRootModel().getModule());
dialog.show();
myEntryTable.repaint();
ModuleStructureConfigurable.getInstance(myState.getProject()).getTree().repaint();
}
Aggregations