update copyright
[fedora-idea.git] / java / idea-ui / src / com / intellij / openapi / roots / ui / configuration / artifacts / nodes / PackagingNodeSource.java
blob19967d45d4bb0ddeb53844ec194e0c15b8c0307a
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.artifacts.nodes;
18 import com.intellij.packaging.elements.ComplexPackagingElement;
19 import com.intellij.packaging.elements.PackagingElement;
20 import com.intellij.packaging.artifacts.Artifact;
21 import com.intellij.packaging.impl.elements.ArtifactPackagingElement;
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
25 import java.util.Collection;
27 /**
28 * @author nik
30 public class PackagingNodeSource {
31 private final ComplexPackagingElement<?> mySourceElement;
32 private final PackagingElementNode<?> mySourceParentNode;
33 private final PackagingElement<?> mySourceParentElement;
34 private final Collection<PackagingNodeSource> myParentSources;
36 public PackagingNodeSource(@NotNull ComplexPackagingElement<?> sourceElement,
37 @NotNull PackagingElementNode<?> sourceParentNode,
38 @NotNull PackagingElement<?> sourceParentElement,
39 @Nullable Collection<PackagingNodeSource> parentSources) {
40 mySourceElement = sourceElement;
41 mySourceParentNode = sourceParentNode;
42 mySourceParentElement = sourceParentElement;
43 myParentSources = parentSources;
46 @NotNull
47 public ComplexPackagingElement<?> getSourceElement() {
48 return mySourceElement;
51 @Nullable
52 public Artifact getSourceArtifact() {
53 if (mySourceElement instanceof ArtifactPackagingElement) {
54 return ((ArtifactPackagingElement)mySourceElement).findArtifact(mySourceParentNode.getContext());
56 return null;
59 @NotNull
60 public PackagingElementNode<?> getSourceParentNode() {
61 return mySourceParentNode;
64 public PackagingElement<?> getSourceParentElement() {
65 return mySourceParentElement;
68 public Collection<PackagingNodeSource> getParentSources() {
69 return myParentSources;
72 public String getPresentableName() {
73 return mySourceElement.createPresentation(mySourceParentNode.getContext()).getPresentableName();