update copyright
[fedora-idea.git] / java / idea-ui / src / com / intellij / ide / util / importProject / LibraryDescriptor.java
blobabd5db596eb93e7d94025a7b4b296282b4f7a2e4
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;
22 /**
23 * @author Eugene Zhuravlev
24 * Date: Jul 13, 2007
26 public class LibraryDescriptor {
28 public static enum Level {
29 GLOBAL, PROJECT, MODULE
32 private String myName;
33 private final Collection<File> myJars;
34 private Level myLevel;
36 public LibraryDescriptor(String name, Collection<File> jars) {
37 myName = name;
38 myJars = jars;
41 public String getName() {
42 return myName != null? myName : "";
45 public void setName(final String name) {
46 myName = name;
49 public Level getLevel() {
50 if (myLevel != null) {
51 return myLevel;
53 return myJars.size() > 1? Level.PROJECT : Level.MODULE;
56 public void setLevel(final Level level) {
57 myLevel = level;
60 public Collection<File> getJars() {
61 return Collections.unmodifiableCollection(myJars);
64 public void addJars(Collection<File> jars) {
65 myJars.addAll(jars);
68 public void removeJars(Collection<File> jars) {
69 myJars.removeAll(jars);
72 public String toString() {
73 return "Lib[" + myName + "]";