use of org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider in project egit by eclipse.
the class SynchronizeFetchJob method runInWorkspace.
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
SubMonitor progress = SubMonitor.convert(monitor, gsdSet.size());
progress.setTaskName(UIText.SynchronizeFetchJob_TaskName);
for (GitSynchronizeData gsd : gsdSet) {
Repository repo = gsd.getRepository();
StoredConfig repoConfig = repo.getConfig();
String remoteName = gsd.getDstRemoteName();
if (remoteName == null) {
progress.worked(1);
continue;
}
progress.subTask(NLS.bind(UIText.SynchronizeFetchJob_SubTaskName, remoteName));
RemoteConfig config;
try {
config = new RemoteConfig(repoConfig, remoteName);
} catch (URISyntaxException e) {
Activator.logError(e.getMessage(), e);
progress.worked(1);
continue;
}
FetchOperationUI fetchOperationUI = new FetchOperationUI(repo, config, timeout, false);
fetchOperationUI.setCredentialsProvider(new EGitCredentialsProvider());
try {
fetchOperationUI.execute(progress.newChild(1));
gsd.updateRevs();
} catch (Exception e) {
showInformationDialog(remoteName);
Activator.logError(e.getMessage(), e);
}
}
return Status.OK_STATUS;
}
use of org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider in project egit by eclipse.
the class RefSpecPage method revalidateImpl.
private void revalidateImpl(final RepositorySelection newRepoSelection) {
final ListRemoteOperation listRemotesOp;
try {
final URIish uri;
uri = newRepoSelection.getURI(pushPage);
int timeout = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
listRemotesOp = new ListRemoteOperation(local, uri, timeout);
if (credentials != null)
listRemotesOp.setCredentialsProvider(new EGitCredentialsProvider(credentials.getUser(), credentials.getPassword()));
getContainer().run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
listRemotesOp.run(monitor);
}
});
} catch (InvocationTargetException e) {
final Throwable cause = e.getCause();
transportError(cause.getMessage());
Activator.handleError(UIText.RefSpecPage_errorTransportDialogMessage, cause, true);
return;
} catch (InterruptedException e) {
transportError(UIText.RefSpecPage_operationCancelled);
return;
}
this.validatedRepoSelection = newRepoSelection;
specsPanel.setAssistanceData(local, listRemotesOp.getRemoteRefs(), currentRepoSelection.getConfig());
if (newRepoSelection.isConfigSelected()) {
saveButton.setVisible(true);
saveButton.setText(NLS.bind(UIText.RefSpecPage_saveSpecifications, currentRepoSelection.getConfigName()));
saveButton.getParent().layout();
if (!pushPage) {
tagsAutoFollowButton.setSelection(false);
tagsFetchTagsButton.setSelection(false);
tagsNoTagsButton.setSelection(false);
final TagOpt tagOpt = newRepoSelection.getConfig().getTagOpt();
switch(tagOpt) {
case AUTO_FOLLOW:
tagsAutoFollowButton.setSelection(true);
break;
case FETCH_TAGS:
tagsFetchTagsButton.setSelection(true);
break;
case NO_TAGS:
tagsNoTagsButton.setSelection(true);
break;
}
}
} else if (!pushPage)
tagsAutoFollowButton.setSelection(true);
checkPage();
}
use of org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider in project egit by eclipse.
the class SourceBranchPage method revalidateImpl.
private void revalidateImpl(final RepositorySelection newRepoSelection) {
if (label.isDisposed() || !isCurrentPage())
return;
final ListRemoteOperation listRemoteOp;
final URIish uri = newRepoSelection.getURI();
try {
int timeout = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
listRemoteOp = new ListRemoteOperation(uri, timeout);
if (credentials != null)
listRemoteOp.setCredentialsProvider(new EGitCredentialsProvider(credentials.getUser(), credentials.getPassword()));
getContainer().run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
listRemoteOp.run(monitor);
}
});
} catch (InvocationTargetException e) {
Throwable why = e.getCause();
transportError(why);
if (showDetailedFailureDialog())
SourceBranchFailureDialog.show(getShell(), uri);
return;
} catch (InterruptedException e) {
transportError(UIText.SourceBranchPage_remoteListingCancelled);
return;
}
final Ref idHEAD = listRemoteOp.getRemoteRef(Constants.HEAD);
head = null;
boolean headIsMaster = false;
final String masterBranchRef = Constants.R_HEADS + Constants.MASTER;
for (final Ref r : listRemoteOp.getRemoteRefs()) {
final String n = r.getName();
if (!n.startsWith(Constants.R_HEADS)) {
continue;
}
availableRefs.add(r);
if (idHEAD == null || headIsMaster) {
continue;
}
ObjectId objectId = r.getObjectId();
if (objectId == null) {
continue;
}
if (objectId.equals(idHEAD.getObjectId())) {
headIsMaster = masterBranchRef.equals(r.getName());
if (head == null || headIsMaster) {
head = r;
}
}
}
Collections.sort(availableRefs, new Comparator<Ref>() {
@Override
public int compare(final Ref o1, final Ref o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
if (idHEAD != null && head == null) {
head = idHEAD;
availableRefs.add(0, idHEAD);
}
validatedRepoSelection = newRepoSelection;
refsViewer.setInput(availableRefs);
refsViewer.setAllChecked(true);
checkPage();
checkForEmptyRepo();
}
use of org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider in project egit by eclipse.
the class PushTagsWizard method startPush.
private void startPush() throws IOException {
PushOperationResult result = confirmationPage.getConfirmedResult();
PushOperationSpecification pushSpec = result.deriveSpecification(confirmationPage.isRequireUnchangedSelected());
PushOperationUI pushOperationUI = new PushOperationUI(repository, pushSpec, false);
pushOperationUI.setCredentialsProvider(new EGitCredentialsProvider());
pushOperationUI.setShowConfigureButton(false);
if (confirmationPage.isShowOnlyIfChangedSelected())
pushOperationUI.setExpectedResult(confirmationPage.getConfirmedResult());
pushOperationUI.start();
}
use of org.eclipse.egit.ui.internal.credentials.EGitCredentialsProvider in project egit by eclipse.
the class PushBranchWizard method startPush.
private void startPush() throws IOException {
PushOperationResult result = confirmationPage.getConfirmedResult();
PushOperationSpecification pushSpec = result.deriveSpecification(confirmationPage.isRequireUnchangedSelected());
PushOperationUI pushOperationUI = new PushOperationUI(repository, pushSpec, false);
pushOperationUI.setCredentialsProvider(new EGitCredentialsProvider());
pushOperationUI.setShowConfigureButton(false);
if (confirmationPage.isShowOnlyIfChangedSelected())
pushOperationUI.setExpectedResult(result);
pushOperationUI.start();
}
Aggregations