mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: fix memory leak in dirdiff
installFileCompletion() with null Disposable will register itself on DialogWrapper from focused component (or on application-wide Disposable "ui"). We can show dirdiff in FrameWrapper/ToolWindow now, so we should provide right Disposable.
This commit is contained in:
@@ -55,7 +55,7 @@
|
|||||||
<constraints border-constraint="West"/>
|
<constraints border-constraint="West"/>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
<component id="ee75f" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="mySourceDirField">
|
<component id="ee75f" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="mySourceDirField" custom-create="true">
|
||||||
<constraints border-constraint="Center"/>
|
<constraints border-constraint="Center"/>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
<constraints border-constraint="West"/>
|
<constraints border-constraint="West"/>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
<component id="cc2ae" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myTargetDirField">
|
<component id="cc2ae" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myTargetDirField" custom-create="true">
|
||||||
<constraints border-constraint="Center"/>
|
<constraints border-constraint="Center"/>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -511,6 +511,9 @@ public class DirDiffPanel implements Disposable, DataProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createUIComponents() {
|
private void createUIComponents() {
|
||||||
|
mySourceDirField = new TextFieldWithBrowseButton(null, this);
|
||||||
|
myTargetDirField = new TextFieldWithBrowseButton(null, this);
|
||||||
|
|
||||||
final AtomicBoolean callUpdate = new AtomicBoolean(true);
|
final AtomicBoolean callUpdate = new AtomicBoolean(true);
|
||||||
myRootPanel = new JPanel(new BorderLayout()) {
|
myRootPanel = new JPanel(new BorderLayout()) {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,15 +41,23 @@ public class TextFieldWithBrowseButton extends ComponentWithBrowseButton<JTextFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TextFieldWithBrowseButton(JTextField field, @Nullable ActionListener browseActionListener) {
|
public TextFieldWithBrowseButton(JTextField field, @Nullable ActionListener browseActionListener) {
|
||||||
|
this(field, browseActionListener, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextFieldWithBrowseButton(JTextField field, @Nullable ActionListener browseActionListener, @Nullable Disposable parent) {
|
||||||
super(field, browseActionListener);
|
super(field, browseActionListener);
|
||||||
if (!(field instanceof JBTextField)) {
|
if (!(field instanceof JBTextField)) {
|
||||||
UIUtil.addUndoRedoActions(field);
|
UIUtil.addUndoRedoActions(field);
|
||||||
}
|
}
|
||||||
installPathCompletion(FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
|
installPathCompletion(FileChooserDescriptorFactory.createSingleLocalFileDescriptor(), parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextFieldWithBrowseButton(ActionListener browseActionListener) {
|
public TextFieldWithBrowseButton(ActionListener browseActionListener) {
|
||||||
this(new JBTextField(10/* to prevent field to be infinitely resized in grid-box layouts */), browseActionListener);
|
this(browseActionListener, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextFieldWithBrowseButton(ActionListener browseActionListener, Disposable parent) {
|
||||||
|
this(new JBTextField(10/* to prevent field to be infinitely resized in grid-box layouts */), browseActionListener, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBrowseFolderListener(@Nullable String title, @Nullable String description, @Nullable Project project, FileChooserDescriptor fileChooserDescriptor) {
|
public void addBrowseFolderListener(@Nullable String title, @Nullable String description, @Nullable Project project, FileChooserDescriptor fileChooserDescriptor) {
|
||||||
|
|||||||
Reference in New Issue
Block a user