Commit 1a5abcea authored by slogic-sa's avatar slogic-sa Committed by Thomas Huster

[17333] Dokumente View, Aktionen rechts neben dem Filter Text (#385)

parent 08905ce1
Pipeline #12547 passed with stages
in 5 minutes and 3 seconds
......@@ -81,6 +81,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.elexis.core.common.ElexisEventTopics;
import ch.elexis.core.data.events.ElexisEventDispatcher;
import ch.elexis.core.documents.FilterCategory;
import ch.elexis.core.exceptions.ElexisException;
import ch.elexis.core.model.BriefConstants;
......@@ -584,6 +585,9 @@ public class DocumentsView extends ViewPart {
private void createFlatMenu(Composite filterComposite){
ToolBarManager tMenuManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP);
tMenuManager.add(new Action("Neuer Brief", Action.AS_PUSH_BUTTON) {
{
setImageDescriptor(Images.IMG_NEW.getImageDescriptor());
}
@SuppressWarnings("restriction")
@Override
public void run(){
......@@ -595,7 +599,10 @@ public class DocumentsView extends ViewPart {
super.run();
}
});
tMenuManager.add(new Action("AUF", Action.AS_PUSH_BUTTON) {
tMenuManager.add(new Action("AUF erstellen und drucken") {
{
setImageDescriptor(Images.IMG_VIEW_WORK_INCAPABLE.getImageDescriptor());
}
@SuppressWarnings("restriction")
@Override
public void run(){
......@@ -604,6 +611,7 @@ public class DocumentsView extends ViewPart {
if (cmd != null) {
Object createdAuf = handlerService.executeHandler(cmd);
if (createdAuf instanceof AUF) {
ElexisEventDispatcher.fireSelectionEvent((AUF) createdAuf);
// print
cmd = commandService.createCommand("ch.elexis.core.ui.commands.AufPrint",
null);
......@@ -616,6 +624,9 @@ public class DocumentsView extends ViewPart {
}
});
tMenuManager.add(new Action("Import", Action.AS_PUSH_BUTTON) {
{
setImageDescriptor(Images.IMG_IMPORT.getImageDescriptor());
}
@SuppressWarnings("restriction")
@Override
public void run(){
......
......@@ -5,13 +5,11 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PlatformUI;
import ch.elexis.core.data.events.ElexisEventDispatcher;
import ch.elexis.core.ui.dialogs.EditAUFDialog;
import ch.elexis.core.ui.util.SWTHelper;
import ch.elexis.core.ui.views.AUF2;
import ch.elexis.core.ui.views.Messages;
import ch.elexis.data.Fall;
import ch.elexis.data.Konsultation;
......@@ -53,11 +51,6 @@ public class AufNewHandler extends AbstractHandler implements IHandler {
new EditAUFDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), null,
fall);
if (dlg.open() == Dialog.OK) {
IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().findView(AUF2.ID);
if (viewPart instanceof AUF2) {
((AUF2) viewPart).refreshTable(false);
}
return dlg.getAuf();
}
return null;
......
......@@ -13,6 +13,7 @@
package ch.elexis.core.ui.views;
import java.util.List;
import java.util.Objects;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
......@@ -20,6 +21,7 @@ import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.dnd.DND;
......@@ -65,6 +67,15 @@ public class AUF2 extends ViewPart implements IActivationListener {
boolean bSelect = (ev.getType() == ElexisEvent.EVENT_SELECTED);
modAUF.setEnabled(bSelect);
delAUF.setEnabled(bSelect);
if (bSelect && tv != null) {
// refresh & select only if not already selected
if (ev.getObject() instanceof AUF && !Objects.equals(tv.getStructuredSelection(),
new StructuredSelection(ev.getObject()))) {
tv.refresh(false);
tv.setSelection(new StructuredSelection(ev.getObject()));
}
}
}
};
private ElexisEventListener eli_pat = new ElexisUiEventListenerImpl(Patient.class) {
......@@ -150,7 +161,10 @@ public class AUF2 extends ViewPart implements IActivationListener {
IHandlerService handlerService =
(IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
try {
handlerService.executeCommand(AufNewHandler.CMD_ID, null);
Object createdAuf = handlerService.executeCommand(AufNewHandler.CMD_ID, null);
if (createdAuf instanceof AUF) {
ElexisEventDispatcher.fireSelectionEvent((AUF) createdAuf);
}
} catch (Exception e) {
LoggerFactory.getLogger(BriefAuswahl.class).error("cannot execute cmd", e);
}
......@@ -252,11 +266,4 @@ public class AUF2 extends ViewPart implements IActivationListener {
ElexisEventDispatcher.getInstance().removeListeners(eli_auf, eli_pat);
}
}
public void refreshTable(boolean updateLbls){
if (tv != null) {
tv.refresh(updateLbls);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment