IDEADEV-41193: Web artifact (exploded directory) not re-deployed properly
[fedora-idea.git] / java / compiler / impl / src / com / intellij / packaging / impl / compiler / ArtifactsProcessingItemsBuilderContext.java
blob75138c8eab1ad9938188d15129bfda8502ce1f0c
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.packaging.impl.compiler;
18 import com.intellij.compiler.impl.packagingCompiler.DestinationInfo;
19 import com.intellij.compiler.impl.packagingCompiler.ExplodedDestinationInfo;
20 import com.intellij.compiler.impl.packagingCompiler.ProcessingItemsBuilderContext;
21 import com.intellij.openapi.compiler.CompileContext;
22 import com.intellij.openapi.vfs.VirtualFile;
23 import com.intellij.packaging.elements.ArtifactIncrementalCompilerContext;
24 import org.jetbrains.annotations.NotNull;
26 import java.util.Collection;
28 /**
29 * @author nik
31 public class ArtifactsProcessingItemsBuilderContext extends ProcessingItemsBuilderContext<ArtifactPackagingProcessingItem> implements ArtifactIncrementalCompilerContext {
32 private boolean myCollectingEnabledItems;
34 public ArtifactsProcessingItemsBuilderContext(CompileContext compileContext) {
35 super(compileContext);
38 public boolean addDestination(@NotNull VirtualFile sourceFile, @NotNull DestinationInfo destinationInfo) {
39 if (destinationInfo instanceof ExplodedDestinationInfo && sourceFile.equals(destinationInfo.getOutputFile())) {
40 return false;
43 if (checkOutputPath(destinationInfo.getOutputPath(), sourceFile)) {
44 getOrCreateProcessingItem(sourceFile).addDestination(destinationInfo, myCollectingEnabledItems);
45 return true;
47 return false;
50 protected ArtifactPackagingProcessingItem createProcessingItem(VirtualFile sourceFile) {
51 return new ArtifactPackagingProcessingItem(sourceFile);
54 public ArtifactPackagingProcessingItem[] getProcessingItems() {
55 final Collection<ArtifactPackagingProcessingItem> processingItems = myItemsBySource.values();
56 return processingItems.toArray(new ArtifactPackagingProcessingItem[processingItems.size()]);
59 public void setCollectingEnabledItems(boolean collectingEnabledItems) {
60 myCollectingEnabledItems = collectingEnabledItems;