List of usage examples for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_DEFBRANCHSTARTPOINT
String CONFIG_KEY_DEFBRANCHSTARTPOINT
To view the source code for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_DEFBRANCHSTARTPOINT.
Click Source Link
From source file:org.eclipse.egit.ui.internal.dialogs.BranchSelectionAndEditDialog.java
License:Open Source License
/** * Creates button for creating a new branch. * * @param parent/*from w ww . j a va 2 s . com*/ * @return button */ protected Button createNewButton(Composite parent) { newButton = createButton(parent, NEW, UIText.BranchSelectionAndEditDialog_NewBranch, false); setButtonLayoutData(newButton); newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // try to read default source ref from git config // in the case that no base is selected in dialog String base = refNameFromDialog(); if (base == null) { String sourceRef = repo.getConfig().getString(ConfigConstants.CONFIG_WORKFLOW_SECTION, null, ConfigConstants.CONFIG_KEY_DEFBRANCHSTARTPOINT); try { Ref ref = repo.findRef(sourceRef); if (ref != null) { base = ref.getName(); } } catch (IOException e1) { // base = null; } } CreateBranchWizard wiz = new CreateBranchWizard(repo, base); if (new WizardDialog(getShell(), wiz).open() == Window.OK) { String newRefName = wiz.getNewBranchName(); try { branchTree.refresh(); markRef(Constants.R_HEADS + newRefName); if (newRefName.equals(repo.getBranch())) // close branch selection dialog when new branch was // already checked out from new branch wizard BranchSelectionAndEditDialog.this.okPressed(); } catch (Throwable e1) { reportError(e1, UIText.BranchSelectionAndEditDialog_ErrorCouldNotCreateNewRef, newRefName); } } } }); return newButton; }