Search in sources :

Example 26 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project arduino-eclipse-plugin by Sloeber.

the class ArduinoGnuMakefileGenerator method regenerateMakefiles.

/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#
	 * regenerateMakefiles()
	 */
@Override
public MultiStatus regenerateMakefiles() throws CoreException {
    MultiStatus status;
    // Visit the resources in the project
    ResourceProxyVisitor visitor = new ResourceProxyVisitor(this, this.config);
    this.project.accept(visitor, IResource.NONE);
    // See if the user has cancelled the build
    checkCancel();
    // in the project
    if (getSubdirList().isEmpty()) {
        String info = ManagedMakeMessages.getFormattedString("MakefileGenerator.warning.no.source", this.project.getName());
        updateMonitor(info);
        status = new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.INFO, new String(), null);
        status.add(new Status(IStatus.INFO, ManagedBuilderCorePlugin.getUniqueIdentifier(), NO_SOURCE_FOLDERS, info, null));
        return status;
    }
    // Create the top-level directory for the build output
    this.topBuildDir = createDirectory(this.config.getName());
    checkCancel();
    // Get the list of subdirectories
    IPath srcsFilePath = this.topBuildDir.append(SRCSFILE_NAME);
    IFile srcsFileHandle = createFile(srcsFilePath);
    this.buildSrcVars.clear();
    this.buildOutVars.clear();
    this.buildDepVars.clear();
    this.topBuildOutVars.clear();
    populateSourcesMakefile(srcsFileHandle);
    checkCancel();
    // Now populate the module makefiles
    for (IResource res : getSubdirList()) {
        IContainer subDir = (IContainer) res;
        try {
            populateFragmentMakefile(subDir);
        } catch (CoreException e) {
            // Probably should ask user if they want to continue
            checkCancel();
            continue;
        }
        checkCancel();
    }
    // Calculate the inputs and outputs of the Tools to be generated in the
    // main makefile
    calculateToolInputsOutputs();
    checkCancel();
    // Create the top-level makefile
    IPath makefilePath = this.topBuildDir.append(MAKEFILE_NAME);
    IFile makefileHandle = createFile(makefilePath);
    populateTopMakefile(makefileHandle, true);
    checkCancel();
    // Now finish up by adding all the object files
    IPath objFilePath = this.topBuildDir.append(OBJECTS_MAKFILE);
    IFile objsFileHandle = createFile(objFilePath);
    populateObjectsMakefile(objsFileHandle);
    checkCancel();
    // How did we do
    if (!getInvalidDirList().isEmpty()) {
        status = new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.WARNING, new String(), null);
        // TODO: fix error message
        for (IResource dir : getInvalidDirList()) {
            status.add(new Status(IStatus.WARNING, ManagedBuilderCorePlugin.getUniqueIdentifier(), SPACES_IN_PATH, dir.getFullPath().toString(), null));
        }
    } else {
        status = new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.OK, new String(), null);
    }
    return status;
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IResourceStatus(org.eclipse.core.resources.IResourceStatus) IFile(org.eclipse.core.resources.IFile) IPath(org.eclipse.core.runtime.IPath) CoreException(org.eclipse.core.runtime.CoreException) MultiStatus(org.eclipse.core.runtime.MultiStatus) IResourceProxyVisitor(org.eclipse.core.resources.IResourceProxyVisitor) IContainer(org.eclipse.core.resources.IContainer) IResource(org.eclipse.core.resources.IResource)

Example 27 with MultiStatus

use of org.eclipse.core.runtime.MultiStatus in project arduino-eclipse-plugin by Sloeber.

the class PlatformSelectionPage method updateInstallation.

protected IStatus updateInstallation(IProgressMonitor monitor) {
    MultiStatus status = new MultiStatus(Activator.getId(), 0, Messages.ui_installing_platforms, null);
    PackageManager.setPlatformTree(this.myPlatformTree, monitor, status);
    return status;
}
Also used : MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 28 with MultiStatus

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

the class WorkingSetManagerBrokerImpl method saveState.

@Override
public IStatus saveState(final IProgressMonitor monitor) {
    final Collection<WorkingSetManager> managers = getWorkingSetManagers();
    final SubMonitor subMonitor = SubMonitor.convert(monitor, managers.size() + 1);
    final MultiStatus error = statusHelper.createMultiError("Error occurred while saving state.");
    for (final WorkingSetManager manager : managers) {
        final IStatus result = manager.saveState(subMonitor.newChild(1));
        if (!result.isOK()) {
            error.add(result);
        }
    }
    final IStatus result = saveState();
    if (!result.isOK()) {
        error.add(result);
    }
    return Arrays2.isEmpty(error.getChildren()) ? statusHelper.OK() : error;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) SubMonitor(org.eclipse.core.runtime.SubMonitor) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 29 with MultiStatus

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

the class WorkingSetManagerBrokerImpl method restoreState.

@Override
public IStatus restoreState(final IProgressMonitor monitor) {
    final Collection<WorkingSetManager> managers = getWorkingSetManagers();
    final SubMonitor subMonitor = SubMonitor.convert(monitor, managers.size() + 1);
    final MultiStatus error = statusHelper.createMultiError("Error occurred while restoring state.");
    for (final WorkingSetManager manager : managers) {
        final IStatus result = manager.restoreState(subMonitor.newChild(1));
        if (!result.isOK()) {
            error.add(result);
        }
    }
    final IStatus result = restoreState();
    if (!result.isOK()) {
        error.add(result);
    }
    return Arrays2.isEmpty(error.getChildren()) ? statusHelper.OK() : error;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) SubMonitor(org.eclipse.core.runtime.SubMonitor) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Example 30 with MultiStatus

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

the class ExternalLibraryPreferencePage method runMaintananceActions.

/**
 * Handler for executing maintenance action based on the provided {@link MaintenanceActionsChoice user choice}.
 */
private MultiStatus runMaintananceActions(final MaintenanceActionsChoice userChoice, IProgressMonitor monitor) {
    final MultiStatus multistatus = statusHelper.createMultiStatus("Status of executing maintenance actions.");
    // persist state for reinstall
    Map<String, String> oldPackages = new HashMap<>();
    if (userChoice.decisionReinstall)
        oldPackages.putAll(getInstalledNpms());
    // keep the order Cache->TypeDefs->NPMs->Reinstall->Update
    // actions have side effects that can interact with each other
    maintenanceCleanNpmCache(userChoice, multistatus, monitor);
    maintenanceResetTypeDefinitions(userChoice, multistatus);
    maintenanceDeleteNpms(userChoice, multistatus);
    maintenanceReinstallNpms(userChoice, multistatus, monitor, oldPackages);
    maintenanceUpateState(userChoice, multistatus, monitor);
    return multistatus;
}
Also used : HashMap(java.util.HashMap) MultiStatus(org.eclipse.core.runtime.MultiStatus)

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