Search in sources :

Example 41 with ProjectService

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

the class UserFallbackEntityResolver method getCache.

/**
 * @return the current resolve cache
 */
public static ResolveCache getCache() {
    ProjectService ps = HaleUI.getServiceProvider().getService(ProjectService.class);
    ResolveCache result = ps.getTemporaryProperty(PROPERTY_RESOLVE_CACHE, Value.NULL).as(ResolveCache.class);
    if (result == null) {
        result = new ResolveCache();
        ps.setTemporaryProperty(PROPERTY_RESOLVE_CACHE, Value.of(result));
    }
    return result;
}
Also used : ResolveCache(eu.esdihumboldt.hale.ui.service.align.resolver.internal.ResolveCache) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService)

Example 42 with ProjectService

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

the class InstanceServiceSource method getCurrentState.

/**
 * @see ISourceProvider#getCurrentState()
 */
@Override
public Map<String, Object> getCurrentState() {
    InstanceService is = PlatformUI.getWorkbench().getService(InstanceService.class);
    ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
    Map<String, Object> result = new HashMap<String, Object>();
    result.put(HAS_TRANSFORMED_INSTANCES, hasTransformedInstances(is));
    result.put(HAS_SOURCE_INSTANCES, hasSourceInstances(is));
    result.put(HAS_SOURCE_RESOURCES, hasSourceResources(ps));
    return result;
}
Also used : HashMap(java.util.HashMap) InstanceService(eu.esdihumboldt.hale.ui.service.instance.InstanceService) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService)

Example 43 with ProjectService

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

the class InstanceServiceSource method dispose.

/**
 * @see ISourceProvider#dispose()
 */
@Override
public void dispose() {
    InstanceService is = PlatformUI.getWorkbench().getService(InstanceService.class);
    is.removeListener(instanceListener);
    ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
    ps.removeListener(projectServiceListener);
}
Also used : InstanceService(eu.esdihumboldt.hale.ui.service.instance.InstanceService) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService)

Example 44 with ProjectService

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

the class InstanceSamplingToggleState method dispose.

@Override
public void dispose() {
    ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
    ps.removeListener(projectListener);
}
Also used : ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService)

Example 45 with ProjectService

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

the class InstanceViewPreferencePage method performOk.

@Override
public boolean performOk() {
    ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
    if (changed) {
        if (!MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Reload source data", "Applying the new settings will result in the source data being reloaded.")) {
            return false;
        }
        // save the enabled state
        ps.getConfigurationService().setBoolean(InstanceViewPreferences.KEY_ENABLED, enabled.getSelection());
        // store the current editor value in the map
        if (currentEditor != null) {
            // store value for current sampler
            Value setting = currentEditor.getValue();
            samplerSettings.put(InstanceViewPreferences.SAMPLERS.inverse().get(currentSampler), setting);
        }
        // store the map in the configuration
        for (Entry<String, Value> entry : samplerSettings.entrySet()) {
            ps.getConfigurationService().setProperty(InstanceViewPreferences.KEY_SETTINGS_PREFIX + entry.getKey(), entry.getValue());
        }
        // store the selected sampler
        Sampler selectedSampler = null;
        if (!samplers.getSelection().isEmpty()) {
            selectedSampler = (Sampler) ((IStructuredSelection) samplers.getSelection()).getFirstElement();
        }
        if (selectedSampler != null) {
            ps.getConfigurationService().set(InstanceViewPreferences.KEY_SAMPLER, InstanceViewPreferences.SAMPLERS.inverse().get(selectedSampler));
        }
        // reload the data
        ps.reloadSourceData();
        changed = false;
    }
    if (ov_changed) {
        ps.getConfigurationService().setBoolean(InstanceViewPreferences.KEY_OCCURRING_VALUES_USE_EXTERNAL, occurringValuesComplete.getSelection());
        ov_changed = false;
    }
    return true;
}
Also used : Sampler(eu.esdihumboldt.hale.ui.service.instance.sample.Sampler) Value(eu.esdihumboldt.hale.common.core.io.Value) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

ProjectService (eu.esdihumboldt.hale.ui.service.project.ProjectService)49 IOConfiguration (eu.esdihumboldt.hale.common.core.io.project.model.IOConfiguration)5 Resource (eu.esdihumboldt.hale.common.core.io.project.model.Resource)5 URI (java.net.URI)5 ArrayList (java.util.ArrayList)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 Button (org.eclipse.swt.widgets.Button)5 Value (eu.esdihumboldt.hale.common.core.io.Value)4 ResolveCache (eu.esdihumboldt.hale.ui.service.align.resolver.internal.ResolveCache)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)4 Project (eu.esdihumboldt.hale.common.core.io.project.model.Project)3 SchemaService (eu.esdihumboldt.hale.ui.service.schema.SchemaService)3 List (java.util.List)3 Composite (org.eclipse.swt.widgets.Composite)3 EntityDefinition (eu.esdihumboldt.hale.common.align.model.EntityDefinition)2 PropertyEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition)2 TypeEntityDefinition (eu.esdihumboldt.hale.common.align.model.impl.TypeEntityDefinition)2