Commit 4b3ca122 authored by Marco Descher's avatar Marco Descher 🏔

[11238] Initial import ch.elexis.core.ui.tasks

parent 390c4f41
Pipeline #12232 passed with stages
in 4 minutes and 50 seconds
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ch.elexis.core.ui.tasks</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tasks
Bundle-SymbolicName: ch.elexis.core.ui.tasks;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: elexis.ch
Export-Package: ch.elexis.core.ui.tasks
Require-Bundle: org.eclipse.ui;bundle-version="3.110.0",
ch.elexis.core,
ch.elexis.core.services;bundle-version="1.0.0",
ch.elexis.core.tasks,
ch.elexis.core.ui.icons;bundle-version="3.3.0",
org.eclipse.e4.ui.model.workbench;bundle-version="2.1.100.v20180904-1914",
org.eclipse.e4.core.di
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Service-Component: OSGI-INF/ch.elexis.core.ui.tasks.internal.TaskModelServiceHolder.xml,OSGI-INF/ch.elexis.core.ui.tasks.internal.TaskResultDetailDialogContributions.xml
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
javax.inject;version="1.0.0",
org.eclipse.e4.core.di.annotations;version="1.6.0",
org.eclipse.e4.ui.di,
org.eclipse.e4.ui.services,
org.eclipse.e4.ui.workbench.modeling,
org.osgi.service.component.annotations;version="1.3.0"
Automatic-Module-Name: ch.elexis.core.ui.tasks
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="ch.elexis.core.ui.tasks.internal.TaskModelServiceHolder">
<reference bind="setModelService" interface="ch.elexis.core.services.IModelService" name="ModelService" target="(service.model.name=ch.elexis.core.tasks.model)"/>
<implementation class="ch.elexis.core.ui.tasks.internal.TaskModelServiceHolder"/>
</scr:component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0" name="ch.elexis.core.ui.tasks.internal.TaskResultDetailDialogContributions">
<service>
<provide interface="ch.elexis.core.ui.tasks.ITaskResultDetailContributions"/>
</service>
<reference cardinality="0..n" field="taskResultDetailDialogContributors" interface="ch.elexis.core.ui.tasks.ITaskResultDetailContributor" name="taskResultDetailDialogContributors" policy="dynamic" policy-option="greedy"/>
<implementation class="ch.elexis.core.ui.tasks.internal.TaskResultDetailDialogContributions"/>
</scr:component>
\ No newline at end of file
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
OSGI-INF/ch.elexis.core.ui.tasks.internal.TaskModelServiceHolder.xml,\
OSGI-INF/ch.elexis.core.ui.tasks.internal.TaskResultDetailDialogContributions.xml,\
fragment.e4xmi
source.. = src/
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_vnhVYA98EeqCRvaXdJ-ZfQ">
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_yKaBgA9_EeqCRvaXdJ-ZfQ" featurename="descriptors" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="basic:PartDescriptor" xmi:id="_9ho_gA9_EeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.parts.TaskResultPart" label="Tasks" iconURI="platform:/plugin/ch.elexis.core.ui.tasks/rsc/icons/screwdriver.png" category="General" closeable="true" contributionURI="bundleclass://ch.elexis.core.ui.tasks/ch.elexis.core.ui.tasks.parts.TaskResultPart">
<tags>View</tags>
<handlers xmi:id="_Y9WCgA-HEeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.handler.taskresultpart.refresh" contributionURI="bundleclass://ch.elexis.core.ui.tasks/ch.elexis.core.ui.tasks.parts.TaskResultPartRefreshHandler" command="_UKR8IA-HEeqCRvaXdJ-ZfQ"/>
<handlers xmi:id="_I-_qcA--EeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.handler.identifiable.remove" contributionURI="bundleclass://ch.elexis.core.ui.tasks/ch.elexis.core.ui.tasks.parts.RemoveIdentifiableHandler" command="_CbdE8A--EeqCRvaXdJ-ZfQ"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_5Yz_wA-9EeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.popupmenu.tableresults">
<children xsi:type="menu:HandledMenuItem" xmi:id="_MuBg8A--EeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.handledmenuitem.lschen" label="L&#xf6;schen" iconURI="icon://IMG_BOMB" command="_CbdE8A--EeqCRvaXdJ-ZfQ"/>
</menus>
<toolbar xmi:id="_DEarkA-AEeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.toolbar.0">
<children xsi:type="menu:HandledToolItem" xmi:id="_vRnV0A-HEeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.handledtoolitem.0" iconURI="icon://IMG_REFRESH" command="_UKR8IA-HEeqCRvaXdJ-ZfQ"/>
</toolbar>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_LHyLYBBMEeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.tasks.partdescriptor.taskdetail" label="Task Detail" allowMultiple="true" closeable="true" contributionURI="bundleclass://ch.elexis.core.ui.tasks/ch.elexis.core.ui.tasks.parts.TaskDetailPart"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_Si4A0A-EEeqCRvaXdJ-ZfQ" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
<elements xsi:type="commands:Command" xmi:id="_UKR8IA-HEeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.command.part.refresh" commandName="Refresh part" description="Refresh the contents of a part"/>
<elements xsi:type="commands:Command" xmi:id="_CbdE8A--EeqCRvaXdJ-ZfQ" elementId="ch.elexis.core.ui.command.identifiable.remove" commandName="Remove Identifiable" description="Removes an identifiable from the database"/>
</fragments>
</fragment:ModelFragments>
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<extension
id="ch.elexis.core.ui.tasks.fragment"
point="org.eclipse.e4.workbench.model">
<fragment
uri="fragment.e4xmi">
</fragment>
</extension>
</plugin>
package ch.elexis.core.ui.tasks;
import org.eclipse.swt.widgets.Composite;
import ch.elexis.core.tasks.model.ITask;
public interface ITaskResultDetailContributions {
public void createDetailCompositeForTask(Composite parent, ITask task);
}
package ch.elexis.core.ui.tasks;
import org.eclipse.swt.widgets.Composite;
import ch.elexis.core.model.tasks.IIdentifiedRunnable;
import ch.elexis.core.tasks.model.ITask;
import ch.elexis.core.tasks.model.ITaskDescriptor;
public interface ITaskResultDetailContributor {
/**
* @return the {@link ITaskDescriptor#getReferenceId()} (that is the specific
* {@link IIdentifiedRunnable}) contributing the result dialog to.
*/
String getIdentifiedRunnableId();
/**
* add a detail dialog for the task that is based on the {@link IIdentifiedRunnable} advertised
* in {@link #getIdentifiedRunnableId()}
*
* @param parent
* @param task
*/
void createDetailCompositeForTask(Composite parent, ITask task);
}
package ch.elexis.core.ui.tasks.internal;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import ch.elexis.core.tasks.model.ITask;
import org.eclipse.swt.widgets.Label;
public class GenericTaskResultDetailComposite {
public GenericTaskResultDetailComposite(Composite parent, ITask task){
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, false));
container.setLayoutData(new GridData(GridData.FILL_BOTH));
Label lblNewLabel = new Label(container, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblNewLabel.setText("generic result view: not yet implemented");
}
}
package ch.elexis.core.ui.tasks.internal;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import ch.elexis.core.services.IModelService;
@Component
public class TaskModelServiceHolder {
private static IModelService modelService;
@Reference(target = "(" + IModelService.SERVICEMODELNAME + "=ch.elexis.core.tasks.model)")
public void setModelService(IModelService modelService){
TaskModelServiceHolder.modelService = modelService;
}
public static IModelService get(){
if (modelService == null) {
throw new IllegalStateException("No IModelService available");
}
return modelService;
}
}
package ch.elexis.core.ui.tasks.internal;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.ReferencePolicyOption;
import ch.elexis.core.tasks.model.ITask;
import ch.elexis.core.ui.tasks.ITaskResultDetailContributions;
import ch.elexis.core.ui.tasks.ITaskResultDetailContributor;
@Component
public class TaskResultDetailDialogContributions implements ITaskResultDetailContributions {
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY)
private volatile List<ITaskResultDetailContributor> taskResultDetailDialogContributors;
@Override
public void createDetailCompositeForTask(Composite parent, ITask task){
String identifiedRunnableId = task.getTaskDescriptor().getIdentifiedRunnableId();
for (ITaskResultDetailContributor contribution : taskResultDetailDialogContributors) {
if (identifiedRunnableId.equals(contribution.getIdentifiedRunnableId())) {
contribution.createDetailCompositeForTask(parent, task);
return;
}
}
new GenericTaskResultDetailComposite(parent, task);
}
}
package ch.elexis.core.ui.tasks.parts;
import java.util.List;
import org.eclipse.jface.viewers.ILazyContentProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import ch.elexis.core.tasks.model.ITask;
public class LazyTaskResultContentProvider implements ILazyContentProvider {
private List<ITask> currentList;
private TableViewer tableViewerResults;
public LazyTaskResultContentProvider(TableViewer tableViewerResults){
this.tableViewerResults = tableViewerResults;
}
@SuppressWarnings("unchecked")
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput){
this.currentList = (List<ITask>) newInput;
}
@Override
public void updateElement(int index){
tableViewerResults.replace(currentList.get(index), index);
}
}
package ch.elexis.core.ui.tasks.parts;
import java.util.List;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.services.IServiceConstants;
import ch.elexis.core.tasks.model.ITask;
public class RemoveIdentifiableHandler {
@Execute
public void execute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) List<ITask> task){
System.out.println("a" + task);
}
// @Execute
// public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) ITask task){
// System.out.println("b" + task);
// }
}
\ No newline at end of file
package ch.elexis.core.ui.tasks.parts;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import ch.elexis.core.tasks.model.ITask;
import ch.elexis.core.ui.tasks.ITaskResultDetailContributions;
public class TaskDetailPart {
@Inject
@Named(IServiceConstants.ACTIVE_SHELL)
private Shell shell;
@Inject
private ITaskResultDetailContributions taskResultDetailDialogContributions;
@PostConstruct
public void postConstruct(Composite parent, MPart part){
parent.setLayout(new GridLayout(1, false));
ITask task = (ITask) part.getTransientData().get("task");
part.setIconURI(TaskResultLabelProvider.getInstance().getIconURI(task));
String runAt = task.getRunAt().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL));
String partLabel = task.getTaskDescriptor().getReferenceId() + " - " + runAt;
part.setLabel(partLabel);
taskResultDetailDialogContributions.createDetailCompositeForTask(parent, task);
}
}
\ No newline at end of file
package ch.elexis.core.ui.tasks.parts;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.graphics.Image;
import ch.elexis.core.tasks.model.ITask;
import ch.elexis.core.ui.icons.Images;
public class TaskResultLabelProvider extends ColumnLabelProvider {
private static TaskResultLabelProvider instance;
private TaskResultLabelProvider(){}
public static TaskResultLabelProvider getInstance(){
if (instance == null) {
instance = new TaskResultLabelProvider();
}
return instance;
}
public String getIconURI(Object element){
Images icon = getImages(element);
return (icon != null) ? icon.getIconURI() : null;
}
@Override
public Image getImage(Object element){
Images icon = getImages(element);
return (icon != null) ? icon.getImage() : null;
}
private Images getImages(Object element){
ITask task = (ITask) element;
switch (task.getState()) {
case IN_PROGRESS:
return Images.IMG_GEAR;
case COMPLETED:
return Images.IMG_TICK;
case COMPLETED_WARN:
return Images.IMG_ACHTUNG;
case FAILED:
return Images.IMG_AUSRUFEZ;
default:
break;
}
return null;
}
@Override
public String getText(Object element){
return null;
}
}
package ch.elexis.core.ui.tasks.parts;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import ch.elexis.core.common.ElexisEventTopics;
import ch.elexis.core.services.IQuery;
import ch.elexis.core.tasks.model.ITask;
import ch.elexis.core.ui.icons.Images;
import ch.elexis.core.ui.tasks.internal.TaskModelServiceHolder;
public class TaskResultPart implements IDoubleClickListener {
@Inject
private ESelectionService selectionService;
@Inject
private EPartService partService;
private Composite tableViewerComposite;
private Table tableResults;
private TableViewer tableViewerResults;
@PostConstruct
public void createControls(Composite parent, EMenuService menuService){
parent.setLayout(new GridLayout(1, false));
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout gl_composite = new GridLayout(1, false);
gl_composite.marginWidth = 0;
gl_composite.marginHeight = 0;
composite.setLayout(gl_composite);
tableViewerComposite = new Composite(parent, SWT.NONE);
tableViewerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
TableColumnLayout tcLayout = new TableColumnLayout();
tableViewerComposite.setLayout(tcLayout);
tableViewerResults = new TableViewer(tableViewerComposite,
SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.MULTI);
tableResults = tableViewerResults.getTable();
tableResults.setHeaderVisible(true);
tableResults.setLinesVisible(true);
LazyTaskResultContentProvider contentProvider =
new LazyTaskResultContentProvider(tableViewerResults);
tableViewerResults.setContentProvider(contentProvider);
tableViewerResults.setUseHashlookup(true);
tableViewerResults.addDoubleClickListener(this);
TableViewerColumn tvcState = new TableViewerColumn(tableViewerResults, SWT.NONE);
tvcState.setLabelProvider(TaskResultLabelProvider.getInstance());
TableColumn tblclmnState = tvcState.getColumn();
tcLayout.setColumnData(tblclmnState, new ColumnPixelData(16, true, true));
tblclmnState.setText("Status");
TableViewerColumn tvcLastUpdate = new TableViewerColumn(tableViewerResults, SWT.NONE);
tvcLastUpdate.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element){
ITask task = (ITask) element;
LocalDateTime lastUpdateDt = LocalDateTime
.ofInstant(Instant.ofEpochMilli(task.getLastupdate()), ZoneId.systemDefault());
return lastUpdateDt.toString();
}
});
TableColumn tblclmnLastupdate = tvcLastUpdate.getColumn();
tcLayout.setColumnData(tblclmnLastupdate, new ColumnPixelData(150, true, true));
tblclmnLastupdate.setText("Aktualisiert");
TableViewerColumn tvcOwner = new TableViewerColumn(tableViewerResults, SWT.NONE);
tvcOwner.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element){
ITask task = (ITask) element;
return task.getTaskDescriptor().getOwner().getId();
}
});
TableColumn tblclmnOwner = tvcOwner.getColumn();
tcLayout.setColumnData(tblclmnOwner, new ColumnPixelData(100, true, true));
tblclmnOwner.setText("User");
TableViewerColumn tvcTrigger = new TableViewerColumn(tableViewerResults, SWT.NONE);
tvcTrigger.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element){
ITask task = (ITask) element;
switch (task.getTriggerEvent()) {
case MANUAL:
return Images.IMG_HAND.getImage();
case CRON:
return Images.IMG_CLOCK.getImage();
case SYSTEM_EVENT:
return Images.IMG_SYSTEM_MONITOR.getImage();
case OTHER_TASK:
return Images.IMG_TASK.getImage();
default:
break;
}
return super.getImage(element);
}
@Override
public String getText(Object element){
return null;
}
});
TableColumn tblclmnTrigger = tvcTrigger.getColumn();
tcLayout.setColumnData(tblclmnTrigger, new ColumnPixelData(16, true, true));
tblclmnTrigger.setText("Auslöser");
TableViewerColumn tvcTaskDescriptor = new TableViewerColumn(tableViewerResults, SWT.NONE);
tvcTaskDescriptor.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element){
ITask task = (ITask) element;
String referenceId = task.getTaskDescriptor().getReferenceId();
if (referenceId != null) {
return referenceId;
}
return task.getTaskDescriptor().getId();
}
});
TableColumn tblclmnTaskDescriptor = tvcTaskDescriptor.getColumn();
tcLayout.setColumnData(tblclmnTaskDescriptor, new ColumnPixelData(100, true, true));
tblclmnTaskDescriptor.setText("Vorlage");
tableViewerResults.addSelectionChangedListener(event -> {
IStructuredSelection selection = tableViewerResults.getStructuredSelection();
selectionService.setSelection(selection.toList());
});
menuService.registerContextMenu(tableResults,
"ch.elexis.core.ui.tasks.popupmenu.tableresults");
refresh();
}
public void refresh(){
IQuery<ITask> taskQuery = TaskModelServiceHolder.get().getQuery(ITask.class);
List<ITask> results = taskQuery.execute();
// add filter
tableViewerResults.setInput(results);
tableViewerResults.setItemCount(results.size());
}
@Focus
public void setFocus(){
tableResults.setFocus();
}
@Optional
@Inject
void deleteTask(@UIEventTopic(ElexisEventTopics.EVENT_DELETE) ITask iTask){
tableViewerResults.remove(iTask);
}
@Override
public void doubleClick(DoubleClickEvent event){
ITask selectedTask = (ITask) ((StructuredSelection) event.getSelection()).getFirstElement();
MPart taskDetailPart =
partService.createPart("ch.elexis.core.ui.tasks.partdescriptor.taskdetail");
taskDetailPart.getTransientData().put("task", selectedTask);
partService.showPart(taskDetailPart, PartState.CREATE);
}
}
package ch.elexis.core.ui.tasks.parts;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.core.di.annotations.CanExecute;
public class TaskResultPartRefreshHandler {
@Execute
public void execute(MPart part){
TaskResultPart taskResultPart = (TaskResultPart) part.getObject();
taskResultPart.refresh();
}
@CanExecute
public boolean canExecute(MPart part){
return true;
}
}
\ No newline at end of file
......@@ -52,7 +52,8 @@
<module>ch.elexis.core.mail</module>
<module>ch.elexis.core.product</module>
<module>ch.elexis.core.scripting.beanshell</module>
<module>ch.elexis.core.tasks</module>
<module>ch.elexis.core.tasks</module>