Search in sources :

Example 1 with ResourcesContentProvider

use of eu.esdihumboldt.hale.ui.views.resources.internal.ResourcesContentProvider in project hale by halestudio.

the class ResourcesView method createViewControl.

@Override
protected void createViewControl(Composite parent) {
    viewer = new TreeViewer(parent);
    viewer.setContentProvider(new ResourcesContentProvider());
    viewer.setLabelProvider(new ResourcesLabelProvider());
    ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
    ps.addListener(projectServiceListener = new ProjectServiceAdapter() {

        @Override
        public void resourceAdded(String actionId, Resource resource) {
            updateInDisplayThread();
        }

        @Override
        public void resourcesRemoved(String actionId, List<Resource> resources) {
            updateInDisplayThread();
        }

        @Override
        public void afterLoad(ProjectService projectService) {
            updateInDisplayThread();
        }

        @Override
        public void projectInfoChanged(ProjectInfo info) {
            PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

                @Override
                public void run() {
                    viewer.update(ProjectToken.TOKEN, null);
                }
            });
        }
    });
    viewer.setUseHashlookup(true);
    viewer.setAutoExpandLevel(3);
    update();
    new ViewerMenu(getSite(), viewer);
    getSite().setSelectionProvider(viewer);
}
Also used : ProjectServiceAdapter(eu.esdihumboldt.hale.ui.service.project.ProjectServiceAdapter) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ResourcesLabelProvider(eu.esdihumboldt.hale.ui.views.resources.internal.ResourcesLabelProvider) Resource(eu.esdihumboldt.hale.common.core.io.project.model.Resource) ProjectInfo(eu.esdihumboldt.hale.common.core.io.project.ProjectInfo) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService) ResourcesContentProvider(eu.esdihumboldt.hale.ui.views.resources.internal.ResourcesContentProvider) List(java.util.List) ViewerMenu(eu.esdihumboldt.hale.ui.util.viewer.ViewerMenu)

Aggregations

ProjectInfo (eu.esdihumboldt.hale.common.core.io.project.ProjectInfo)1 Resource (eu.esdihumboldt.hale.common.core.io.project.model.Resource)1 ProjectService (eu.esdihumboldt.hale.ui.service.project.ProjectService)1 ProjectServiceAdapter (eu.esdihumboldt.hale.ui.service.project.ProjectServiceAdapter)1 ViewerMenu (eu.esdihumboldt.hale.ui.util.viewer.ViewerMenu)1 ResourcesContentProvider (eu.esdihumboldt.hale.ui.views.resources.internal.ResourcesContentProvider)1 ResourcesLabelProvider (eu.esdihumboldt.hale.ui.views.resources.internal.ResourcesLabelProvider)1 List (java.util.List)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1