artifact fixes

This commit is contained in:
nik
2009-10-07 10:32:35 +04:00
parent 08c383fe61
commit 9e9f4e8558
3 changed files with 25 additions and 9 deletions
@@ -41,6 +41,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
private final Project myProject;
private final DefaultPackagingElementResolvingContext myResolvingContext;
private boolean myInsideCommit = false;
private boolean myLoaded;
private long myModificationCount;
private final ModificationTracker myModificationTracker = new ModificationTracker() {
public long getModificationCount() {
@@ -164,7 +165,16 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
}
artifacts.add(artifact);
}
myModel.setArtifactsList(artifacts);
if (myLoaded) {
final ArtifactModelImpl model = new ArtifactModelImpl(this);
model.addArtifacts(artifacts);
doCommit(model);
}
else {
myModel.setArtifactsList(artifacts);
myLoaded = true;
}
}
private static <S> void deserializeProperties(ArtifactProperties<S> artifactProperties, ArtifactPropertiesState propertiesState) {
@@ -249,8 +259,12 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
public void commit(ArtifactModelImpl artifactModel) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
LOG.assertTrue(!myInsideCommit, "Recursive commit");
doCommit(artifactModel);
}
private void doCommit(ArtifactModelImpl artifactModel) {
LOG.assertTrue(!myInsideCommit, "Recursive commit");
myInsideCommit = true;
try {
@@ -20,12 +20,6 @@ public class ArtifactPointerImpl implements ArtifactPointer {
myName = name;
}
public ArtifactPointerImpl(@NotNull Project project, @NotNull Artifact artifact) {
myProject = project;
myArtifact = artifact;
myName = artifact.getName();
}
@NotNull
public String getName() {
return myName;
@@ -4,8 +4,8 @@ import com.intellij.openapi.project.Project;
import com.intellij.packaging.artifacts.*;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
import java.util.HashMap;
import java.util.Map;
/**
* @author nik
@@ -25,6 +25,14 @@ public class ArtifactPointerManagerImpl extends ArtifactPointerManager {
}
}
@Override
public void artifactAdded(@NotNull Artifact artifact) {
final ArtifactPointerImpl artifactPointer = myPointers.get(artifact.getName());
if (artifactPointer != null) {
artifactPointer.setArtifact(artifact);
}
}
@Override
public void artifactChanged(@NotNull Artifact artifact, @NotNull String oldName) {
final ArtifactPointerImpl pointer = myPointers.get(oldName);