Skip to content

Commit

Permalink
Fix #139 relative config causes UI hang.
Browse files Browse the repository at this point in the history
  • Loading branch information
groboclown committed Feb 23, 2017
1 parent 57e52f3 commit 0edd225
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public boolean equals(Object o) {

public void setName(@Nullable String name) {
this.name = name;
reload();

// Note: do not reload when the name is set. This can be costly in terms
// of performance. See #139.
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

package net.groboclown.idea.p4ic.ui.config.props;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
Expand All @@ -40,20 +39,10 @@ public class RelativeConfigPartPanel

RelativeConfigPartPanel(@NotNull Project project, @NotNull final RelativeConfigCompositePart part) {
super(project, part);
final String name = part.getName();
if (name == null) {
nameField.setText(DEFAULT_FILE_NAME);
// Setting the name will trigger a reload, so do that in the background
// See #139
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
part.setName(DEFAULT_FILE_NAME);
}
});
} else {
nameField.setText(name);
if (part.getName() != null) {
part.setName(DEFAULT_FILE_NAME);
}
nameField.setText(part.getName());
}

@Nls
Expand All @@ -72,7 +61,7 @@ public JPanel getRootPanel() {
@Override
public void updateConfigPartFromUI() {
getConfigPart().setName(nameField.getText());
LOG.info("Set relative config file name to " + getConfigPart().getName());
LOG.debug("Set relative config file name to " + getConfigPart().getName());
}

@NotNull
Expand Down

0 comments on commit 0edd225

Please sign in to comment.