mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: set correct window title on fail
This commit is contained in:
@@ -99,7 +99,7 @@ public class CompositeDiffPanel implements DiffViewer {
|
||||
}
|
||||
|
||||
if (myMap.isEmpty()) {
|
||||
final ErrorDiffViewer errorDiffViewer = new ErrorDiffViewer(request);
|
||||
final ErrorDiffViewer errorDiffViewer = new ErrorDiffViewer(myWindow, request);
|
||||
final Content content = myUi.createContent(FICTIVE_KEY, errorDiffViewer.getComponent(), FICTIVE_KEY, null,
|
||||
errorDiffViewer.getPreferredFocusedComponent());
|
||||
content.setCloseable(false);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ErrorDiffViewer implements DiffViewer {
|
||||
@NotNull private final JPanel myPanel;
|
||||
@NotNull private final DiffToolbarComponent myToolbar;
|
||||
|
||||
protected ErrorDiffViewer(@NotNull DiffRequest request) {
|
||||
protected ErrorDiffViewer(Window window, @NotNull DiffRequest request) {
|
||||
myRequest = request;
|
||||
|
||||
myPanel = new AbstractDataProviderPanel(new BorderLayout(), false) {
|
||||
@@ -84,6 +84,16 @@ public class ErrorDiffViewer implements DiffViewer {
|
||||
|
||||
final JPanel messagePanel = createMessagePanel(message);
|
||||
myPanel.add(messagePanel, BorderLayout.CENTER);
|
||||
|
||||
setWindowTitle(window, request.getWindowTitle());
|
||||
}
|
||||
|
||||
private static void setWindowTitle(Window window, String title) {
|
||||
if (title == null || title.isEmpty()) title = "Diff";
|
||||
if (window instanceof JDialog) {
|
||||
((JDialog)window).setTitle(title);
|
||||
}
|
||||
else if (window instanceof JFrame) ((JFrame)window).setTitle(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user