use of eu.esdihumboldt.hale.ui.service.project.ProjectService in project hale by halestudio.
the class LoadTemplateAction method run.
@Override
public void run() {
super.run();
ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
try {
ps.load(template.getLocation().getLocation());
} catch (URISyntaxException e) {
log.error("Invalid project template location", e);
}
}
use of eu.esdihumboldt.hale.ui.service.project.ProjectService in project hale by halestudio.
the class OpenWebTemplate method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final Display display = HandlerUtil.getActiveShell(event).getDisplay();
ProgressMonitorDialog taskDlg = new ProgressMonitorDialog(HandlerUtil.getActiveShell(event));
try {
taskDlg.run(true, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Downloading template list", IProgressMonitor.UNKNOWN);
// load templates
final List<WebTemplate> templates;
try {
templates = WebTemplateLoader.load();
} catch (Exception e) {
log.userError("Failed to download template list", e);
return;
} finally {
monitor.done();
}
if (templates != null) {
// launch dialog asynchronously in display thread
display.asyncExec(new Runnable() {
@Override
public void run() {
WebTemplatesDialog dlg = new WebTemplatesDialog(display.getActiveShell(), templates);
if (dlg.open() == WebTemplatesDialog.OK) {
WebTemplate template = dlg.getObject();
if (template != null) {
ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
ps.load(template.getProject());
}
}
}
});
}
}
});
} catch (InvocationTargetException | InterruptedException e) {
log.userError("Failed to download template list", e);
}
return null;
}
use of eu.esdihumboldt.hale.ui.service.project.ProjectService 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);
}
use of eu.esdihumboldt.hale.ui.service.project.ProjectService in project hale by halestudio.
the class ResourcesView method dispose.
@Override
public void dispose() {
ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
if (projectServiceListener != null) {
ps.removeListener(projectServiceListener);
}
super.dispose();
}
use of eu.esdihumboldt.hale.ui.service.project.ProjectService in project hale by halestudio.
the class ProjectProperties method updateProject.
private void updateProject() {
if (updateProject) {
ProjectService ps = PlatformUI.getWorkbench().getService(ProjectService.class);
ps.updateProjectInfo(this);
}
}
Aggregations