mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
artifact ui fixes
This commit is contained in:
+2
-1
@@ -12,6 +12,7 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactManager;
|
||||
import com.intellij.packaging.elements.ArtifactAntGenerationContext;
|
||||
import com.intellij.packaging.elements.ArtifactRootElement;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -40,7 +41,7 @@ public class ArtifactAntGenerationContextImpl implements ArtifactAntGenerationCo
|
||||
myGenerationOptions = generationOptions;
|
||||
for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
|
||||
final String outputPath = artifact.getOutputPath();
|
||||
if (!StringUtil.isEmpty(outputPath) && artifact.isClearOutputDirectoryOnRebuild()) {
|
||||
if (!StringUtil.isEmpty(outputPath) && artifact.getRootElement() instanceof ArtifactRootElement<?>) {
|
||||
myArtifactsToClean.add(artifact);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,14 +27,12 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
|
||||
private Map<ArtifactPropertiesProvider, ArtifactProperties<?>> myProperties;
|
||||
|
||||
public ArtifactImpl(@NotNull String name, @NotNull ArtifactType artifactType, boolean buildOnMake, @NotNull CompositePackagingElement<?> rootElement,
|
||||
String outputPath,
|
||||
boolean clearOutputDirectoryOnRebuild) {
|
||||
String outputPath) {
|
||||
myName = name;
|
||||
myArtifactType = artifactType;
|
||||
myBuildOnMake = buildOnMake;
|
||||
myRootElement = rootElement;
|
||||
myOutputPath = outputPath;
|
||||
myClearOutputDirectoryOnRebuild = clearOutputDirectoryOnRebuild;
|
||||
myProperties = new HashMap<ArtifactPropertiesProvider, ArtifactProperties<?>>();
|
||||
for (ArtifactPropertiesProvider provider : ArtifactPropertiesProvider.getProviders()) {
|
||||
if (provider.isAvailableFor(artifactType)) {
|
||||
@@ -61,14 +59,6 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
|
||||
return myRootElement;
|
||||
}
|
||||
|
||||
public void setClearOutputDirectoryOnRebuild(boolean clearOutputDirectoryOnRebuild) {
|
||||
myClearOutputDirectoryOnRebuild = clearOutputDirectoryOnRebuild;
|
||||
}
|
||||
|
||||
public boolean isClearOutputDirectoryOnRebuild() {
|
||||
return myClearOutputDirectoryOnRebuild;
|
||||
}
|
||||
|
||||
public String getOutputPath() {
|
||||
return myOutputPath;
|
||||
}
|
||||
@@ -78,8 +68,7 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
|
||||
}
|
||||
|
||||
public ArtifactImpl createCopy() {
|
||||
final ArtifactImpl artifact = new ArtifactImpl(myName, myArtifactType, myBuildOnMake, myRootElement, myOutputPath,
|
||||
myClearOutputDirectoryOnRebuild);
|
||||
final ArtifactImpl artifact = new ArtifactImpl(myName, myArtifactType, myBuildOnMake, myRootElement, myOutputPath);
|
||||
for (Map.Entry<ArtifactPropertiesProvider, ArtifactProperties<?>> entry : myProperties.entrySet()) {
|
||||
final ArtifactProperties newProperties = artifact.myProperties.get(entry.getKey());
|
||||
//noinspection unchecked
|
||||
@@ -126,7 +115,6 @@ public class ArtifactImpl extends UserDataHolderBase implements ModifiableArtifa
|
||||
myOutputPath = modified.getOutputPath();
|
||||
myBuildOnMake = modified.isBuildOnMake();
|
||||
myRootElement = modified.getRootElement();
|
||||
myClearOutputDirectoryOnRebuild = modified.isClearOutputDirectoryOnRebuild();
|
||||
myProperties = modified.myProperties;
|
||||
myArtifactType = modified.getArtifactType();
|
||||
}
|
||||
|
||||
+1
-3
@@ -81,7 +81,6 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
|
||||
artifactState.setOutputPath(artifact.getOutputPath());
|
||||
artifactState.setRootElement(serializePackagingElement(artifact.getRootElement()));
|
||||
artifactState.setArtifactType(artifact.getArtifactType().getId());
|
||||
artifactState.setClearOutputOnRebuild(artifact.isClearOutputDirectoryOnRebuild());
|
||||
for (ArtifactPropertiesProvider provider : artifact.getPropertiesProviders()) {
|
||||
final ArtifactPropertiesState propertiesState = serializeProperties(provider, artifact.getProperties(provider));
|
||||
if (propertiesState != null) {
|
||||
@@ -155,8 +154,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
|
||||
rootElement = type.createRootElement(artifactName);
|
||||
}
|
||||
|
||||
final ArtifactImpl artifact = new ArtifactImpl(artifactName, type, state.isBuildOnMake(), rootElement, state.getOutputPath(),
|
||||
state.isClearOutputOnRebuild());
|
||||
final ArtifactImpl artifact = new ArtifactImpl(artifactName, type, state.isBuildOnMake(), rootElement, state.getOutputPath());
|
||||
final List<ArtifactPropertiesState> propertiesList = state.getPropertiesList();
|
||||
for (ArtifactPropertiesState propertiesState : propertiesList) {
|
||||
final ArtifactPropertiesProvider provider = ArtifactPropertiesProvider.findById(propertiesState.getId());
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ArtifactModelImpl extends ArtifactModelBase implements ModifiableAr
|
||||
|
||||
final String artifactName = generateUniqueName(name);
|
||||
final CompositePackagingElement<?> rootElement = artifactType.createRootElement(artifactName);
|
||||
final ArtifactImpl artifact = new ArtifactImpl(artifactName, artifactType, false, rootElement, outputPath, true);
|
||||
final ArtifactImpl artifact = new ArtifactImpl(artifactName, artifactType, false, rootElement, outputPath);
|
||||
myOriginalArtifacts.add(artifact);
|
||||
myArtifact2ModifiableCopy.put(artifact, artifact);
|
||||
myModifiable2Original.put(artifact, artifact);
|
||||
|
||||
@@ -20,7 +20,6 @@ public class ArtifactState {
|
||||
private String myOutputPath;
|
||||
private String myArtifactType = PlainArtifactType.ID;
|
||||
private boolean myBuildOnMake;
|
||||
private boolean myClearOutputOnRebuild;
|
||||
private Element myRootElement;
|
||||
private List<ArtifactPropertiesState> myPropertiesList = new ArrayList<ArtifactPropertiesState>();
|
||||
|
||||
@@ -49,11 +48,6 @@ public class ArtifactState {
|
||||
return myRootElement;
|
||||
}
|
||||
|
||||
@Attribute("clear-output-on-rebuild")
|
||||
public boolean isClearOutputOnRebuild() {
|
||||
return myClearOutputOnRebuild;
|
||||
}
|
||||
|
||||
@Property(surroundWithTag = false)
|
||||
@AbstractCollection(surroundWithTag = false)
|
||||
public List<ArtifactPropertiesState> getPropertiesList() {
|
||||
@@ -72,10 +66,6 @@ public class ArtifactState {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public void setClearOutputOnRebuild(boolean clearOutputOnRebuild) {
|
||||
myClearOutputOnRebuild = clearOutputOnRebuild;
|
||||
}
|
||||
|
||||
public void setOutputPath(String outputPath) {
|
||||
myOutputPath = outputPath;
|
||||
}
|
||||
|
||||
@@ -28,5 +28,4 @@ public interface Artifact extends UserDataHolder {
|
||||
|
||||
ArtifactProperties<?> getProperties(@NotNull ArtifactPropertiesProvider propertiesProvider);
|
||||
|
||||
boolean isClearOutputDirectoryOnRebuild();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,4 @@ public interface ModifiableArtifact extends Artifact {
|
||||
void setProperties(ArtifactPropertiesProvider provider, ArtifactProperties<?> properties);
|
||||
|
||||
void setArtifactType(@NotNull ArtifactType selected);
|
||||
|
||||
void setClearOutputDirectoryOnRebuild(boolean clearOutputDirectoryOnRebuild);
|
||||
}
|
||||
|
||||
-4
@@ -51,7 +51,6 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
private TextFieldWithBrowseButton myOutputDirectoryField;
|
||||
private JCheckBox myShowIncludedCheckBox;
|
||||
private JPanel myEditorPanel;
|
||||
private JCheckBox myClearOnRebuildCheckBox;
|
||||
private JPanel myErrorPanelPlace;
|
||||
private Splitter mySplitter;
|
||||
private final Project myProject;
|
||||
@@ -75,7 +74,6 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
Disposer.register(this, mySourceItemsTree);
|
||||
Disposer.register(this, myLayoutTreeComponent);
|
||||
myBuildOnMakeCheckBox.setSelected(artifact.isBuildOnMake());
|
||||
myClearOnRebuildCheckBox.setSelected(artifact.isClearOutputDirectoryOnRebuild());
|
||||
final String outputPath = artifact.getOutputPath();
|
||||
myOutputDirectoryField.addBrowseFolderListener(CompilerBundle.message("dialog.title.output.directory.for.artifact"),
|
||||
CompilerBundle.message("chooser.description.select.output.directory.for.0.artifact",
|
||||
@@ -93,7 +91,6 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
public void apply() {
|
||||
final ModifiableArtifact modifiableArtifact = myContext.getModifiableArtifactModel().getOrCreateModifiableArtifact(myOriginalArtifact);
|
||||
modifiableArtifact.setBuildOnMake(myBuildOnMakeCheckBox.isSelected());
|
||||
modifiableArtifact.setClearOutputDirectoryOnRebuild(myClearOnRebuildCheckBox.isSelected());
|
||||
modifiableArtifact.setOutputPath(getConfiguredOutputPath());
|
||||
myPropertiesEditors.applyProperties();
|
||||
myLayoutTreeComponent.saveElementProperties();
|
||||
@@ -261,7 +258,6 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
public boolean isModified() {
|
||||
return myBuildOnMakeCheckBox.isSelected() != myOriginalArtifact.isBuildOnMake()
|
||||
|| !Comparing.equal(getConfiguredOutputPath(), myOriginalArtifact.getOutputPath())
|
||||
|| myClearOnRebuildCheckBox.isSelected() != myOriginalArtifact.isClearOutputDirectoryOnRebuild()
|
||||
|| myPropertiesEditors.isModified()
|
||||
|| myLayoutTreeComponent.isPropertiesModified();
|
||||
}
|
||||
|
||||
+2
-10
@@ -30,7 +30,7 @@
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<grid id="a20c9" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="a20c9" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -46,17 +46,9 @@
|
||||
<text resource-bundle="messages/ProjectBundle" key="checkbox.text.build.on.make"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="9faaa" class="javax.swing.JCheckBox" binding="myClearOnRebuildCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Clear output directory on &rebuild"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="7bcaa">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
|
||||
@@ -158,7 +158,7 @@ node.text.0.with.dependencies=''{0}'' with dependencies
|
||||
element.type.name.module.output=Module Output
|
||||
element.type.name.directory=Directory
|
||||
element.type.name.archive=Archive
|
||||
artifact.type.plain=Plain
|
||||
artifact.type.plain=Other
|
||||
|
||||
incremental.packaging.compiler.description=Incremental packaging compiler
|
||||
packaging.method.name.do.not.package=Do not package
|
||||
|
||||
Reference in New Issue
Block a user