From d6007ae2792b7c10878c3252809bc98854986b2c Mon Sep 17 00:00:00 2001 From: Michael James Date: Wed, 12 Jul 2017 14:56:25 -0600 Subject: [PATCH] add DeleteAWIPSBundle for d2d file menu --- cave/com.raytheon.uf.viz.d2d.ui/plugin.xml | 18 +++- .../viz/d2d/ui/actions/DeleteAWIPSBundle.java | 93 +++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DeleteAWIPSBundle.java diff --git a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml index 159994117e..fe01c3f043 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml +++ b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml @@ -130,6 +130,11 @@ commandId="com.raytheon.viz.ui.saveBundle" label="Save Bundle Locally" style="push"> + + + + + @@ -1569,11 +1579,17 @@ name="Save Bundle"> + + + * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Jul 12, 2017 mjames@ucar Copied from DeleteAWIPSProcedure + * + * + * @author mjames@ucar + * @version 1 + */ +public class DeleteAWIPSBundle extends AbstractHandler { + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(DeleteAWIPSBundle.class); + + private VizLocalizationFileListDlg listDlg; + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + if (listDlg == null || listDlg.getShell() == null + || listDlg.isDisposed()) { + listDlg = new VizLocalizationFileListDlg("Delete Bundle", + HandlerUtil.getActiveShell(event), Mode.DELETE, + SavePerspectiveHandler.PERSPECTIVES_DIR, "perspectives", + LocalizationType.COMMON_STATIC); + listDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof ILocalizationFile) { + ILocalizationFile selectedFile = (ILocalizationFile) returnValue; + try { + selectedFile.delete(); + } catch (LocalizationException e) { + statusHandler.handle( + Priority.PROBLEM, + "Error deleting bundle: " + + selectedFile.getPath()); + } + } + } + }); + listDlg.open(); + } else { + listDlg.bringToTop(); + } + + return null; + } + +}