From 178c38c07fc70a05e24b0969979a2917272b3975 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Mon, 30 Jul 2012 15:34:16 -0500 Subject: [PATCH] Issue #851 removed obsolete GFE code. Change-Id: I3713b0e265bec9e32cde3c20bc4dae12f6b20a02 Former-commit-id: b1a633e1211d31c843001109becd658e901c8171 [formerly 74478728defc9e1168bbbe0a564fc6880aeda255] [formerly 35d140f0fb96fda55dfa5daab43f2ce272496f00] [formerly b1a633e1211d31c843001109becd658e901c8171 [formerly 74478728defc9e1168bbbe0a564fc6880aeda255] [formerly 35d140f0fb96fda55dfa5daab43f2ce272496f00] [formerly d87c0b6c4be3e4731e5c221270b0fcc62643c754 [formerly 35d140f0fb96fda55dfa5daab43f2ce272496f00 [formerly c91b6fc2c506096f37f175e8196f9aaeb356141d]]]] Former-commit-id: d87c0b6c4be3e4731e5c221270b0fcc62643c754 Former-commit-id: 5a58fc89bf27a4617a4344b72115c5b5b9243fc9 [formerly 4459afa40c618104f638574fc228dd0da8a4ece4] [formerly 6f790834b05690824c16344926fd96fe4133d97f [formerly 6b7f1b361187d4ec91cd350a054801565760f91a]] Former-commit-id: 7b388ba1db3d1ca217963cfd739fa1143fd98195 [formerly 251494458f051b8846ac21589bb9bd2b29cb00a9] Former-commit-id: 12a02df51cdf1eef5d284b7e8af1c4aaf7737c93 --- cave/com.raytheon.viz.gfe/plugin.xml | 12 - .../ShowDefineProceduresDialogAction.java | 64 ---- .../gfe/core/script/action/CopyAction.java | 163 --------- .../gfe/core/script/action/DeleteAction.java | 93 ----- .../gfe/core/script/action/ModifyAction.java | 134 -------- .../gfe/core/script/action/RenameAction.java | 99 ------ .../gfe/core/script/action/SiteAction.java | 174 ---------- .../script/action/SiteOverrideAction.java | 177 ---------- .../gfe/core/script/action/ViewAction.java | 89 ----- .../gfe/dialogs/DefineProceduresDialog.java | 319 ------------------ .../procedures/ProcedureMouseListener.java | 133 -------- .../gfe/textproduct/ProductMouseListener.java | 178 ---------- .../textproduct/UtilitiesMouseListener.java | 151 --------- 13 files changed, 1786 deletions(-) delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineProceduresDialogAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/CopyAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/DeleteAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/ModifyAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/RenameAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/SiteAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/SiteOverrideAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/script/action/ViewAction.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineProceduresDialog.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/procedures/ProcedureMouseListener.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/ProductMouseListener.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/UtilitiesMouseListener.java diff --git a/cave/com.raytheon.viz.gfe/plugin.xml b/cave/com.raytheon.viz.gfe/plugin.xml index 4d4c4a2978..f8737aa0e2 100644 --- a/cave/com.raytheon.viz.gfe/plugin.xml +++ b/cave/com.raytheon.viz.gfe/plugin.xml @@ -62,10 +62,6 @@ - - @@ -417,14 +413,6 @@ - - - - - - - * - * SOFTWARE HISTORY - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Apr 5, 2010 #4956 randerso Initial creation - * - * - * - * @author randerso - * @version 1.0 - */ - -public class ViewAction extends Action { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ViewAction.class); - - String scriptName; - - IScriptUtil util; - - public ViewAction(String scriptName, IScriptUtil util) { - super("View...", Action.AS_PUSH_BUTTON); - this.scriptName = scriptName; - this.util = util; - } - - @Override - public void run() { - LocalizationFile fileToView = null; - - // get the localization file - try { - fileToView = util.find(scriptName, null); - } catch (GFEException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - } - String scriptClass = util.getScriptType(); - - if ((fileToView == null) || !fileToView.exists()) { - // Script has been deleted since we listed it.? - String message = String.format("%s \"%s\" does not exist.", - scriptClass, scriptName); - MessageDialog.openError(Display.getCurrent().getActiveShell(), - "No Such Script", message); - return; - } - - PythonUtil.openPythonFile(fileToView); - } -} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineProceduresDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineProceduresDialog.java deleted file mode 100644 index 12eec8e5f8..0000000000 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineProceduresDialog.java +++ /dev/null @@ -1,319 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.gfe.dialogs; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.jface.action.Action; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Shell; - -import com.raytheon.uf.common.localization.FileUpdatedMessage; -import com.raytheon.uf.common.localization.ILocalizationFileObserver; -import com.raytheon.viz.gfe.core.script.IScriptUtil; -import com.raytheon.viz.gfe.core.script.action.NewAction; -import com.raytheon.viz.gfe.procedures.ProcedureCatalog; -import com.raytheon.viz.gfe.procedures.ProcedureMouseListener; -import com.raytheon.viz.gfe.procedures.util.ProcedureUtil; -import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; - -/** - * Dialog for the define procedures action. Derived from the - * DefineTextProductsDialog - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sept 18, 2008            askripsk     Initial creation.
- * Oct 15, 2009             wldougher    Derived from DefineTextProductsDialog
- * 
- * - * @author askripsk - * @version 1.0 - */ - -public class DefineProceduresDialog extends CaveJFACEDialog { - - public static final int CLOSE_ID = 2; - - private static final int HEIGHT = 330; - - private String title; - - private Shell shell; - - private List proceduresList; - - private Label proceduresLabel; - - private Composite comp; - - private MenuItem newItem; - - private MenuItem newProcedureItem; - - // private ITextProductListChangedListener listListener; - - @SuppressWarnings("unused") - private Button closeButton; - - private ProcedureCatalog catalog; - - private ILocalizationFileObserver observer; - - /** - * Constructor - * - * @param parentShell - * the shell in which the dialog should appear. - * @param dialogTitle - * The text to display in the dialog titlebar. - */ - public DefineProceduresDialog(Shell parentShell) { - super(parentShell); - - this.title = "Define Procedures"; - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); - - catalog = new ProcedureCatalog(); - observer = new ILocalizationFileObserver() { - - /** - * Update proceduresList when scripts are added or deleted. - * - * @see com.raytheon.uf.common.localization.ILocalizationFileObserver#fileUpdated(com.raytheon.uf.common.localization.FileUpdatedMessage) - */ - @Override - public void fileUpdated(FileUpdatedMessage message) { - shell.getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - loadProcedures(); - } - }); - } - - }; - catalog.addObserver(observer); - } - - @Override - public boolean close() { - catalog.removeObserver(observer); - observer = null; - catalog = null; - return super.close(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) - */ - @Override - protected void buttonPressed(int buttonId) { - if (buttonId == CLOSE_ID) { - close(); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets - * .Shell) - */ - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - if (title != null) { - shell.setText(title); - } - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse - * .swt.widgets.Composite) - */ - @Override - protected void createButtonsForButtonBar(Composite parent) { - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER - | GridData.VERTICAL_ALIGN_CENTER); - parent.setLayoutData(data); - this.closeButton = createButton(parent, CLOSE_ID, "Close", true); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.dialogs.CaveJFACEDialog#createContents(org.eclipse - * .swt.widgets.Composite) - */ - @Override - protected Control createContents(Composite parent) { - Control contents = super.createContents(parent); - - getShell().setLocation(getInitialLocation(getShell().getSize())); - - return contents; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets - * .Composite) - */ - @Override - protected Control createDialogArea(final Composite parent) { - - Composite composite = (Composite) super.createDialogArea(parent); - - createMenuBar(parent); - - comp = new Composite(composite, SWT.NONE); - - comp.setLayout(new GridLayout(1, false)); - comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - - // Setup list labels - initProceduresLabel(); - - // Create Lists - initProceduresList(); - - applyDialogFont(composite); - - return composite; - } - - /** - * Create the menu bar. The menubar has one option ("File"), and allows the - * user to create a new procedure or close this dialog. - * - * @param parent - */ - protected void createMenuBar(Composite parent) { - shell = parent.getShell(); - Menu menuBar = new Menu(shell, SWT.BAR); - shell.setMenuBar(menuBar); - shell.setSize(250, HEIGHT); - - // file menu item - MenuItem file = new MenuItem(menuBar, SWT.CASCADE); - file.setText("File"); - Menu fileMenu = new Menu(shell, SWT.DROP_DOWN); - file.setMenu(fileMenu); - - newItem = new MenuItem(fileMenu, SWT.CASCADE); - newItem.setText("New Item In Window..."); - // TODO: add selection listener - - new MenuItem(fileMenu, SWT.SEPARATOR); - MenuItem closeItem = new MenuItem(fileMenu, SWT.PUSH); - closeItem.setText("Close"); - closeItem.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - close(); - } - - }); - - Menu newMenu = new Menu(newItem); - - newProcedureItem = new MenuItem(newMenu, SWT.PUSH); - newProcedureItem.setText("Procedures"); - newProcedureItem.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - IScriptUtil util = new ProcedureUtil(); - Action anAction = new NewAction(util); - anAction.run(); - } - }); - newItem.setMenu(newMenu); - - } - - /** - * Initialize the proceduresLabel variable. - */ - private void initProceduresLabel() { - proceduresLabel = new Label(comp, SWT.NONE); - proceduresLabel.setText("Procedures"); - proceduresLabel.setLayoutData(new GridData(SWT.CENTER, SWT.NONE, false, - false)); - } - - /** - * Create proceduresList, fill it with the procedure names, and connect it - * to the mouse listener for performing actions (modify, delete, etc.). - */ - private void initProceduresList() { - proceduresList = new List(comp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); - GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - layoutData.heightHint = proceduresList.getItemHeight() * 10; - layoutData.widthHint = 150; - proceduresList.setLayoutData(layoutData); - - loadProcedures(); - proceduresList.addMouseListener(new ProcedureMouseListener()); - } - - /** - * Set the contents of proceduresList to all the Python scripts in the GFE - * procedures directory. - */ - private void loadProcedures() { - proceduresList.removeAll(); - - Set procs = new HashSet(); - procs.addAll(catalog.getNames()); - String[] procedures = procs.toArray(new String[0]); - Arrays.sort(procedures, String.CASE_INSENSITIVE_ORDER); - - for (String procedure : procedures) { - proceduresList.add(procedure); - } - } -} \ No newline at end of file diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/procedures/ProcedureMouseListener.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/procedures/ProcedureMouseListener.java deleted file mode 100644 index 8201b2edc7..0000000000 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/procedures/ProcedureMouseListener.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -/** - * - */ -package com.raytheon.viz.gfe.procedures; - -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Menu; - -import com.raytheon.uf.common.localization.LocalizationFile; -import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.viz.gfe.Activator; -import com.raytheon.viz.gfe.GFEException; -import com.raytheon.viz.gfe.constants.StatusConstants; -import com.raytheon.viz.gfe.core.script.AbstractScriptCatalog; -import com.raytheon.viz.gfe.core.script.IScriptUtil; -import com.raytheon.viz.gfe.core.script.action.CopyAction; -import com.raytheon.viz.gfe.core.script.action.DeleteAction; -import com.raytheon.viz.gfe.core.script.action.ModifyAction; -import com.raytheon.viz.gfe.core.script.action.NewAction; -import com.raytheon.viz.gfe.core.script.action.RenameAction; -import com.raytheon.viz.gfe.core.script.action.SiteAction; -import com.raytheon.viz.gfe.core.script.action.ViewAction; -import com.raytheon.viz.gfe.procedures.util.ProcedureUtil; - -/** - * A mouse listener for the procedure list in DefineProceduresDialog. - * - * @author wldougher - * - */ -public class ProcedureMouseListener extends MouseAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ProcedureMouseListener.class); - - private MenuManager menuMgr; - - /** - * Constructor. - */ - public ProcedureMouseListener() { - super(); - } - - /** - * Handle mouse button 3 presses by displaying a small menu for the - * Procedure whose name is under the cursor. Actions which are always - * available on the menu are Copy, Modify, and New (which doesn't care which - * procedure the mouse is over). When the Procedure is at USER level, Delete - * and Rename actions are also offered. - * - * @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt.events.MouseEvent) - */ - @Override - public void mouseDown(MouseEvent e) { - List list = (List) e.getSource(); - String selected = list.getItem(list.getSelectionIndex()); - - if (e.button == 3) { - if (menuMgr == null) { - menuMgr = new MenuManager("#PopupMenu"); - } else { - menuMgr.removeAll(); - } - - IScriptUtil util = new ProcedureUtil(); - AbstractScriptCatalog catalog = new ProcedureCatalog(); - - menuMgr.add(new CopyAction(selected, util)); - menuMgr.add(new Separator()); - menuMgr.add(new ViewAction(selected, util)); - menuMgr.add(new ModifyAction(selected, util)); - menuMgr.add(new NewAction(util)); - - LocalizationFile selectedFile = null; - try { - selectedFile = util.find(selected, LocalizationLevel.USER); - } catch (GFEException e1) { - statusHandler.handle(Priority.VERBOSE, - "Error finding procedure " + selected, e1); - } - LocalizationLevel level = LocalizationLevel.BASE; - if (selectedFile != null) { - level = selectedFile.getContext().getLocalizationLevel(); - } - - // The Rename and Delete options should only be available on - // utilities that the user has created or copied, or to admins - // TODO: add these if user has admin role - if (LocalizationLevel.USER == level || false) { - menuMgr.add(new Separator()); - menuMgr.add(new DeleteAction(selected, util)); - menuMgr.add(new RenameAction(selected, util)); - } - - if (true) { // TODO: only if user is a site admin - if (LocalizationLevel.USER == level) { - menuMgr.add(new Separator()); - menuMgr.add(new SiteAction(selected, util)); - } - } - - Menu menu = menuMgr.createContextMenu(list); - - menu.setVisible(true); - list.setMenu(menu); - } - } -} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/ProductMouseListener.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/ProductMouseListener.java deleted file mode 100644 index 6ea4ac75e3..0000000000 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/ProductMouseListener.java +++ /dev/null @@ -1,178 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.gfe.textproduct; - -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Menu; - -import com.raytheon.uf.common.localization.LocalizationFile; -import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.viz.gfe.Activator; -import com.raytheon.viz.gfe.GFEException; -import com.raytheon.viz.gfe.constants.StatusConstants; -import com.raytheon.viz.gfe.core.script.IScriptUtil; -import com.raytheon.viz.gfe.core.script.action.CopyAction; -import com.raytheon.viz.gfe.core.script.action.ModifyAction; -import com.raytheon.viz.gfe.core.script.action.RenameAction; -import com.raytheon.viz.gfe.core.script.action.ViewAction; -import com.raytheon.viz.gfe.textproduct.action.NewAction; -import com.raytheon.viz.gfe.textproduct.action.TextProductDeleteAction; -import com.raytheon.viz.gfe.textproduct.action.TextProductSiteAction; -import com.raytheon.viz.gfe.textproduct.action.TextProductSiteOverrideAction; - -/** - * Listens to mouse events on the text products list in the - * DefineTextProductsDialog - * - *
- * SOFTWARE HISTORY
- * Date          Ticket#    Engineer    Description
- * ------------  ---------- ----------- --------------------------
- * Sept 19, 2008            askripsk    Initial creation
- * 
- * 
- * - * @author askripsk - * @version 1.0 - */ - -public class ProductMouseListener implements MouseListener { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ProductMouseListener.class); - - private MenuManager menuMgr; - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt - * .events.MouseEvent) - */ - @Override - public void mouseDoubleClick(MouseEvent e) { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events - * .MouseEvent) - */ - @Override - public void mouseDown(MouseEvent e) { - - List list = (List) e.getSource(); - String selected = list.getItem(list.getSelectionIndex()); - - if (e.button == 3) { - if (menuMgr == null) { - menuMgr = new MenuManager("#PopupMenu"); - } else { - menuMgr.removeAll(); - } - - IScriptUtil util = new TextProductUtil(); - menuMgr.add(new CopyAction(selected, util)); - menuMgr.add(new Separator()); - menuMgr.add(new ViewAction(selected, util)); - menuMgr.add(new ModifyAction(selected, util)); - menuMgr.add(new NewAction()); - - // Get the localization level of the selection - LocalizationFile script = null; - try { - script = util.find(selected, null); - } catch (GFEException e1) { - statusHandler.handle(Priority.PROBLEM, - "Unable to find script " + selected, e1); - } - LocalizationLevel level = LocalizationLevel.BASE; - if (script != null) { - level = script.getContext().getLocalizationLevel(); - } - - // Some text product specific Action classes were created for use - // here specifically for ticket #5074 that are largely copies of the - // Action classes in the com.raytheon.viz.gfe.core.script.action - // package with some specific changes for its unique storage - // hierarchy. They are not well-designed but I was assured that the - // design of the dialog this listener supports will be changing - // soon. - // TODO: REMOVE these classes and modify the ones within - // com.raytheon.viz.gfe.core.script.action to support both text - // products and the other python-based items that are currently - // supported. - - // The Rename and Delete options should only be available on - // utilities that the user has created or copied, or to admins - // TODO: add these if user has admin role - if (LocalizationLevel.USER == level || false) { - menuMgr.add(new Separator()); - menuMgr.add(new TextProductDeleteAction(selected, util)); - menuMgr.add(new RenameAction(selected, util)); - } - - // TODO: skip if user is not site-admin - - if (true) { // TODO: check user site-admin rights - if (LocalizationLevel.USER == level - || LocalizationLevel.SITE == level) { - menuMgr.add(new Separator()); - } - boolean isOverride = selected.matches("(?i).+override"); - if (LocalizationLevel.USER == level) { - menuMgr.add(new TextProductSiteAction(selected, util)); - if (!isOverride) { - menuMgr.add(new TextProductSiteOverrideAction(selected, - util)); - } - } else if (LocalizationLevel.SITE == level) { - if (isOverride) { - menuMgr.add(new TextProductSiteAction(selected, util)); - } - } - } - - Menu menu = menuMgr.createContextMenu(list); - - menu.setVisible(true); - list.setMenu(menu); - } - } - - /* - * (non-Javadoc) - * - * @seeorg.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events. - * MouseEvent) - */ - @Override - public void mouseUp(MouseEvent arg0) { - } - -} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/UtilitiesMouseListener.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/UtilitiesMouseListener.java deleted file mode 100644 index ceedc310c5..0000000000 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textproduct/UtilitiesMouseListener.java +++ /dev/null @@ -1,151 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.gfe.textproduct; - -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Menu; - -import com.raytheon.uf.common.localization.LocalizationFile; -import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.viz.gfe.Activator; -import com.raytheon.viz.gfe.GFEException; -import com.raytheon.viz.gfe.constants.StatusConstants; -import com.raytheon.viz.gfe.core.script.IScriptUtil; -import com.raytheon.viz.gfe.core.script.action.CopyAction; -import com.raytheon.viz.gfe.core.script.action.DeleteAction; -import com.raytheon.viz.gfe.core.script.action.ModifyAction; -import com.raytheon.viz.gfe.core.script.action.NewAction; -import com.raytheon.viz.gfe.core.script.action.RenameAction; -import com.raytheon.viz.gfe.core.script.action.SiteAction; -import com.raytheon.viz.gfe.core.script.action.ViewAction; - -/** - * Listens to mouse events on the text products list in the - * DefineTextProductsDialog - * - *
- * SOFTWARE HISTORY
- * Date          Ticket#    Engineer    Description
- * ------------  ---------- ----------- --------------------------
- * Sept 19, 2008            askripsk    Initial creation
- * 
- * 
- * - * @author askripsk - * @version 1.0 - */ - -public class UtilitiesMouseListener implements MouseListener { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(UtilitiesMouseListener.class); - - private MenuManager menuMgr; - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt - * .events.MouseEvent) - */ - @Override - public void mouseDoubleClick(MouseEvent e) { - - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events - * .MouseEvent) - */ - @Override - public void mouseDown(MouseEvent e) { - - List list = (List) e.getSource(); - String selected = list.getItem(list.getSelectionIndex()); - - if (e.button == 3) { - if (menuMgr == null) { - menuMgr = new MenuManager("#PopupMenu"); - } else { - menuMgr.removeAll(); - } - - IScriptUtil util = new TextUtilityUtil(); - menuMgr.add(new CopyAction(selected, util)); - menuMgr.add(new Separator()); - menuMgr.add(new ViewAction(selected, util)); - menuMgr.add(new ModifyAction(selected, util)); - menuMgr.add(new NewAction(util)); - - LocalizationFile script = null; - try { - script = util.find(selected, null); - } catch (GFEException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error finding script " + selected, e1); - } - LocalizationLevel level = null; - if (script != null) { - level = script.getContext().getLocalizationLevel(); - } - // The Rename and Delete options should only be available on - // utilities that the user has created or copied, or to admins - // TODO: add these if user has admin role - if (LocalizationLevel.USER == level || false) { - menuMgr.add(new Separator()); - menuMgr.add(new DeleteAction(selected, util)); - menuMgr.add(new RenameAction(selected, util)); - } - - if (true) { // TODO: skip if user is not site-admin - if (LocalizationLevel.USER == level) { - menuMgr.add(new Separator()); - menuMgr.add(new SiteAction(selected, util)); - } - } - - Menu menu = menuMgr.createContextMenu(list); - - menu.setVisible(true); - list.setMenu(menu); - } - } - - /* - * (non-Javadoc) - * - * @seeorg.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events. - * MouseEvent) - */ - @Override - public void mouseUp(MouseEvent arg0) { - - } - -}