update copyright
[fedora-idea.git] / java / idea-ui / src / com / intellij / openapi / roots / ui / configuration / libraryEditor / ItemElement.java
blob42e6bcc7a6cc7336a722a4648df8722cab8cbd84
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.openapi.roots.ui.configuration.libraryEditor;
18 import com.intellij.ide.util.treeView.NodeDescriptor;
19 import com.intellij.openapi.roots.OrderRootType;
20 import com.intellij.openapi.roots.libraries.Library;
23 class ItemElement extends LibraryTableTreeContentElement {
24 private final LibraryTableTreeContentElement myParent;
25 private final Library myLibrary;
26 private final String myUrl;
27 private final OrderRootType myRootType;
28 private final boolean myIsJarDirectory;
29 private final boolean myValid;
31 public ItemElement(LibraryTableTreeContentElement parent, Library library, String url, OrderRootType rootType, final boolean isJarDirectory, boolean isValid) {
32 myParent = parent;
33 myLibrary = library;
34 myUrl = url;
35 myRootType = rootType;
36 myIsJarDirectory = isJarDirectory;
37 myValid = isValid;
40 public LibraryTableTreeContentElement getParent() {
41 return myParent;
44 public OrderRootType getOrderRootType() {
45 return null;
48 public NodeDescriptor createDescriptor(final NodeDescriptor parentDescriptor, final LibraryTableEditor parentEditor) {
49 return new ItemElementDescriptor(parentDescriptor, this);
52 public String getUrl() {
53 return myUrl;
56 public boolean isJarDirectory() {
57 return myIsJarDirectory;
60 public boolean isValid() {
61 return myValid;
64 public OrderRootType getRootType() {
65 return myRootType;
68 public Library getLibrary() {
69 return myLibrary;
72 public boolean equals(Object o) {
73 if (this == o) return true;
74 if (!(o instanceof ItemElement)) return false;
76 final ItemElement itemElement = (ItemElement)o;
78 if (!myLibrary.equals(itemElement.myLibrary)) return false;
79 if (!myParent.equals(itemElement.myParent)) return false;
80 if (!myRootType.equals(itemElement.myRootType)) return false;
81 if (!myUrl.equals(itemElement.myUrl)) return false;
83 return true;
86 public int hashCode() {
87 int result;
88 result = myParent.hashCode();
89 result = 29 * result + myLibrary.hashCode();
90 result = 29 * result + myUrl.hashCode();
91 result = 29 * result + myRootType.hashCode();
92 return result;