Source:
public void run() { Repository localRepo = new FindLocalRepository(gerritClient, changeInfo.getProject()).getRepository(); Boolean reActivateWorkspaceRevision = true; if (localRepo == null) { Status status = new Status(IStatus.ERROR, EGerritCorePlugin.PLUGIN_ID, Messages.CheckoutRevision_1); ErrorDialog.openError(getShell(), Messages.CheckoutRevision_2, Messages.CheckoutRevision_3, status); return; } String psSelected = revision.getRef(); if ((psSelected == null) || psSelected.isEmpty()) { Status status = new Status(IStatus.ERROR, EGerritCorePlugin.PLUGIN_ID, Messages.CheckoutRevision_4); ErrorDialog.openError(getShell(), Messages.CheckoutRevision_2, Messages.CheckoutRevision_3, status); } Map<String, BranchMatch> potentialBranches = findAllPotentialBranches(localRepo); if (potentialBranches.size() > 1) { branchUiSelection(localRepo, potentialBranches); } else { if (potentialBranches.isEmpty()) { FetchGerritChangeWizard var = new FetchGerritChangeWizard(localRepo, psSelected); WizardDialog w = new WizardDialog(getShell(), var); w.create(); int ret = w.open(); if (ret == Window.CANCEL) { reActivateWorkspaceRevision = false; } } else if (!potentialBranches.entrySet().iterator().next().getValue().equals(BranchMatch.PERFECT_MATCH)) { branchUiSelection(localRepo, potentialBranches); } else { String branchToCheckout = potentialBranches.keySet().iterator().next(); try { checkoutBranch(branchToCheckout, localRepo); } catch (Exception e) { } } } if (reActivateWorkspaceRevision) { ActiveWorkspaceRevision.getInstance().activateCurrentRevision(gerritClient, revision); } }

Target:
public void run() { Repository localRepo = new FindLocalRepository(gerritClient, changeInfo.getProject()).getRepository(); boolean reActivateWorkspaceRevision = true; if (localRepo == null) { Status status = new Status(IStatus.ERROR, EGerritCorePlugin.PLUGIN_ID, Messages.CheckoutRevision_1); ErrorDialog.openError(getShell(), Messages.CheckoutRevision_2, Messages.CheckoutRevision_3, status); return; } String psSelected = revision.getRef(); if ((psSelected == null) || psSelected.isEmpty()) { Status status = new Status(IStatus.ERROR, EGerritCorePlugin.PLUGIN_ID, Messages.CheckoutRevision_4); ErrorDialog.openError(getShell(), Messages.CheckoutRevision_2, Messages.CheckoutRevision_3, status); } Map<String, BranchMatch> potentialBranches = findAllPotentialBranches(localRepo); if (potentialBranches.size() > 1) { reActivateWorkspaceRevision = branchUiSelection(localRepo, potentialBranches); } else { if (potentialBranches.isEmpty()) { FetchGerritChangeWizard var = new FetchGerritChangeWizard(localRepo, psSelected); WizardDialog w = new WizardDialog(getShell(), var); w.create(); int ret = w.open(); if (ret == Window.CANCEL) { reActivateWorkspaceRevision = false; } } else if (!potentialBranches.entrySet().iterator().next().getValue().equals(BranchMatch.PERFECT_MATCH)) { reActivateWorkspaceRevision = branchUiSelection(localRepo, potentialBranches); } else { String branchToCheckout = potentialBranches.keySet().iterator().next(); try { checkoutBranch(branchToCheckout, localRepo); } catch (Exception e) { } } } if (reActivateWorkspaceRevision) { ActiveWorkspaceRevision.getInstance().activateCurrentRevision(gerritClient, revision); } }