use of org.eclipse.egit.ui.internal.components.BranchRebaseModeCombo in project egit by eclipse.
the class PullWizardPage method createControl.
@Override
public void createControl(Composite parent) {
try {
this.remoteConfigs = RemoteConfig.getAllRemoteConfigs(repository.getConfig());
Collections.sort(remoteConfigs, new Comparator<RemoteConfig>() {
@Override
public int compare(RemoteConfig first, RemoteConfig second) {
return String.CASE_INSENSITIVE_ORDER.compare(first.getName(), second.getName());
}
});
setDefaultUpstreamConfig();
} catch (URISyntaxException e) {
this.remoteConfigs = new ArrayList<>();
handleError(e);
}
Composite res = new Composite(parent, SWT.NONE);
res.setLayout(new GridLayout(3, false));
Label remoteLabel = new Label(res, SWT.NONE);
remoteLabel.setText(UIText.PushBranchPage_RemoteLabel);
this.remoteSelectionCombo = new RemoteSelectionCombo(res, SWT.NONE, SelectionType.PUSH);
GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteSelectionCombo);
setRemoteConfigs();
remoteSelectionCombo.addRemoteSelectionListener(new IRemoteSelectionListener() {
@Override
public void remoteSelected(RemoteConfig rc) {
remoteConfig = rc;
setRefAssist(rc);
checkPage();
}
});
Button newRemoteButton = new Button(res, SWT.PUSH);
newRemoteButton.setText(UIText.PushBranchPage_NewRemoteButton);
GridDataFactory.fillDefaults().applyTo(newRemoteButton);
newRemoteButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
showNewRemoteDialog();
}
});
Label branchNameLabel = new Label(res, SWT.NONE);
branchNameLabel.setText(UIText.PullWizardPage_referenceLabel);
branchNameLabel.setToolTipText(UIText.PullWizardPage_referenceTooltip);
remoteBranchNameText = new Text(res, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(remoteBranchNameText);
UIUtils.addRefContentProposalToText(remoteBranchNameText, this.repository, () -> {
if (PullWizardPage.this.assist != null) {
return PullWizardPage.this.assist.getRefsForContentAssist(false, true);
}
return Collections.emptyList();
}, true);
remoteBranchNameText.setText(getSuggestedBranchName());
remoteBranchNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
checkPage();
}
});
this.upstreamConfigComponent = new BranchRebaseModeCombo(res);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.BEGINNING, SWT.CENTER).applyTo(upstreamConfigComponent.getViewer().getCombo());
this.upstreamConfigComponent.getViewer().addSelectionChangedListener((event) -> upstreamConfig = upstreamConfigComponent.getRebaseMode());
if (upstreamConfig != null) {
upstreamConfigComponent.setRebaseMode(upstreamConfig);
}
if (this.fullBranch != null && this.fullBranch.startsWith(Constants.R_HEADS)) {
this.rememberConfigForBranch = new Button(res, SWT.CHECK);
GridData checkboxLayoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 3, 1);
checkboxLayoutData.verticalIndent = 20;
this.rememberConfigForBranch.setText(UIText.UpstreamConfigComponent_ConfigureUpstreamCheck);
this.rememberConfigForBranch.setToolTipText(UIText.UpstreamConfigComponent_ConfigureUpstreamToolTip);
this.rememberConfigForBranch.setLayoutData(checkboxLayoutData);
this.rememberConfigForBranch.setSelection(this.configureUpstream);
this.rememberConfigForBranch.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
configureUpstream = rememberConfigForBranch.getSelection();
checkPage();
}
});
}
setPageComplete(isPageComplete());
setControl(res);
}
use of org.eclipse.egit.ui.internal.components.BranchRebaseModeCombo in project egit by eclipse.
the class BranchConfigurationDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(new GridLayout(2, false));
GridDataFactory.fillDefaults().grab(true, true).applyTo(main);
Label remoteLabel = new Label(main, SWT.NONE);
remoteLabel.setText(UIText.BranchConfigurationDialog_RemoteLabel);
remoteText = new Combo(main, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(remoteText);
Label branchLabel = new Label(main, SWT.NONE);
branchLabel.setText(UIText.BranchConfigurationDialog_UpstreamBranchLabel);
branchText = new Combo(main, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(branchText);
// TODO do we have a constant somewhere?
// $NON-NLS-1$
remoteText.add(".");
for (String remote : myConfig.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION)) remoteText.add(remote);
remoteText.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateBranchItems();
}
});
rebase = new BranchRebaseModeCombo(main);
BranchRebaseMode rebaseMode = PullCommand.getRebaseMode(myBranchName, myConfig);
rebase.setRebaseMode(rebaseMode);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(rebase.getViewer().getCombo());
String branch = myConfig.getString(ConfigConstants.CONFIG_BRANCH_SECTION, myBranchName, ConfigConstants.CONFIG_KEY_MERGE);
if (branch == null)
// $NON-NLS-1$
branch = "";
branchText.setText(branch);
String remote = myConfig.getString(ConfigConstants.CONFIG_BRANCH_SECTION, myBranchName, ConfigConstants.CONFIG_KEY_REMOTE);
if (remote == null)
// $NON-NLS-1$
remote = "";
remoteText.setText(remote);
updateBranchItems();
applyDialogFont(main);
return main;
}
Aggregations