update copyright
[fedora-idea.git] / java / idea-ui / src / com / intellij / openapi / roots / ui / configuration / artifacts / sourceItems / ModuleOutputSourceItem.java
blob3bf4181c890cd03b26cd693001ab09ca317e8057
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.sourceItems;
18 import com.intellij.openapi.module.Module;
19 import com.intellij.packaging.elements.PackagingElement;
20 import com.intellij.packaging.elements.PackagingElementOutputKind;
21 import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement;
22 import com.intellij.packaging.impl.ui.ModuleElementPresentation;
23 import com.intellij.packaging.ui.*;
24 import org.jetbrains.annotations.NotNull;
26 import java.util.Collections;
27 import java.util.List;
29 /**
30 * @author nik
32 public class ModuleOutputSourceItem extends PackagingSourceItem {
33 private final Module myModule;
35 public ModuleOutputSourceItem(@NotNull Module module) {
36 myModule = module;
39 public boolean equals(Object obj) {
40 return obj instanceof ModuleOutputSourceItem && myModule.equals(((ModuleOutputSourceItem)obj).myModule);
43 public int hashCode() {
44 return myModule.hashCode();
47 @Override
48 public SourceItemPresentation createPresentation(@NotNull ArtifactEditorContext context) {
49 return new DelegatedSourceItemPresentation(new ModuleElementPresentation(myModule.getName(), myModule, context)) {
50 @Override
51 public int getWeight() {
52 return SourceItemWeights.MODULE_OUTPUT_WEIGHT;
57 @NotNull
58 public List<? extends PackagingElement<?>> createElements(@NotNull ArtifactEditorContext context) {
59 return Collections.singletonList(new ModuleOutputPackagingElement(myModule.getName()));
62 @NotNull
63 @Override
64 public PackagingElementOutputKind getKindOfProducedElements() {
65 return PackagingElementOutputKind.DIRECTORIES_WITH_CLASSES;