-
Notifications
You must be signed in to change notification settings - Fork 21
Switch branch Action #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aarnapant-sap
wants to merge
4
commits into
abapGit:master
Choose a base branch
from
aarnapant-sap:switchBranchAction
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Switch branch Action #286
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...apgit.adt.ui/src/org/abapgit/adt/ui/internal/repositories/actions/SwitchbranchAction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.abapgit.adt.ui.internal.repositories.actions; | ||
|
||
import org.abapgit.adt.backend.model.abapgitrepositories.IRepository; | ||
import org.abapgit.adt.ui.AbapGitUIPlugin; | ||
import org.abapgit.adt.ui.internal.i18n.Messages; | ||
import org.abapgit.adt.ui.internal.repositories.AbapGitView; | ||
import org.abapgit.adt.ui.internal.repositories.IAbapGitRepositoriesView; | ||
import org.abapgit.adt.ui.internal.wizards.AbapGitWizardSwitchBranch; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.jface.action.Action; | ||
import org.eclipse.jface.wizard.WizardDialog; | ||
import org.eclipse.ui.IViewPart; | ||
import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
|
||
import com.sap.adt.tools.core.project.AdtProjectServiceFactory; | ||
|
||
public class SwitchbranchAction extends Action { | ||
|
||
private IRepository selRepo; | ||
private final IViewPart AbapGitView; | ||
private IProject project; | ||
|
||
public SwitchbranchAction(IViewPart view) { | ||
super(Messages.AbapGitView_action_switch_branch); | ||
setToolTipText(Messages.AbapGitView_action_switch_branch); | ||
|
||
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(AbapGitUIPlugin.PLUGIN_ID, "/icons/etool/branches_obj.png")); //$NON-NLS-1$ | ||
this.AbapGitView = view; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
this.project = getProject(); | ||
this.selRepo = getRepository(); | ||
if (this.selRepo != null) { | ||
String destination = AdtProjectServiceFactory.createProjectService().getDestinationId(this.project); | ||
WizardDialog dialog = new WizardDialog(this.AbapGitView.getViewSite().getShell(), | ||
new AbapGitWizardSwitchBranch(this.project, this.selRepo, destination)); | ||
dialog.open(); | ||
} | ||
|
||
((AbapGitView) this.AbapGitView).refresh(); | ||
|
||
} | ||
|
||
private IRepository getRepository() { | ||
return ((IAbapGitRepositoriesView) this.AbapGitView).getRepositorySelection(); | ||
} | ||
|
||
private IProject getProject() { | ||
return ((IAbapGitRepositoriesView) this.AbapGitView).getProject(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...t.ui/src/org/abapgit/adt/ui/internal/wizards/AbapGitWizardPageSwitchBranchAndPackage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.abapgit.adt.ui.internal.wizards; | ||
|
||
import org.abapgit.adt.ui.internal.i18n.Messages; | ||
import org.abapgit.adt.ui.internal.wizards.AbapGitWizard.CloneData; | ||
import org.eclipse.core.resources.IProject; | ||
|
||
public class AbapGitWizardPageSwitchBranchAndPackage extends AbapGitWizardPageBranchAndPackage { | ||
|
||
public AbapGitWizardPageSwitchBranchAndPackage(IProject project, String destination, CloneData cloneData, Boolean pullAction) { | ||
super(project, destination, cloneData, pullAction); | ||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like in case of credentials page, here as well the pullAction will be false always. |
||
setTitle(Messages.AbapGitWizardPageSwitch_branch_selection_title); | ||
setDescription(Messages.AbapGitWizardPageSwitch_select_branch_description); | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean visible) { | ||
super.setVisible(visible); | ||
|
||
if (visible) { | ||
this.comboBranches.getCombo().setEnabled(true); | ||
// hiding the pull after link checkbox | ||
this.checkbox_lnp.setVisible(false); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean canFlipToNextPage() { | ||
return false; | ||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
....ui/src/org/abapgit/adt/ui/internal/wizards/AbapGitWizardPageSwitchBranchCredentials.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.abapgit.adt.ui.internal.wizards; | ||
|
||
import org.abapgit.adt.backend.model.abapgitexternalrepo.AccessMode; | ||
import org.abapgit.adt.ui.internal.i18n.Messages; | ||
import org.abapgit.adt.ui.internal.wizards.AbapGitWizard.CloneData; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.jface.dialogs.DialogPage; | ||
|
||
public class AbapGitWizardPageSwitchBranchCredentials extends AbapGitWizardPageRepositoryAndCredentials { | ||
|
||
private final CloneData cloneData; | ||
|
||
public AbapGitWizardPageSwitchBranchCredentials(IProject project, String destination, CloneData cloneData) { | ||
super(project, destination, cloneData, false); | ||
this.cloneData = cloneData; | ||
setTitle(Messages.AbapGitWizardPageSwitch_branch_credentials_title); | ||
setDescription(Messages.AbapGitWizardPageSwitch_credentials_description); | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean visible) { | ||
//Navigate to branch selection page if repo is public | ||
if (this.cloneData.externalRepoInfo != null && this.cloneData.externalRepoInfo.getAccessMode() == AccessMode.PUBLIC) { | ||
getContainer().showPage(getNextPage()); | ||
getContainer().getCurrentPage().setVisible(visible); | ||
getContainer().getCurrentPage().setPreviousPage(getContainer().getCurrentPage()); | ||
return; | ||
} | ||
|
||
super.setVisible(visible); | ||
} | ||
|
||
@Override | ||
public boolean validateAll() { | ||
if (!validateClientOnly()) { | ||
return false; | ||
} | ||
|
||
fetchRepositories(); | ||
if (this.cloneData.repositories == null) { | ||
return false; | ||
} | ||
|
||
if (this.cloneData.externalRepoInfo == null) { | ||
fetchExternalRepoInfo(); | ||
if (this.cloneData.externalRepoInfo == null) { | ||
return false; | ||
} | ||
} | ||
if (this.cloneData.externalRepoInfo.getAccessMode() == AccessMode.PRIVATE) { | ||
if (!this.txtUser.isVisible()) { | ||
setUserAndPassControlsVisible(true); | ||
this.txtUser.setFocus(); | ||
setPageComplete(false); | ||
setMessage(Messages.AbapGitWizardPageRepositoryAndCredentials_repo_is_private, DialogPage.INFORMATION); | ||
return false; | ||
} else { | ||
// update the info, now that we have proper user/password | ||
if (!fetchExternalRepoInfo()) { | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can keep this view variable typed to AbapGitView itself i.e.
private final AbapGitView view
.