Search in sources :

Example 36 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project egit by eclipse.

the class ConnectProviderOperation method execute.

@Override
public void execute(IProgressMonitor m) throws CoreException {
    SubMonitor progress = SubMonitor.convert(m, CoreText.ConnectProviderOperation_connecting, projects.size());
    MultiStatus ms = new MultiStatus(Activator.getPluginId(), 0, CoreText.ConnectProviderOperation_ConnectErrors, null);
    for (Entry<IProject, File> entry : projects.entrySet()) {
        connectProject(entry, ms, progress.newChild(1));
    }
    if (!ms.isOK()) {
        throw new CoreException(ms);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) SubMonitor(org.eclipse.core.runtime.SubMonitor) MultiStatus(org.eclipse.core.runtime.MultiStatus) File(java.io.File) IProject(org.eclipse.core.resources.IProject)

Example 37 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project egit by eclipse.

the class FeatureFinishHandler method postMerge.

private void postMerge(final GitFlowRepository gfRepo, final String featureBranch, final boolean squash, final MergeResult mergeResult) {
    Display display = Display.getDefault();
    display.asyncExec(new Runnable() {

        @Override
        public void run() {
            Shell activeShell = Display.getDefault().getActiveShell();
            if (squash && mergeResult.getMergedCommits().length > 1) {
                try {
                    rewordCommitMessage(activeShell, gfRepo);
                } catch (CoreException | IOException e) {
                    throw new RuntimeException(e);
                }
            }
            MergeStatus mergeStatus = mergeResult.getMergeStatus();
            if (MergeStatus.CONFLICTING.equals(mergeStatus)) {
                String develop = gfRepo.getConfig().getDevelop();
                MultiStatus status = createMergeConflictInfo(develop, featureBranch, mergeResult);
                ErrorDialog.openError(null, UIText.FeatureFinishHandler_Conflicts, null, status);
            }
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) MergeStatus(org.eclipse.jgit.api.MergeResult.MergeStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus) Display(org.eclipse.swt.widgets.Display)

Example 38 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project egit by eclipse.

the class HotfixFinishHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
    if (gfRepo == null) {
        return error(UIText.Handlers_noGitflowRepositoryFound);
    }
    HotfixFinishOperation hotfixFinishOperation;
    try {
        hotfixFinishOperation = new HotfixFinishOperation(gfRepo);
        String hotfixBranch = gfRepo.getRepository().getBranch();
        String develop = gfRepo.getConfig().getDevelop();
        JobUtil.scheduleUserWorkspaceJob(hotfixFinishOperation, UIText.HotfixFinishHandler_finishingHotfix, JobFamilies.GITFLOW_FAMILY);
        IJobManager jobMan = Job.getJobManager();
        jobMan.join(JobFamilies.GITFLOW_FAMILY, null);
        MergeResult mergeResult = hotfixFinishOperation.getMergeResult();
        MergeStatus mergeStatus = mergeResult.getMergeStatus();
        if (!MergeStatus.CONFLICTING.equals(mergeStatus)) {
            return null;
        }
        if (handleConflictsOnMaster(gfRepo)) {
            return null;
        }
        MultiStatus status = createMergeConflictInfo(develop, hotfixBranch, mergeResult);
        ErrorDialog.openError(null, UIText.HotfixFinishHandler_Conflicts, null, status);
    } catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) {
        return error(e.getMessage(), e);
    }
    return null;
}
Also used : OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) MergeResult(org.eclipse.jgit.api.MergeResult) MultiStatus(org.eclipse.core.runtime.MultiStatus) IJobManager(org.eclipse.core.runtime.jobs.IJobManager) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) MergeStatus(org.eclipse.jgit.api.MergeResult.MergeStatus) WrongGitFlowStateException(org.eclipse.egit.gitflow.WrongGitFlowStateException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) HotfixFinishOperation(org.eclipse.egit.gitflow.op.HotfixFinishOperation)

Example 39 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project egit by eclipse.

the class AbstractGitFlowHandler method docreateConflictWarning.

private MultiStatus docreateConflictWarning(Iterable<String> paths, String message) {
    String pluginId = Activator.getPluginId();
    MultiStatus multiStatus = new MultiStatus(pluginId, 1, message, null);
    for (String path : paths) {
        multiStatus.add(new Status(IStatus.WARNING, pluginId, 1, path, null));
    }
    return multiStatus;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus) Status(org.eclipse.core.runtime.Status) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 40 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project egit by eclipse.

the class CherryPickHandler method getErrorList.

private IStatus getErrorList(Map<String, MergeFailureReason> failingPaths) {
    MultiStatus result = new MultiStatus(Activator.getPluginId(), IStatus.ERROR, UIText.CherryPickHandler_CherryPickFailedMessage, null);
    for (Entry<String, MergeFailureReason> entry : failingPaths.entrySet()) {
        String path = entry.getKey();
        String reason = getReason(entry.getValue());
        String errorMessage = NLS.bind(UIText.CherryPickHandler_ErrorMsgTemplate, path, reason);
        result.add(Activator.createErrorStatus(errorMessage));
    }
    return result;
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) MergeFailureReason(org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason)

Aggregations

MultiStatus (org.eclipse.core.runtime.MultiStatus)140 IStatus (org.eclipse.core.runtime.IStatus)98 Status (org.eclipse.core.runtime.Status)60 CoreException (org.eclipse.core.runtime.CoreException)41 ArrayList (java.util.ArrayList)29 File (java.io.File)24 SubMonitor (org.eclipse.core.runtime.SubMonitor)24 IOException (java.io.IOException)14 InvocationTargetException (java.lang.reflect.InvocationTargetException)13 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)13 List (java.util.List)11 HashMap (java.util.HashMap)10 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)10 IPath (org.eclipse.core.runtime.IPath)8 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)8 FileNotFoundException (java.io.FileNotFoundException)7 HashSet (java.util.HashSet)7 IProject (org.eclipse.core.resources.IProject)7 IContainer (org.eclipse.core.resources.IContainer)6 URI (java.net.URI)5