diff --git a/src/main/java/com/oxygenxml/git/view/dialog/AdvancedPullDialog.java b/src/main/java/com/oxygenxml/git/view/dialog/AdvancedPullDialog.java index 3d23df39..f0290d55 100644 --- a/src/main/java/com/oxygenxml/git/view/dialog/AdvancedPullDialog.java +++ b/src/main/java/com/oxygenxml/git/view/dialog/AdvancedPullDialog.java @@ -97,7 +97,20 @@ public AdvancedPullDialog(final GitController gitCtrl) { true); this.gitCtrl = gitCtrl; - currentBranch = gitCtrl.getGitAccess().getBranchInfo().getBranchName(); + this.currentBranch = gitCtrl.getGitAccess().getBranchInfo().getBranchName(); + + setOkButtonText(TRANSLATOR.getTranslation(Tags.PULL_CHANGES)); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + JFrame parentFrame = PluginWorkspaceProvider.getPluginWorkspace() != null ? + (JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame() : null; + if (parentFrame != null) { + setIconImage(parentFrame.getIconImage()); + setLocationRelativeTo(parentFrame); + } + + RemotesViewUtil.installRemoteBranchesRenderer(remoteBranchItems); } @@ -109,27 +122,13 @@ public AdvancedPullDialog(final GitController gitCtrl) { * @throws URISyntaxException When a URI syntax exception appear. */ public void showDialog() throws RemoteNotFoundException, NoRepositorySelected, URISyntaxException { - - setOkButtonText(TRANSLATOR.getTranslation(Tags.PULL_CHANGES)); - - RemotesViewUtil.installRemoteBranchesRenderer(remoteBranchItems); loadRemotesRepositories(); getContentPane().add(createGUIPanel()); - + pack(); repaint(); - - JFrame parentFrame = PluginWorkspaceProvider.getPluginWorkspace() != null ? - (JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame() : null; - if (parentFrame != null) { - setIconImage(parentFrame.getIconImage()); - setLocationRelativeTo(parentFrame); - } - - setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - - this.setResizable(false); + setVisible(true); } diff --git a/src/main/java/com/oxygenxml/git/view/remotes/CurrentBranchRemotesDialog.java b/src/main/java/com/oxygenxml/git/view/remotes/CurrentBranchRemotesDialog.java index 55a084da..9784e3ea 100644 --- a/src/main/java/com/oxygenxml/git/view/remotes/CurrentBranchRemotesDialog.java +++ b/src/main/java/com/oxygenxml/git/view/remotes/CurrentBranchRemotesDialog.java @@ -72,7 +72,19 @@ public CurrentBranchRemotesDialog() throws RemoteNotFoundException { ); setOkButtonText(TRANSLATOR.getTranslation(Tags.TRACK_BRANCH)); + setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + setResizable(false); + + JFrame parentFrame = PluginWorkspaceProvider.getPluginWorkspace() != null ? + (JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame() : null; + if (parentFrame != null) { + setIconImage(parentFrame.getIconImage()); + setLocationRelativeTo(parentFrame); + } + currentBranch = GitAccess.getInstance().getBranchInfo().getBranchName(); + + RemotesViewUtil.installRemoteBranchesRenderer(remoteBranchItems); } @@ -83,7 +95,6 @@ public CurrentBranchRemotesDialog() throws RemoteNotFoundException { */ public void showDialog() throws RemoteNotFoundException { try { - RemotesViewUtil.installRemoteBranchesRenderer(remoteBranchItems); RemotesViewUtil.addRemoteBranches(remoteBranchItems, currentBranch); } catch (NoRepositorySelected | URISyntaxException e) { LOGGER.error(e.getMessage(), e); @@ -94,17 +105,7 @@ public void showDialog() throws RemoteNotFoundException { pack(); repaint(); - JFrame parentFrame = PluginWorkspaceProvider.getPluginWorkspace() != null ? - (JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame() : null; - if (parentFrame != null) { - setIconImage(parentFrame.getIconImage()); - setLocationRelativeTo(parentFrame); - } - - setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - - this.setResizable(false); - this.setVisible(true); + setVisible(true); }