mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
artifacts & conversion fixes
This commit is contained in:
+4
-3
@@ -138,16 +138,17 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
|
||||
LOG.info("Unknown artifact type: " + state.getArtifactType());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
final String artifactName = state.getName();
|
||||
final CompositePackagingElement<?> rootElement;
|
||||
if (element != null) {
|
||||
rootElement = (CompositePackagingElement<?>)deserializeElement(element);
|
||||
}
|
||||
else {
|
||||
rootElement = type.createRootElement();
|
||||
rootElement = type.createRootElement(artifactName);
|
||||
}
|
||||
|
||||
final ArtifactImpl artifact = new ArtifactImpl(state.getName(), type, state.isBuildOnMake(), rootElement, state.getOutputPath(),
|
||||
final ArtifactImpl artifact = new ArtifactImpl(artifactName, type, state.isBuildOnMake(), rootElement, state.getOutputPath(),
|
||||
state.isClearOutputOnRebuild());
|
||||
final List<ArtifactPropertiesState> propertiesList = state.getPropertiesList();
|
||||
for (ArtifactPropertiesState propertiesState : propertiesList) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.intellij.packaging.impl.artifacts;
|
||||
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.artifacts.*;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -51,8 +51,9 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
|
||||
public ModifiableArtifact addArtifact(@NotNull final String name, @NotNull ArtifactType artifactType) {
|
||||
final String outputPath = ArtifactUtil.getDefaultArtifactOutputPath(name, myArtifactManager.getProject());
|
||||
|
||||
final ArtifactImpl artifact = new ArtifactImpl(generateUniqueName(name), artifactType, false, artifactType.createRootElement(),
|
||||
outputPath, true);
|
||||
final String artifactName = generateUniqueName(name);
|
||||
final CompositePackagingElement<?> rootElement = artifactType.createRootElement(artifactName);
|
||||
final ArtifactImpl artifact = new ArtifactImpl(artifactName, artifactType, false, rootElement, outputPath, true);
|
||||
myOriginalArtifacts.add(artifact);
|
||||
myArtifact2ModifiableCopy.put(artifact, artifact);
|
||||
myModifiable2Original.put(artifact, artifact);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PlainArtifactType extends ArtifactType {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CompositePackagingElement<?> createRootElement() {
|
||||
public CompositePackagingElement<?> createRootElement(@NotNull String artifactName) {
|
||||
return new ArtifactRootElementImpl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class ArtifactType {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract CompositePackagingElement<?> createRootElement();
|
||||
public abstract CompositePackagingElement<?> createRootElement(@NotNull String artifactName);
|
||||
|
||||
public void checkRootElement(@NotNull CompositePackagingElement<?> rootElement, @NotNull Artifact artifact, @NotNull ArtifactValidationManager manager) {
|
||||
}
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class ArtifactConfigurable extends NamedConfigurable<Artifact> {
|
||||
final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
|
||||
if (!Comparing.equal(selected, getArtifact().getArtifactType())) {
|
||||
final CompositePackagingElement<?> element = myEditor.getRootElement();
|
||||
final CompositePackagingElement<?> newRootElement = selected.createRootElement();
|
||||
final CompositePackagingElement<?> newRootElement = selected.createRootElement(getArtifact().getName());
|
||||
myArtifactsStructureContext.getModifiableArtifactModel().getOrCreateModifiableArtifact(myOriginalArtifact).setArtifactType(selected);
|
||||
if (!newRootElement.getType().equals(element.getType())) {
|
||||
ArtifactUtil.copyChildren(element, newRootElement, myArtifactsStructureContext.getProject());
|
||||
|
||||
+12
@@ -23,6 +23,7 @@ import com.intellij.packaging.artifacts.ModifiableArtifact;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementType;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.elements.ArchivePackagingElement;
|
||||
import com.intellij.packaging.ui.ManifestFileConfiguration;
|
||||
import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
@@ -276,6 +277,17 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
final String oldDefaultPath = ArtifactUtil.getDefaultArtifactOutputPath(oldArtifactName, myProject);
|
||||
if (Comparing.equal(oldDefaultPath, getConfiguredOutputPath())) {
|
||||
setOutputPath(ArtifactUtil.getDefaultArtifactOutputPath(newArtifactName, myProject));
|
||||
final CompositePackagingElement<?> root = getRootElement();
|
||||
if (root instanceof ArchivePackagingElement) {
|
||||
final String name = ((ArchivePackagingElement)root).getArchiveFileName();
|
||||
final String fileName = FileUtil.getNameWithoutExtension(name);
|
||||
final String extension = FileUtil.getExtension(name);
|
||||
if (fileName.equals(oldArtifactName) && extension.length() > 0) {
|
||||
myLayoutTreeComponent.ensureRootIsWritable();
|
||||
((ArchivePackagingElement)getRootElement()).setArchiveFileName(newArtifactName + "." + extension);
|
||||
myLayoutTreeComponent.updateTreeNodesPresentation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user