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
) {
35 myRootType
= rootType
;
36 myIsJarDirectory
= isJarDirectory
;
40 public LibraryTableTreeContentElement
getParent() {
44 public OrderRootType
getOrderRootType() {
48 public NodeDescriptor
createDescriptor(final NodeDescriptor parentDescriptor
, final LibraryTableEditor parentEditor
) {
49 return new ItemElementDescriptor(parentDescriptor
, this);
52 public String
getUrl() {
56 public boolean isJarDirectory() {
57 return myIsJarDirectory
;
60 public boolean isValid() {
64 public OrderRootType
getRootType() {
68 public Library
getLibrary() {
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;
86 public int hashCode() {
88 result
= myParent
.hashCode();
89 result
= 29 * result
+ myLibrary
.hashCode();
90 result
= 29 * result
+ myUrl
.hashCode();
91 result
= 29 * result
+ myRootType
.hashCode();