update copyright
[fedora-idea.git] / java / idea-ui / src / com / intellij / ide / util / importProject / LibrariesLayoutPanel.java
blob6e3b1982f0f59bb4fee79cc66d5e50ad03735fd0
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.ide.util.importProject;
18 import java.io.File;
19 import java.util.Collection;
20 import java.util.Collections;
21 import java.util.List;
23 /**
24 * @author Eugene Zhuravlev
25 * Date: Jul 18, 2007
27 public class LibrariesLayoutPanel extends ProjectLayoutPanel<LibraryDescriptor>{
29 public LibrariesLayoutPanel(final ModuleInsight insight) {
30 super(insight);
33 protected String getElementName(final LibraryDescriptor entry) {
34 return entry.getName();
37 protected void setElementName(final LibraryDescriptor entry, final String name) {
38 entry.setName(name);
41 protected List<LibraryDescriptor> getEntries() {
42 final List<LibraryDescriptor> libs = getInsight().getSuggestedLibraries();
43 return libs != null? libs : Collections.<LibraryDescriptor>emptyList();
46 protected Collection getDependencies(final LibraryDescriptor entry) {
47 return entry.getJars();
50 protected LibraryDescriptor merge(final List<LibraryDescriptor> entries) {
51 final ModuleInsight insight = getInsight();
52 LibraryDescriptor mainLib = null;
53 for (LibraryDescriptor entry : entries) {
54 if (mainLib == null) {
55 mainLib = entry;
57 else {
58 final Collection<File> files = entry.getJars();
59 insight.moveJarsToLibrary(entry, files, mainLib);
62 return mainLib;
65 protected LibraryDescriptor split(final LibraryDescriptor entry, final String newEntryName, final Collection<File> extractedData) {
66 return getInsight().splitLibrary(entry, newEntryName, extractedData);
69 protected Collection<File> getContent(final LibraryDescriptor entry) {
70 return entry.getJars();
73 protected String getEntriesChooserTitle() {
74 return "Libraries";
77 protected String getDependenciesTitle() {
78 return "Library contents";
81 protected String getSplitDialogTitle() {
82 return "Split Library";
85 protected String getSplitDialogChooseFilesPrompt() {
86 return "Select jars to extract to the new library:";
89 protected String getNameAlreadyUsedMessage(final String name) {
90 return "library with name " + name + " already exists";
93 protected String getStepDescriptionText() {
94 return "Please review libraries found. At this stage you may set library names that will be used in the project,\n" +
95 "exclude particular libraries from the project, or move jar files between the libraries.";