diff --git a/src/main/java/com/oxygenxml/git/view/actions/internal/AdvancedPullAction.java b/src/main/java/com/oxygenxml/git/view/actions/internal/AdvancedPullAction.java index 615ac23f..6e3bfd95 100644 --- a/src/main/java/com/oxygenxml/git/view/actions/internal/AdvancedPullAction.java +++ b/src/main/java/com/oxygenxml/git/view/actions/internal/AdvancedPullAction.java @@ -55,7 +55,7 @@ public void actionPerformed(ActionEvent e) { LOGGER.debug("Advanced pull action invoked"); } AdvancedPullDialog pullToConfigDialog = new AdvancedPullDialog(gitController); - pullToConfigDialog.setVisible(true); + pullToConfigDialog.showDialog(); if(pullToConfigDialog.getResult() == OKCancelDialog.RESULT_OK) { PullConfig pullConfig = pullToConfigDialog.getPullConfig(); if(pullConfig != null) { diff --git a/src/main/java/com/oxygenxml/git/view/actions/internal/SetRemoteAction.java b/src/main/java/com/oxygenxml/git/view/actions/internal/SetRemoteAction.java index 873e629c..8f63aa50 100644 --- a/src/main/java/com/oxygenxml/git/view/actions/internal/SetRemoteAction.java +++ b/src/main/java/com/oxygenxml/git/view/actions/internal/SetRemoteAction.java @@ -44,7 +44,7 @@ public void actionPerformed(ActionEvent arg0) { */ private void setRemote() { try { - new CurrentBranchRemotesDialog(); + new CurrentBranchRemotesDialog().showDialog(); } catch(RemoteNotFoundException ex) { if(ex.getStatus() == RemoteNotFoundException.STATUS_REMOTE_NOT_EXISTS) { OKCancelDialog addRemoteDialog = new AddRemoteDialog(); 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 0a976cb3..06f565f6 100644 --- a/src/main/java/com/oxygenxml/git/view/dialog/AdvancedPullDialog.java +++ b/src/main/java/com/oxygenxml/git/view/dialog/AdvancedPullDialog.java @@ -90,16 +90,24 @@ public class AdvancedPullDialog extends OKCancelDialog { /** * Constructor. - * - * @throws RemoteNotFoundException This exception appear when a remote is not found. */ - public AdvancedPullDialog(final GitController gitCtrl) throws RemoteNotFoundException { + public AdvancedPullDialog(final GitController gitCtrl) { super((JFrame) PluginWorkspaceProvider.getPluginWorkspace().getParentFrame(), TRANSLATOR.getTranslation(Tags.PULL), true); this.gitCtrl = gitCtrl; currentBranch = gitCtrl.getGitAccess().getBranchInfo().getBranchName(); + } + + + /** + * This message shows the dialog. + * + * @throws RemoteNotFoundException When the remote repository or branches cannot be found. + */ + public void showDialog() throws RemoteNotFoundException { + setOkButtonText(TRANSLATOR.getTranslation(Tags.PULL_CHANGES)); RemotesViewUtil.installRemoteBranchesRenderer(remoteBranchItems); @@ -120,6 +128,7 @@ public AdvancedPullDialog(final GitController gitCtrl) throws RemoteNotFoundExce setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setResizable(false); + setVisible(true); } @@ -272,7 +281,7 @@ public void actionPerformed(ActionEvent e) { @Override protected void doOK() { RemoteBranch currentSelectedBranch = (RemoteBranch) remoteBranchItems.getSelectedItem(); - if(!currentSelectedBranch.isUndefined()) { + if(!RemoteBranch.UNDEFINED_BRANCH.equals(currentSelectedBranch)) { pullConfig = PullConfig .builder() .branchName(Optional.of(currentSelectedBranch.getBranchFullName())) 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 36e715cd..55a084da 100644 --- a/src/main/java/com/oxygenxml/git/view/remotes/CurrentBranchRemotesDialog.java +++ b/src/main/java/com/oxygenxml/git/view/remotes/CurrentBranchRemotesDialog.java @@ -73,7 +73,15 @@ public CurrentBranchRemotesDialog() throws RemoteNotFoundException { setOkButtonText(TRANSLATOR.getTranslation(Tags.TRACK_BRANCH)); currentBranch = GitAccess.getInstance().getBranchInfo().getBranchName(); + } + + /** + * This message shows the dialog. + * + * @throws RemoteNotFoundException When the remote repository or branches cannot be found. + */ + public void showDialog() throws RemoteNotFoundException { try { RemotesViewUtil.installRemoteBranchesRenderer(remoteBranchItems); RemotesViewUtil.addRemoteBranches(remoteBranchItems, currentBranch); @@ -95,8 +103,8 @@ public CurrentBranchRemotesDialog() throws RemoteNotFoundException { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - this.setVisible(true); this.setResizable(false); + this.setVisible(true); }