Search in sources :

Example 1 with IWorkbenchOperationSupport

use of org.eclipse.ui.operations.IWorkbenchOperationSupport in project hale by halestudio.

the class AlignmentServiceUndoSupport method executeOperation.

/**
 * Execute an operation.
 *
 * @param operation the operation to execute
 */
protected void executeOperation(IUndoableOperation operation) {
    IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport();
    // service is workbench wide, so the operation should also be workbench
    // wide
    operation.addContext(operationSupport.getUndoContext());
    // operation.addContext(new ObjectUndoContext(alignmentService, "Alignment service"));
    try {
        // OperationHistoryFactory.getOperationHistory().execute(operation, null, null);
        operationSupport.getOperationHistory().execute(operation, null, null);
    } catch (ExecutionException e) {
        log.error("Error executing operation on alignment service", e);
    }
}
Also used : IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 2 with IWorkbenchOperationSupport

use of org.eclipse.ui.operations.IWorkbenchOperationSupport in project hale by halestudio.

the class EntityDefinitionServiceUndoSupport method editConditionContext.

/**
 * @see eu.esdihumboldt.hale.ui.service.entity.internal.EntityDefinitionServiceDecorator#editConditionContext(eu.esdihumboldt.hale.common.align.model.EntityDefinition,
 *      eu.esdihumboldt.hale.common.instance.model.Filter)
 */
@Override
public EntityDefinition editConditionContext(EntityDefinition sibling, Filter filter) {
    ICompositeOperation operation = new CompositeOperation("Edit condition context");
    IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport();
    operation.addContext(operationSupport.getUndoContext());
    operationSupport.getOperationHistory().openOperation(operation, IOperationHistory.EXECUTE);
    EntityDefinition result = super.editConditionContext(sibling, filter);
    operationSupport.getOperationHistory().closeOperation(result != null, true, IOperationHistory.EXECUTE);
    return result;
}
Also used : EntityDefinition(eu.esdihumboldt.hale.common.align.model.EntityDefinition) IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ICompositeOperation(org.eclipse.core.commands.operations.ICompositeOperation) ICompositeOperation(org.eclipse.core.commands.operations.ICompositeOperation)

Example 3 with IWorkbenchOperationSupport

use of org.eclipse.ui.operations.IWorkbenchOperationSupport in project hale by halestudio.

the class SchemaServiceImpl method toggleMappable.

/**
 * @see eu.esdihumboldt.hale.ui.service.schema.SchemaService#toggleMappable(eu.esdihumboldt.hale.common.schema.SchemaSpaceID,
 *      java.util.Collection)
 */
@Override
public void toggleMappable(SchemaSpaceID spaceID, Collection<? extends TypeDefinition> types) {
    ToggleMappableOperation operation = new ToggleMappableOperation(spaceID, types);
    IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport();
    operation.addContext(operationSupport.getUndoContext());
    try {
        operationSupport.getOperationHistory().execute(operation, null, null);
    } catch (ExecutionException e) {
        log.error("Error executing operation on schema service", e);
    }
}
Also used : IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 4 with IWorkbenchOperationSupport

use of org.eclipse.ui.operations.IWorkbenchOperationSupport in project hale by halestudio.

the class EntityDefinitionServiceUndoSupport method executeOperation.

/**
 * Execute an operation.
 *
 * @param operation the operation to execute
 */
protected void executeOperation(IUndoableOperation operation) {
    IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport();
    // service is workbench wide, so the operation should also be workbench
    // wide
    operation.addContext(operationSupport.getUndoContext());
    try {
        operationSupport.getOperationHistory().execute(operation, null, null);
    } catch (ExecutionException e) {
        log.error("Error executing operation on entity definition service", e);
    }
}
Also used : IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 5 with IWorkbenchOperationSupport

use of org.eclipse.ui.operations.IWorkbenchOperationSupport in project hale by halestudio.

the class OrientInstanceService method clearInstances.

/**
 * @see InstanceService#clearInstances()
 */
@Override
public void clearInstances() {
    IUndoableOperation operation = new AbstractRemoveResourcesOperation("Clear source data", InstanceService.ACTION_READ_SOURCEDATA) {

        /**
         * @see eu.esdihumboldt.hale.ui.service.project.internal.AbstractRemoveResourcesOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
         *      org.eclipse.core.runtime.IAdaptable)
         */
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
            notifyDatasetAboutToChange(null);
            source.clear();
            transformed.clear();
            notifyDatasetChanged(null);
            return super.execute(monitor, info);
        }
    };
    IWorkbenchOperationSupport operationSupport = PlatformUI.getWorkbench().getOperationSupport();
    operation.addContext(operationSupport.getUndoContext());
    try {
        operationSupport.getOperationHistory().execute(operation, null, null);
    } catch (ExecutionException e) {
        log.error("Error executing operation on instance service", e);
    }
}
Also used : AbstractRemoveResourcesOperation(eu.esdihumboldt.hale.ui.service.project.internal.AbstractRemoveResourcesOperation) IAdaptable(org.eclipse.core.runtime.IAdaptable) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IUndoableOperation(org.eclipse.core.commands.operations.IUndoableOperation) IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

IWorkbenchOperationSupport (org.eclipse.ui.operations.IWorkbenchOperationSupport)7 ExecutionException (org.eclipse.core.commands.ExecutionException)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 AbstractRemoveResourcesOperation (eu.esdihumboldt.hale.ui.service.project.internal.AbstractRemoveResourcesOperation)2 IUndoableOperation (org.eclipse.core.commands.operations.IUndoableOperation)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 ATransaction (de.fhg.igd.slf4jplus.ATransaction)1 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)1 CleanupService (eu.esdihumboldt.hale.common.core.service.cleanup.CleanupService)1 ReportService (eu.esdihumboldt.hale.ui.service.report.ReportService)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ExecutionException (java.util.concurrent.ExecutionException)1 ICompositeOperation (org.eclipse.core.commands.operations.ICompositeOperation)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1