mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEADEV-40699: Artifacts dialog: "Show content of elements" options could be remembered
This commit is contained in:
+1
-2
@@ -25,7 +25,6 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -66,7 +65,7 @@ public class ProjectJdksConfigurable extends MasterDetailsComponent implements C
|
||||
super();
|
||||
myProject = project;
|
||||
myProjectJdksModel = ProjectJdksModel.getInstance(project);
|
||||
ServiceManager.getService(project, MasterDetailsStateService.class).register("ProjectJDKs.UI", this);
|
||||
MasterDetailsStateService.getInstance(project).register("ProjectJDKs.UI", this);
|
||||
initTree();
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -212,6 +212,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
}
|
||||
myShowContentCheckBox.setThirdStateEnabled(false);
|
||||
myLayoutTreeComponent.rebuildTree();
|
||||
onShowContentSettingsChanged();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -233,6 +234,10 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
return getMainComponent();
|
||||
}
|
||||
|
||||
private void onShowContentSettingsChanged() {
|
||||
((ArtifactsStructureConfigurableContextImpl)myContext.getParent()).getDefaultSettings().setTypesToShowContent(mySubstitutionParameters.getTypesToSubstitute());
|
||||
}
|
||||
|
||||
public void updateShowContentCheckbox() {
|
||||
final ThreeStateCheckBox.State state;
|
||||
if (mySubstitutionParameters.isAllSubstituted()) {
|
||||
@@ -246,6 +251,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
}
|
||||
myShowContentCheckBox.setThirdStateEnabled(state == ThreeStateCheckBox.State.DONT_CARE);
|
||||
myShowContentCheckBox.setState(state);
|
||||
onShowContentSettingsChanged();
|
||||
}
|
||||
|
||||
public ArtifactEditorSettings createSettings() {
|
||||
|
||||
+2
-1
@@ -81,7 +81,8 @@ public class ArtifactEditorSettings implements PersistentStateComponent<Artifact
|
||||
public static class ArtifactEditorSettingsState {
|
||||
@Tag("show-sorted")
|
||||
public boolean mySortElements = true;
|
||||
@AbstractCollection(elementTag = "show-content", elementValueAttribute = "type-id")
|
||||
@Tag("show-content")
|
||||
@AbstractCollection(surroundWithTag = false, elementTag = "type", elementValueAttribute = "id")
|
||||
public List<String> myTypesToShowContentIds = new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
@@ -29,6 +30,7 @@ import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.BaseStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
|
||||
import com.intellij.openapi.ui.MasterDetailsStateService;
|
||||
import com.intellij.packaging.artifacts.*;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
@@ -49,15 +51,17 @@ import java.util.*;
|
||||
public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
@NonNls private static final String DEFAULT_ARTIFACT_NAME = "unnamed";
|
||||
private ArtifactsStructureConfigurableContextImpl myPackagingEditorContext;
|
||||
private ArtifactEditorSettings myDefaultSettings = new ArtifactEditorSettings();
|
||||
|
||||
public ArtifactsStructureConfigurable(@NotNull Project project) {
|
||||
super(project);
|
||||
MasterDetailsStateService.getInstance(project).register("ArtifactsStructureConfigurable.UI", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(StructureConfigurableContext context) {
|
||||
super.init(context);
|
||||
myPackagingEditorContext = new ArtifactsStructureConfigurableContextImpl(myContext, myProject, new ArtifactAdapter() {
|
||||
myPackagingEditorContext = new ArtifactsStructureConfigurableContextImpl(myContext, myProject, myDefaultSettings, new ArtifactAdapter() {
|
||||
@Override
|
||||
public void artifactAdded(@NotNull Artifact artifact) {
|
||||
final MyNode node = addArtifactNode(artifact);
|
||||
@@ -96,6 +100,11 @@ public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
return node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PersistentStateComponent<?> getAdditionalSettings() {
|
||||
return myDefaultSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
myPackagingEditorContext.resetModifiableModel();
|
||||
|
||||
+8
-2
@@ -43,9 +43,11 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
|
||||
private Map<Artifact, CompositePackagingElement<?>> myModifiableRoots = new HashMap<Artifact, CompositePackagingElement<?>>();
|
||||
private Map<Artifact, ArtifactEditorImpl> myArtifactEditors = new HashMap<Artifact, ArtifactEditorImpl>();
|
||||
private Map<ArtifactPointer, ArtifactEditorSettings> myEditorSettings = new HashMap<ArtifactPointer, ArtifactEditorSettings>();
|
||||
private ArtifactEditorSettings myDefaultSettings = new ArtifactEditorSettings();
|
||||
private final ArtifactEditorSettings myDefaultSettings;
|
||||
|
||||
public ArtifactsStructureConfigurableContextImpl(StructureConfigurableContext context, Project project, final ArtifactAdapter modifiableModelListener) {
|
||||
public ArtifactsStructureConfigurableContextImpl(StructureConfigurableContext context, Project project,
|
||||
ArtifactEditorSettings defaultSettings, final ArtifactAdapter modifiableModelListener) {
|
||||
myDefaultSettings = defaultSettings;
|
||||
myModifiableModelListener = modifiableModelListener;
|
||||
myContext = context;
|
||||
myProject = project;
|
||||
@@ -123,6 +125,10 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
|
||||
return myModifiableModel;
|
||||
}
|
||||
|
||||
public ArtifactEditorSettings getDefaultSettings() {
|
||||
return myDefaultSettings;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModulesProvider getModulesProvider() {
|
||||
return myContext.getModulesConfigurator();
|
||||
|
||||
+1
@@ -101,6 +101,7 @@ public class LayoutTreeComponent implements DnDTarget, Disposable {
|
||||
public void setSortElements(boolean sortElements) {
|
||||
mySortElements = sortElements;
|
||||
myBuilder.setNodeDescriptorComparator(getComparator());
|
||||
((ArtifactsStructureConfigurableContextImpl)myArtifactsEditor.getContext().getParent()).getDefaultSettings().setSortElements(sortElements);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user