mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
'Project Structure' dialog: request focus in content entry editor only on explicit user action (IDEA-170432)
This commit is contained in:
+13
-15
@@ -208,7 +208,7 @@ public class CommonContentEntriesEditor extends ModuleElementsEditor {
|
||||
for (final ContentEntry contentEntry : contentEntries) {
|
||||
addContentEntryPanel(contentEntry.getUrl());
|
||||
}
|
||||
selectContentEntry(contentEntries[0].getUrl());
|
||||
selectContentEntry(contentEntries[0].getUrl(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,8 +261,11 @@ public class CommonContentEntriesEditor extends ModuleElementsEditor {
|
||||
};
|
||||
}
|
||||
|
||||
void selectContentEntry(final String contentEntryUrl) {
|
||||
void selectContentEntry(final String contentEntryUrl, boolean requestFocus) {
|
||||
if (mySelectedEntryUrl != null && mySelectedEntryUrl.equals(contentEntryUrl)) {
|
||||
if (requestFocus) {
|
||||
myRootTreeEditor.requestFocus();
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -281,7 +284,9 @@ public class CommonContentEntriesEditor extends ModuleElementsEditor {
|
||||
final JComponent scroller = (JComponent)component.getParent();
|
||||
SwingUtilities.invokeLater(() -> scroller.scrollRectToVisible(component.getBounds()));
|
||||
myRootTreeEditor.setContentEntryEditor(editor);
|
||||
myRootTreeEditor.requestFocus();
|
||||
if (requestFocus) {
|
||||
myRootTreeEditor.requestFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,13 +351,13 @@ public class CommonContentEntriesEditor extends ModuleElementsEditor {
|
||||
}
|
||||
myEditorsPanel.revalidate();
|
||||
myEditorsPanel.repaint();
|
||||
selectContentEntry(contentEntriesArray[contentEntriesArray.length - 1].getUrl());
|
||||
selectContentEntry(contentEntriesArray[contentEntriesArray.length - 1].getUrl(), false);
|
||||
}
|
||||
|
||||
private final class MyContentEntryEditorListener extends ContentEntryEditorListenerAdapter {
|
||||
@Override
|
||||
public void editingStarted(@NotNull ContentEntryEditor editor) {
|
||||
selectContentEntry(editor.getContentEntryUrl());
|
||||
selectContentEntry(editor.getContentEntryUrl(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -363,21 +368,14 @@ public class CommonContentEntriesEditor extends ModuleElementsEditor {
|
||||
}
|
||||
final String nextContentEntryUrl = getNextContentEntry(entryUrl);
|
||||
removeContentEntryPanel(entryUrl);
|
||||
selectContentEntry(nextContentEntryUrl);
|
||||
selectContentEntry(nextContentEntryUrl, true);
|
||||
editor.removeContentEntryEditorListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigationRequested(@NotNull ContentEntryEditor editor, VirtualFile file) {
|
||||
if (mySelectedEntryUrl != null && mySelectedEntryUrl.equals(editor.getContentEntryUrl())) {
|
||||
myRootTreeEditor.requestFocus();
|
||||
myRootTreeEditor.select(file);
|
||||
}
|
||||
else {
|
||||
selectContentEntry(editor.getContentEntryUrl());
|
||||
myRootTreeEditor.requestFocus();
|
||||
myRootTreeEditor.select(file);
|
||||
}
|
||||
selectContentEntry(editor.getContentEntryUrl(), true);
|
||||
myRootTreeEditor.select(file);
|
||||
}
|
||||
|
||||
private void removeContentEntryPanel(final String contentEntryUrl) {
|
||||
|
||||
Reference in New Issue
Block a user