Search in sources :

Example 1 with ExistingLibraryEditor

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor in project intellij-community by JetBrains.

the class LibraryOptionsPanel method doConfigure.

private void doConfigure() {
    switch(myButtonEnumModel.getSelected()) {
        case DOWNLOAD:
            final LibraryDownloadSettings oldDownloadSettings = mySettings.getDownloadSettings();
            LOG.assertTrue(oldDownloadSettings != null);
            final LibraryDownloadSettings newDownloadSettings = DownloadingOptionsDialog.showDialog(myPanel, oldDownloadSettings, mySettings.getCompatibleVersions(), true);
            if (newDownloadSettings != null) {
                mySettings.setDownloadSettings(newDownloadSettings);
            }
            break;
        case USE_LIBRARY:
            final Object item = myExistingLibraryComboBox.getSelectedItem();
            if (item instanceof LibraryEditor) {
                EditLibraryDialog dialog = new EditLibraryDialog(myPanel, mySettings, (LibraryEditor) item);
                dialog.show();
                if (item instanceof ExistingLibraryEditor) {
                    new WriteAction() {

                        protected void run(@NotNull final Result result) {
                            ((ExistingLibraryEditor) item).commit();
                        }
                    }.execute();
                }
            }
            break;
        case USE_FROM_PROVIDER:
        case SETUP_LIBRARY_LATER:
            break;
    }
    updateState();
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor) ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor) NewLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor) LibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor) WriteAction(com.intellij.openapi.application.WriteAction) Result(com.intellij.openapi.application.Result)

Example 2 with ExistingLibraryEditor

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor in project intellij-community by JetBrains.

the class LibrariesModifiableModel method getLibraryEditor.

public ExistingLibraryEditor getLibraryEditor(Library library) {
    final Library source = ((LibraryImpl) library).getSource();
    if (source != null) {
        return getLibraryEditor(source);
    }
    ExistingLibraryEditor libraryEditor = myLibrary2EditorMap.get(library);
    if (libraryEditor == null) {
        libraryEditor = createLibraryEditor(library);
    }
    return libraryEditor;
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor) LibraryImpl(com.intellij.openapi.roots.impl.libraries.LibraryImpl) Library(com.intellij.openapi.roots.libraries.Library)

Example 3 with ExistingLibraryEditor

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor in project intellij-community by JetBrains.

the class LibraryCompositionSettings method getOrCreateEditor.

public ExistingLibraryEditor getOrCreateEditor(@NotNull Library library) {
    ExistingLibraryEditor libraryEditor = myExistingLibraryEditors.get(library);
    if (libraryEditor == null) {
        libraryEditor = new ExistingLibraryEditor(library, null);
        Disposer.register(this, libraryEditor);
        myExistingLibraryEditors.put(library, libraryEditor);
    }
    return libraryEditor;
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)

Example 4 with ExistingLibraryEditor

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor in project intellij-community by JetBrains.

the class LibrariesModifiableModel method deferredCommit.

public void deferredCommit() {
    final List<ExistingLibraryEditor> libraryEditors = new ArrayList<>(myLibrary2EditorMap.values());
    myLibrary2EditorMap.clear();
    for (ExistingLibraryEditor libraryEditor : libraryEditors) {
        // TODO: is seems like commit will recreate the editor, but it should not
        libraryEditor.commit();
        Disposer.dispose(libraryEditor);
    }
    if (!libraryEditors.isEmpty() || !myRemovedLibraries.isEmpty() || myLibrariesModifiableModel != null && myLibrariesModifiableModel.isChanged()) {
        getLibrariesModifiableModel().commit();
        myLibrariesModifiableModel = null;
    }
    myRemovedLibraries.clear();
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)

Example 5 with ExistingLibraryEditor

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor in project intellij-community by JetBrains.

the class LibrariesModifiableModel method createLibraryEditor.

private ExistingLibraryEditor createLibraryEditor(final Library library) {
    final ExistingLibraryEditor libraryEditor = new ExistingLibraryEditor(library, myLibraryEditorListener);
    myLibrary2EditorMap.put(library, libraryEditor);
    return libraryEditor;
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)

Aggregations

ExistingLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)7 Library (com.intellij.openapi.roots.libraries.Library)3 Result (com.intellij.openapi.application.Result)2 WriteAction (com.intellij.openapi.application.WriteAction)2 LibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor)2 NewLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor)2 DownloadableLibraryDescription (com.intellij.framework.library.DownloadableLibraryDescription)1 DownloadableLibraryType (com.intellij.framework.library.DownloadableLibraryType)1 FrameworkLibraryVersion (com.intellij.framework.library.FrameworkLibraryVersion)1 FrameworkLibraryVersionFilter (com.intellij.framework.library.FrameworkLibraryVersionFilter)1 AllIcons (com.intellij.icons.AllIcons)1 IdeBundle (com.intellij.ide.IdeBundle)1 OldCustomLibraryDescription (com.intellij.ide.util.frameworkSupport.OldCustomLibraryDescription)1 Disposable (com.intellij.openapi.Disposable)1 Logger (com.intellij.openapi.diagnostic.Logger)1 Project (com.intellij.openapi.project.Project)1 ProjectManager (com.intellij.openapi.project.ProjectManager)1 OrderRootType (com.intellij.openapi.roots.OrderRootType)1 LibraryEx (com.intellij.openapi.roots.impl.libraries.LibraryEx)1 LibraryImpl (com.intellij.openapi.roots.impl.libraries.LibraryImpl)1