Search in sources :

Example 1 with AbstractInstallOperation

use of org.springsource.ide.eclipse.commons.internal.configurator.operations.AbstractInstallOperation in project eclipse-integration-commons by spring-projects.

the class InstallableItem method install.

public IStatus install(File base, IProgressMonitor monitor) {
    File targetLocation = getTargetLocation(base);
    targetLocation.mkdirs();
    MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, 0, NLS.bind("Installation of {0} failed", getName()), null);
    List<AbstractInstallOperation> operations = getInstallOperations();
    SubMonitor progress = SubMonitor.convert(monitor, NLS.bind("Installing {0}", getName()), operations.size());
    for (AbstractInstallOperation operation : operations) {
        try {
            operation.setSourceBase(getSourceLocation());
        } catch (CoreException e) {
            return e.getStatus();
        }
        operation.setTargetBase(targetLocation);
        IStatus status = operation.install(progress.newChild(1));
        result.add(status);
    }
    return result;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) AbstractInstallOperation(org.springsource.ide.eclipse.commons.internal.configurator.operations.AbstractInstallOperation) SubMonitor(org.eclipse.core.runtime.SubMonitor) MultiStatus(org.eclipse.core.runtime.MultiStatus) File(java.io.File)

Example 2 with AbstractInstallOperation

use of org.springsource.ide.eclipse.commons.internal.configurator.operations.AbstractInstallOperation in project eclipse-integration-commons by spring-projects.

the class InstallableItem method getInstallOperations.

public List<AbstractInstallOperation> getInstallOperations() {
    IConfigurationElement[] elements = element.getChildren();
    List<AbstractInstallOperation> operations = new ArrayList<AbstractInstallOperation>(elements.length);
    for (IConfigurationElement element : elements) {
        if (element.getName().equals(ELEMENT_COPY)) {
            operations.add(new CopyOperation(element));
        } else if (element.getName().equals(ELEMENT_CHMOD)) {
            operations.add(new ChmodOperation(element));
        }
    }
    return operations;
}
Also used : CopyOperation(org.springsource.ide.eclipse.commons.internal.configurator.operations.CopyOperation) AbstractInstallOperation(org.springsource.ide.eclipse.commons.internal.configurator.operations.AbstractInstallOperation) ArrayList(java.util.ArrayList) ChmodOperation(org.springsource.ide.eclipse.commons.internal.configurator.operations.ChmodOperation) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Aggregations

AbstractInstallOperation (org.springsource.ide.eclipse.commons.internal.configurator.operations.AbstractInstallOperation)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 CoreException (org.eclipse.core.runtime.CoreException)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IStatus (org.eclipse.core.runtime.IStatus)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 ChmodOperation (org.springsource.ide.eclipse.commons.internal.configurator.operations.ChmodOperation)1 CopyOperation (org.springsource.ide.eclipse.commons.internal.configurator.operations.CopyOperation)1