Search in sources :

Example 1 with EditExistingLibraryDialog

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.EditExistingLibraryDialog 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();
}
Also used : LibraryTablePresentation(com.intellij.openapi.roots.libraries.LibraryTablePresentation) LibraryTable(com.intellij.openapi.roots.libraries.LibraryTable) EditExistingLibraryDialog(com.intellij.openapi.roots.ui.configuration.libraryEditor.EditExistingLibraryDialog) Library(com.intellij.openapi.roots.libraries.Library) LibraryTableModifiableModelProvider(com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider)

Example 2 with EditExistingLibraryDialog

use of com.intellij.openapi.roots.ui.configuration.libraryEditor.EditExistingLibraryDialog in project intellij-plugins by JetBrains.

the class DependenciesConfigurable method editLibrary.

private void editLibrary(ModuleLibraryItem item) {
    if (!item.canEdit())
        return;
    final LibraryOrderEntry entry = item.orderEntry;
    assert entry != null;
    Library library = entry.getLibrary();
    if (library == null) {
        return;
    }
    LibraryTablePresentation presentation = new LibraryTablePresentation() {

        @Override
        public String getDisplayName(boolean plural) {
            return FlexBundle.message(plural ? "library.editor.title.plural" : "library.editor.title.singular");
        }

        @Override
        public String getDescription() {
            return ProjectBundle.message("libraries.node.text.module");
        }

        @Override
        public String getLibraryTableEditorTitle() {
            // not used as far as I see
            return "Configure Library";
        }
    };
    LibraryTableModifiableModelProvider provider = new LibraryTableModifiableModelProvider() {

        public LibraryTable.ModifiableModel getModifiableModel() {
            return myConfigEditor.getLibraryModel(myDependencies);
        }
    };
    StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myProject).getContext();
    EditExistingLibraryDialog dialog = EditExistingLibraryDialog.createDialog(myMainPanel, provider, library, myProject, presentation, context);
    dialog.setContextModule(myConfigEditor.getModule(myDependencies));
    dialog.show();
    myTable.refresh();
}
Also used : EditExistingLibraryDialog(com.intellij.openapi.roots.ui.configuration.libraryEditor.EditExistingLibraryDialog) LibraryOrderEntry(com.intellij.openapi.roots.LibraryOrderEntry) LibraryTableModifiableModelProvider(com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider)

Aggregations

LibraryTableModifiableModelProvider (com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider)2 EditExistingLibraryDialog (com.intellij.openapi.roots.ui.configuration.libraryEditor.EditExistingLibraryDialog)2 LibraryOrderEntry (com.intellij.openapi.roots.LibraryOrderEntry)1 Library (com.intellij.openapi.roots.libraries.Library)1 LibraryTable (com.intellij.openapi.roots.libraries.LibraryTable)1 LibraryTablePresentation (com.intellij.openapi.roots.libraries.LibraryTablePresentation)1