mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
new library chooser dialog used in artifacts editor
This commit is contained in:
+4
-4
@@ -30,7 +30,6 @@ import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.libraryEditor.ChooseModulesDialog;
|
||||
import com.intellij.openapi.roots.ui.configuration.packaging.ChooseLibrariesDialog;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactModel;
|
||||
@@ -41,6 +40,7 @@ import com.intellij.packaging.impl.ui.ChooseArtifactsDialog;
|
||||
import com.intellij.packaging.ui.ArtifactEditor;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.ManifestFileConfiguration;
|
||||
import com.intellij.util.ui.classpath.ChooseLibrariesFromTablesDialog;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -175,10 +175,10 @@ public class ArtifactEditorContextImpl implements ArtifactEditorContext {
|
||||
return dialog.isOK() ? selected : Collections.<Module>emptyList();
|
||||
}
|
||||
|
||||
public List<Library> chooseLibraries(final List<Library> libraries, final String title) {
|
||||
ChooseLibrariesDialog dialog = new ChooseLibrariesDialog(getProject(), libraries, title, null);
|
||||
public List<Library> chooseLibraries(final String title) {
|
||||
final ChooseLibrariesFromTablesDialog dialog = ChooseLibrariesFromTablesDialog.createDialog(title, getProject(), false);
|
||||
dialog.show();
|
||||
return dialog.isOK() ? dialog.getChosenElements() : Collections.<Library>emptyList();
|
||||
return dialog.isOK() ? dialog.getSelectedLibraries() : Collections.<Library>emptyList();
|
||||
}
|
||||
|
||||
public Artifact getArtifact() {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class ProjectStructureChooseLibrariesDialog extends ChooseLibrariesFromTa
|
||||
@Nullable Project project,
|
||||
StructureConfigurableContext context,
|
||||
Collection<Library> alreadyAddedLibraries) {
|
||||
super(parentComponent, "Choose Libraries", project);
|
||||
super(parentComponent, "Choose Libraries", project, true);
|
||||
myContext = context;
|
||||
myAlreadyAddedLibraries = alreadyAddedLibraries;
|
||||
init();
|
||||
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.ui.configuration.packaging;
|
||||
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.ide.util.ChooseElementsDialog;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.util.Icons;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class ChooseLibrariesDialog extends ChooseElementsDialog<Library> {
|
||||
|
||||
public ChooseLibrariesDialog(Project project, List<? extends Library> items, String title, String description) {
|
||||
super(project, items, title, description, true);
|
||||
}
|
||||
|
||||
protected String getItemText(final Library item) {
|
||||
return item != null ? PackagingEditorUtil.getLibraryItemText(item, true) : "";
|
||||
}
|
||||
|
||||
protected Icon getItemIcon(final Library item) {
|
||||
if (item.getName() != null) {
|
||||
return Icons.LIBRARY_ICON;
|
||||
}
|
||||
VirtualFile[] files = item.getFiles(OrderRootType.CLASSES);
|
||||
if (files.length == 1) {
|
||||
return files[0].getFileType().getIcon();
|
||||
}
|
||||
return Icons.LIBRARY_ICON;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user