From b95b380eb244e11324b38b23e4fe44f2c57d7721 Mon Sep 17 00:00:00 2001 From: Lee Venable Date: Wed, 11 Dec 2013 13:37:51 -0600 Subject: [PATCH] Issue #2583 - Procedure dialog fixes and clean up. Change-Id: I9255d9bb21bc8794aacddffe571e62149dd08c10 Former-commit-id: d6eb7534f55f3b41bd4ba5477e5751377245520a [formerly aa0e9121f8aa998ebe8a56d686c3f3eb33e586fa] [formerly d6eb7534f55f3b41bd4ba5477e5751377245520a [formerly aa0e9121f8aa998ebe8a56d686c3f3eb33e586fa] [formerly 7ee6053c2206a5ceff4240e066a90486a000bdf6 [formerly c88681909d99025be43e5d77dd2a89bbc6e929e2]]] Former-commit-id: 7ee6053c2206a5ceff4240e066a90486a000bdf6 Former-commit-id: d05d6504302d9826feafd08b16f732060ef8bbb0 [formerly f3c8b69e2e3c1bd928b8435eb490014d14fddc0e] Former-commit-id: b7d5aa748a7abef2b98036b5f213d3e984547142 --- .../procedures/OpenProcedureListDlg.java | 50 +- .../dialogs/procedures/ProcedureListDlg.java | 513 +++++++++++------- 2 files changed, 364 insertions(+), 199 deletions(-) diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/OpenProcedureListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/OpenProcedureListDlg.java index d7f8e3a2ba..947a563395 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/OpenProcedureListDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/OpenProcedureListDlg.java @@ -25,7 +25,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.common.localization.IPathManager; @@ -37,7 +36,7 @@ import com.raytheon.uf.common.localization.LocalizationUtil; import com.raytheon.uf.common.localization.PathManagerFactory; /** - * TODO Add Description + * This dialog will allow users to open existing procedures. * *
  * 
@@ -46,6 +45,8 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Mar 16, 2011            mschenke     Initial creation
+ * 11 Dec 2013  #2583      lvenable    Added a check to determine if current user,
+ *                                     all users or all procedures should be requested.
  * 
  * 
* @@ -56,16 +57,18 @@ import com.raytheon.uf.common.localization.PathManagerFactory; public class OpenProcedureListDlg extends ProcedureListDlg { /** - * @param title + * Constructor. + * * @param parent - * @param mode + * Parent shell. */ public OpenProcedureListDlg(Shell parent) { super("Open Procedure", parent, Mode.OPEN); } @Override - protected ProcedureTree populateDataList(TreeViewer treeViewer) { + protected ProcedureTree populateDataList() { + ProcedureTree root = new ProcedureTree("root", null); IPathManager pm = PathManagerFactory.getPathManager(); Set searchContexts = new HashSet(); @@ -73,18 +76,31 @@ public class OpenProcedureListDlg extends ProcedureListDlg { searchContexts.addAll(Arrays.asList(pm .getLocalSearchHierarchy(LocalizationType.CAVE_STATIC))); - // Use of LocalizationLevels.values() in this case should be okay since - // we are requesting all possible context names for the level, doesn't - // matter if our local context for the level is set - LocalizationLevel[] levels = pm.getAvailableLevels(); - for (LocalizationLevel level : levels) { - if (level.isSystemLevel() == false) { - String[] available = pm.getContextList(level); - for (String s : available) { - LocalizationContext ctx = pm.getContext( - LocalizationType.CAVE_STATIC, level); - ctx.setContextName(s); - searchContexts.add(ctx); + // If the show type is not the current user then look at loading the + // remaining procedures. + if (selectedShowType != ShowType.MINE) { + // Use of LocalizationLevels.values() in this case should be okay + // since we are requesting all possible context names for the level, + // doesn't matter if our local context for the level is set + LocalizationLevel[] levels = pm.getAvailableLevels(); + for (LocalizationLevel level : levels) { + + // If the show type is all users and the localization is USER or + // show type is ALL then load the procedure. This will either + // load all of the procedures or only the ones at the user + // level. + if ((selectedShowType == ShowType.ALL_USERS && level == LocalizationLevel.USER) + || selectedShowType == ShowType.ALL) { + + if (level.isSystemLevel() == false) { + String[] available = pm.getContextList(level); + for (String s : available) { + LocalizationContext ctx = pm.getContext( + LocalizationType.CAVE_STATIC, level); + ctx.setContextName(s); + searchContexts.add(ctx); + } + } } } } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java index 664d74ca44..8b7ec79fc1 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java @@ -19,23 +19,18 @@ **/ package com.raytheon.uf.viz.d2d.ui.dialogs.procedures; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowData; @@ -43,11 +38,10 @@ import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.TreeItem; -import org.eclipse.ui.IWorkbenchActionConstants; import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.LocalizationContext; @@ -74,6 +68,12 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 07/31/2012 DR 15036 D. Friedman Ensure current user's procedures * are visible. * 10/16/2012 1229 rferrel Made dialog non-blocking. + * 11 Dec 2013 #2583 lvenable Added show mine, show all users, and show + * all radio buttons, fixed a widget disposed + * error, cleaned up code to prevent buttons + * from magically appearing, removed dead code, + * and other code clean up. + * * * * @author unknown @@ -81,32 +81,85 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class ProcedureListDlg extends CaveSWTDialog { + /** Flag indicating the data will only be at the root level. */ protected boolean oneLevel = true; - private Font font; - + /** Text control that contains a selected procedure from the tree viewer. */ private Text procedureTF; + /** Tree that holds the procedure data. */ private TreeViewer treeViewer; + /** OK button. */ private Button okBtn; + /** Cancel button. */ private Button cancelBtn; - private Button frozenBtn; + /** Frozen check box. */ + private Button frozenChk; + /** Frozen flag. */ private boolean frozen = false; - String fileName; + /** Selected filename. */ + private String fileName; private ProcedureTree fileTree = new ProcedureTree(null, null); + /** Flag indicating if all users should be displayed. */ + private boolean showAllUsersFlag = false; + + /** Expand button. */ + private Button expandButton; + + /** Collapse button. */ + private Button collapseButton; + + /** Show current user procedures. */ + private Button showMineRdo = null; + + /** Show all user procedures. */ + private Button showAllUsersRdo = null; + + /** Show all procedures. */ + private Button showAllProceduresRdo = null; + + /** List of buttons that will be enabled or disabled. */ + private List