Search in sources :

Example 6 with ReportService

use of eu.esdihumboldt.hale.ui.service.report.ReportService in project hale by halestudio.

the class ProjectServiceImpl method internalClean.

private boolean internalClean() {
    if (!changeCheck()) {
        return false;
    }
    // reset current session descriptor
    ReportService repService = PlatformUI.getWorkbench().getService(ReportService.class);
    repService.updateCurrentSessionDescription();
    // clean
    final IRunnableWithProgress op = new IRunnableWithProgress() {

        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            ATransaction trans = log.begin("Clean project");
            CleanupService cs = HalePlatform.getService(CleanupService.class);
            if (cs != null) {
                cs.triggerProjectCleanup();
            }
            monitor.beginTask("Clean project", IProgressMonitor.UNKNOWN);
            try {
                synchronized (this) {
                    main = createDefaultProject();
                    projectFile = null;
                    projectLocation = null;
                    changed = false;
                    projectLoadContentType = null;
                    temporarySettings.clear();
                }
                updateWindowTitle();
                notifyClean();
                // schemas aren't valid anymore, clear property resolver
                // cache
                PropertyResolver.clearCache();
            } finally {
                monitor.done();
                trans.end();
            }
            // clean workbench history AFTER other cleans since they can
            // create operations
            IWorkbenchOperationSupport os = PlatformUI.getWorkbench().getOperationSupport();
            os.getOperationHistory().dispose(os.getUndoContext(), true, true, false);
            // suppress the status being set to changed by the clean
            synchronized (ProjectServiceImpl.this) {
                changed = false;
            }
            updateWindowTitle();
        }
    };
    try {
        ThreadProgressMonitor.runWithProgressDialog(op, false);
    } catch (Exception e) {
        log.error("Error cleaning the project.", e);
    }
    return true;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ReportService(eu.esdihumboldt.hale.ui.service.report.ReportService) CleanupService(eu.esdihumboldt.hale.common.core.service.cleanup.CleanupService) IWorkbenchOperationSupport(org.eclipse.ui.operations.IWorkbenchOperationSupport) ATransaction(de.fhg.igd.slf4jplus.ATransaction) InvocationTargetException(java.lang.reflect.InvocationTargetException) ExecutionException(java.util.concurrent.ExecutionException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

ReportService (eu.esdihumboldt.hale.ui.service.report.ReportService)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)4 ATransaction (de.fhg.igd.slf4jplus.ATransaction)3 IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)3 IOReporter (eu.esdihumboldt.hale.common.core.io.report.IOReporter)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 CachingImportProvider (eu.esdihumboldt.hale.common.core.io.CachingImportProvider)2 IOProviderConfigurationException (eu.esdihumboldt.hale.common.core.io.IOProviderConfigurationException)2 ProgressMonitorIndicator (eu.esdihumboldt.hale.common.core.io.ProgressMonitorIndicator)2 Value (eu.esdihumboldt.hale.common.core.io.Value)2 URI (java.net.URI)2 Alignment (eu.esdihumboldt.hale.common.align.model.Alignment)1 Cell (eu.esdihumboldt.hale.common.align.model.Cell)1 TransformationReport (eu.esdihumboldt.hale.common.align.transformation.report.TransformationReport)1 TransformationService (eu.esdihumboldt.hale.common.align.transformation.service.TransformationService)1 ImportProvider (eu.esdihumboldt.hale.common.core.io.ImportProvider)1 IOProviderDescriptor (eu.esdihumboldt.hale.common.core.io.extension.IOProviderDescriptor)1 IOConfiguration (eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration)1 Project (eu.esdihumboldt.hale.common.core.io.project.model.Project)1