Loading bundles/ch.elexis.core.ui/plugin.xml +6 −0 Original line number Diff line number Diff line Loading @@ -776,6 +776,12 @@ id="ch.elexis.core.ui.commands.printAddressLabel" name="%elexis.printAddresslabel"> </command> <command categoryId="ch.elexis.core.ui.commands.kategorie" defaultHandler="ch.elexis.core.ui.commands.PrintContactLabelHandler" id="ch.elexis.core.ui.commands.printContactLabel" name="Print address label"> </command> </extension> <extension point="ch.elexis.core.ui.KonsExtension"> Loading bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/actions/GlobalActions.java +7 −34 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import java.util.StringJoiner; import org.eclipse.core.commands.Category; import org.eclipse.core.commands.Command; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.IHandler; Loading Loading @@ -142,7 +141,6 @@ public class GlobalActions { private static IWorkbenchHelpSystem help; private static Logger logger; private static ICommandService cmdService; private static Category cmdCategory; /** * Open the preferences dialog. This a copy of the same internal eclipse where we just want to have a large dialog action */ Loading Loading @@ -208,7 +206,6 @@ public class GlobalActions { } logger = LoggerFactory.getLogger(this.getClass()); cmdService = (ICommandService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class); cmdCategory = cmdService.getCategory("ch.elexis.core.ui.commands.kategorie"); mainWindow = window; help = Hub.plugin.getWorkbench().getHelpSystem(); exitAction = ActionFactory.QUIT.create(window); Loading Loading @@ -406,28 +403,13 @@ public class GlobalActions { @Override public void run(){ Kontakt kontakt = (Kontakt) ElexisEventDispatcher.getSelected(Kontakt.class); if (kontakt == null) { SWTHelper.showInfo("Kein Kontakt ausgewählt", "Bitte wählen Sie vor dem Drucken einen Kontakt!"); return; } EtiketteDruckenDialog dlg = new EtiketteDruckenDialog(mainWindow.getShell(), kontakt, TT_ADDRESS_LABEL); dlg.setTitle(Messages.GlobalActions_PrintContactLabel); dlg.setMessage(Messages.GlobalActions_PrintContactLabelToolTip); if (isDirectPrint()) { dlg.setBlockOnOpen(false); dlg.open(); if (dlg.doPrint()) { dlg.close(); } else { SWTHelper.alert("Fehler beim Drucken", "Beim Drucken ist ein Fehler aufgetreten. Bitte überprüfen Sie die Einstellungen."); } } else { dlg.setBlockOnOpen(true); dlg.open(); Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printContactLabel"); try { cmd.executeWithChecks(new ExecutionEvent()); } catch (Exception e) { ExHandler.handle(e); logger.error("Failed to execute command ch.elexis.core.ui.commands.printContactLabel", e); } } }; Loading @@ -441,9 +423,6 @@ public class GlobalActions { @Override public void run(){ Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printAddressLabel"); if (!cmd.isDefined()) { cmd.define(Messages.GlobalActions_PrintAddressLabel, Messages.GlobalActions_PrintAddressLabelToolTip, cmdCategory); } try { cmd.executeWithChecks(new ExecutionEvent()); Loading @@ -463,9 +442,6 @@ public class GlobalActions { @Override public void run(){ Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printVersionedLabel"); if (!cmd.isDefined()) { cmd.define(Messages.GlobalActions_PrintVersionedLabel, Messages.GlobalActions_PrintVersionedLabelToolTip, cmdCategory); } try { cmd.executeWithChecks(new ExecutionEvent()); Loading @@ -485,9 +461,6 @@ public class GlobalActions { @Override public void run(){ Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printPatientLabel"); if (!cmd.isDefined()) { cmd.define(Messages.GlobalActions_PrintLabel, Messages.GlobalActions_PrintLabelToolTip, cmdCategory); } try { cmd.executeWithChecks(new ExecutionEvent()); Loading bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/commands/PrintContactLabelHandler.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2019 IT-Med AG <info@it-med-ag.ch>. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IT-Med AG <info@it-med-ag.ch> - initial implementation ******************************************************************************/ package ch.elexis.core.ui.commands; import static ch.elexis.core.ui.text.TextTemplateRequirement.TT_ADDRESS_LABEL; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.PlatformUI; import ch.elexis.core.data.activator.CoreHub; import ch.elexis.core.data.events.ElexisEventDispatcher; import ch.elexis.core.ui.actions.Messages; import ch.elexis.core.ui.dialogs.EtiketteDruckenDialog; import ch.elexis.core.ui.util.SWTHelper; import ch.elexis.data.Kontakt; public final class PrintContactLabelHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { Kontakt kontakt = (Kontakt) ElexisEventDispatcher.getSelected(Kontakt.class); if (kontakt == null) { SWTHelper.showInfo("Kein Kontakt ausgewählt", "Bitte wählen Sie vor dem Drucken einen Kontakt!"); return null; } EtiketteDruckenDialog dlg = new EtiketteDruckenDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), kontakt, TT_ADDRESS_LABEL); dlg.setTitle(Messages.GlobalActions_PrintContactLabel); dlg.setMessage(Messages.GlobalActions_PrintContactLabelToolTip); if (!CoreHub.localCfg.get("Drucker/Etiketten/Choose", true)) { dlg.setBlockOnOpen(false); dlg.open(); if (dlg.doPrint()) { dlg.close(); } else { SWTHelper.alert("Fehler beim Drucken", "Beim Drucken ist ein Fehler aufgetreten. Bitte überprüfen Sie die Einstellungen."); } } else { dlg.setBlockOnOpen(true); dlg.open(); } return null; } } Loading
bundles/ch.elexis.core.ui/plugin.xml +6 −0 Original line number Diff line number Diff line Loading @@ -776,6 +776,12 @@ id="ch.elexis.core.ui.commands.printAddressLabel" name="%elexis.printAddresslabel"> </command> <command categoryId="ch.elexis.core.ui.commands.kategorie" defaultHandler="ch.elexis.core.ui.commands.PrintContactLabelHandler" id="ch.elexis.core.ui.commands.printContactLabel" name="Print address label"> </command> </extension> <extension point="ch.elexis.core.ui.KonsExtension"> Loading
bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/actions/GlobalActions.java +7 −34 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import java.util.List; import java.util.Map; import java.util.StringJoiner; import org.eclipse.core.commands.Category; import org.eclipse.core.commands.Command; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.IHandler; Loading Loading @@ -142,7 +141,6 @@ public class GlobalActions { private static IWorkbenchHelpSystem help; private static Logger logger; private static ICommandService cmdService; private static Category cmdCategory; /** * Open the preferences dialog. This a copy of the same internal eclipse where we just want to have a large dialog action */ Loading Loading @@ -208,7 +206,6 @@ public class GlobalActions { } logger = LoggerFactory.getLogger(this.getClass()); cmdService = (ICommandService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class); cmdCategory = cmdService.getCategory("ch.elexis.core.ui.commands.kategorie"); mainWindow = window; help = Hub.plugin.getWorkbench().getHelpSystem(); exitAction = ActionFactory.QUIT.create(window); Loading Loading @@ -406,28 +403,13 @@ public class GlobalActions { @Override public void run(){ Kontakt kontakt = (Kontakt) ElexisEventDispatcher.getSelected(Kontakt.class); if (kontakt == null) { SWTHelper.showInfo("Kein Kontakt ausgewählt", "Bitte wählen Sie vor dem Drucken einen Kontakt!"); return; } EtiketteDruckenDialog dlg = new EtiketteDruckenDialog(mainWindow.getShell(), kontakt, TT_ADDRESS_LABEL); dlg.setTitle(Messages.GlobalActions_PrintContactLabel); dlg.setMessage(Messages.GlobalActions_PrintContactLabelToolTip); if (isDirectPrint()) { dlg.setBlockOnOpen(false); dlg.open(); if (dlg.doPrint()) { dlg.close(); } else { SWTHelper.alert("Fehler beim Drucken", "Beim Drucken ist ein Fehler aufgetreten. Bitte überprüfen Sie die Einstellungen."); } } else { dlg.setBlockOnOpen(true); dlg.open(); Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printContactLabel"); try { cmd.executeWithChecks(new ExecutionEvent()); } catch (Exception e) { ExHandler.handle(e); logger.error("Failed to execute command ch.elexis.core.ui.commands.printContactLabel", e); } } }; Loading @@ -441,9 +423,6 @@ public class GlobalActions { @Override public void run(){ Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printAddressLabel"); if (!cmd.isDefined()) { cmd.define(Messages.GlobalActions_PrintAddressLabel, Messages.GlobalActions_PrintAddressLabelToolTip, cmdCategory); } try { cmd.executeWithChecks(new ExecutionEvent()); Loading @@ -463,9 +442,6 @@ public class GlobalActions { @Override public void run(){ Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printVersionedLabel"); if (!cmd.isDefined()) { cmd.define(Messages.GlobalActions_PrintVersionedLabel, Messages.GlobalActions_PrintVersionedLabelToolTip, cmdCategory); } try { cmd.executeWithChecks(new ExecutionEvent()); Loading @@ -485,9 +461,6 @@ public class GlobalActions { @Override public void run(){ Command cmd = cmdService.getCommand("ch.elexis.core.ui.commands.printPatientLabel"); if (!cmd.isDefined()) { cmd.define(Messages.GlobalActions_PrintLabel, Messages.GlobalActions_PrintLabelToolTip, cmdCategory); } try { cmd.executeWithChecks(new ExecutionEvent()); Loading
bundles/ch.elexis.core.ui/src/ch/elexis/core/ui/commands/PrintContactLabelHandler.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /******************************************************************************* * Copyright (c) 2019 IT-Med AG <info@it-med-ag.ch>. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IT-Med AG <info@it-med-ag.ch> - initial implementation ******************************************************************************/ package ch.elexis.core.ui.commands; import static ch.elexis.core.ui.text.TextTemplateRequirement.TT_ADDRESS_LABEL; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.PlatformUI; import ch.elexis.core.data.activator.CoreHub; import ch.elexis.core.data.events.ElexisEventDispatcher; import ch.elexis.core.ui.actions.Messages; import ch.elexis.core.ui.dialogs.EtiketteDruckenDialog; import ch.elexis.core.ui.util.SWTHelper; import ch.elexis.data.Kontakt; public final class PrintContactLabelHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { Kontakt kontakt = (Kontakt) ElexisEventDispatcher.getSelected(Kontakt.class); if (kontakt == null) { SWTHelper.showInfo("Kein Kontakt ausgewählt", "Bitte wählen Sie vor dem Drucken einen Kontakt!"); return null; } EtiketteDruckenDialog dlg = new EtiketteDruckenDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), kontakt, TT_ADDRESS_LABEL); dlg.setTitle(Messages.GlobalActions_PrintContactLabel); dlg.setMessage(Messages.GlobalActions_PrintContactLabelToolTip); if (!CoreHub.localCfg.get("Drucker/Etiketten/Choose", true)) { dlg.setBlockOnOpen(false); dlg.open(); if (dlg.doPrint()) { dlg.close(); } else { SWTHelper.alert("Fehler beim Drucken", "Beim Drucken ist ein Fehler aufgetreten. Bitte überprüfen Sie die Einstellungen."); } } else { dlg.setBlockOnOpen(true); dlg.open(); } return null; } }