diff --git a/cave/com.raytheon.viz.texteditor/plugin.xml b/cave/com.raytheon.viz.texteditor/plugin.xml index 72a8f856fb..7f329b32a7 100644 --- a/cave/com.raytheon.viz.texteditor/plugin.xml +++ b/cave/com.raytheon.viz.texteditor/plugin.xml @@ -65,13 +65,6 @@ commandId="com.raytheon.viz.texteditor.afosproduct"> - - - * * @author mschenke * @version 1.0 + * + * */ public class TextWorkstationConstants { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(TextWorkstationConstants.class); - - private static IPersistentPreferenceStore store = null; private static final String TEXTWORKSTATION_QUEUE = "textWorkstation"; public static final String P_TEXTWORKSTATION_ID = "workstationId"; - private static String host = null; - - private static String TEXTWS = System.getenv("TEXTWS"); + private static String host = "localhost"; public static String getId() { - IPersistentPreferenceStore store = getPreferenceStore(); - String id = store.getString(P_TEXTWORKSTATION_ID); - if (id == null || id.trim().equals("")) { - id = TEXTWS; - if (id != null && !id.trim().equals("")) { - store.putValue(P_TEXTWORKSTATION_ID, id); - try { - store.save(); - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - } - } - } - return id; + return host; } /** @@ -135,47 +104,6 @@ public class TextWorkstationConstants { return host; } - public static IPersistentPreferenceStore getPreferenceStore() { - if (store == null) { - IPathManager pm = PathManagerFactory.getPathManager(); - final LocalizationFile file = pm.getLocalizationFile(pm - .getContext(LocalizationType.CAVE_STATIC, - LocalizationLevel.WORKSTATION), "textWs" - + File.separator + "textws.prefs"); - File f = file.getFile(); - if (f.exists() == false) { - try { - f.getParentFile().mkdirs(); - f.createNewFile(); - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Error getting text workstation preferences", e); - } - } - store = new PreferenceStore(file.getFile().getAbsolutePath()) { - - @Override - public void save() throws IOException { - super.save(); - try { - file.save(); - } catch (LocalizationException e) { - statusHandler.handle(Priority.PROBLEM, - "Error saving text workstation preferences", e); - } - } - - }; - try { - ((PreferenceStore) store).load(); - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Error loading text workstation preferences", e); - } - } - return store; - } - public static String getDestinationTextWorkstationQueueName() throws UnknownHostException { StringBuilder queueName = getTextWorkstationQueueNameBuilder(); diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWorkstationPreferences.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWorkstationPreferences.java deleted file mode 100644 index 12d232ad39..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWorkstationPreferences.java +++ /dev/null @@ -1,123 +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.texteditor; - -import java.net.InetAddress; -import java.net.UnknownHostException; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.swt.SWT; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 11, 2009            mschenke     Initial creation
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class TextWorkstationPreferences extends FieldEditorPreferencePage - implements IWorkbenchPreferencePage { - - private StringFieldEditor hostEditor; - - public TextWorkstationPreferences() { - super(GRID); - setPreferenceStore(TextWorkstationConstants.getPreferenceStore()); - setDescription("Specify the host for Text Workstation communication." - + " Should be the network accessible host of workstation as seen" - + " in the Text Workstation dialog."); - } - - @Override - protected void createFieldEditors() { - // Make sure we grab the env variable if needed - TextWorkstationConstants.getId(); - hostEditor = new StringFieldEditor( - TextWorkstationConstants.P_TEXTWORKSTATION_ID, - "Text Workstation host: ", getFieldEditorParent()) { - - private String ip; - - @Override - protected boolean checkState() { - String host = getTextControl().getText(); - boolean rval = true; - try { - ip = InetAddress.getByName(host).getHostAddress(); - } catch (UnknownHostException e) { - rval = false; - } - - if (rval == false) { - getTextControl().setBackground( - getShell().getDisplay().getSystemColor( - SWT.COLOR_RED)); - } else { - getTextControl().setBackground( - getShell().getDisplay().getSystemColor( - SWT.COLOR_WHITE)); - } - - return rval; - } - - @Override - protected void doStore() { - boolean rval = true; - if (ip != null && ip.startsWith("127.0.")) { - rval = MessageDialog - .openQuestion( - getShell(), - "Confirm", - "The host string you entered maps to a localhost" - + " ip address, are you sure this is" - + " the host name as seen in the Text Workstation dialog?"); - } - if (rval) { - super.doStore(); - } - } - - }; - - hostEditor - .setErrorMessage("Unable to validate hostname for text workstation"); - addField(hostEditor); - } - - @Override - public void init(IWorkbench workbench) { - // TODO Auto-generated method stub - } - -} diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 351e4cac4b..d7b1277200 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -6643,7 +6643,7 @@ public class TextEditorDialog extends CaveSWTDialog } /** - * Clear the information on the text workstaion button for this text editor + * Clear the information on the text workstation button for this text editor * dialog. */ public void clearButtonology() { diff --git a/cave/com.raytheon.viz.textworkstation/plugin.xml b/cave/com.raytheon.viz.textworkstation/plugin.xml index ff5a5fafaf..52668041d3 100644 --- a/cave/com.raytheon.viz.textworkstation/plugin.xml +++ b/cave/com.raytheon.viz.textworkstation/plugin.xml @@ -54,22 +54,5 @@ point="com.raytheon.uf.viz.core.component">
- - - - - - diff --git a/cave/com.raytheon.viz.warngen/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.warngen/META-INF/MANIFEST.MF index 3a5d89fd91..39478b42ea 100644 --- a/cave/com.raytheon.viz.warngen/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.warngen/META-INF/MANIFEST.MF @@ -38,6 +38,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Import-Package: com.raytheon.uf.common.activetable, com.raytheon.uf.common.dataplugin.text.request, com.raytheon.viz.radar, + com.raytheon.viz.textworkstation, com.raytheon.viz.warnings, javax.vecmath, org.eclipse.core.expressions diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java index 7f2055f7e8..777be074b9 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java @@ -64,6 +64,7 @@ import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil; * Sep 13, 2013 2368 rjpeter Set delivery mode to PERSISTENT. * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * Sep 03, 2015 4784 rjpeter Set notifySubscriptions on sendToTextDatabase. + * Jun 15, 2017 ---- mjames@ucar Force practice mode. * * * @author mschenke @@ -258,9 +259,7 @@ public class WarningSender implements IWarngenObserver { */ public static void sendToTextDatabase(String id, String warning) throws VizException { - CAVEMode mode = CAVEMode.getMode(); - boolean operationalMode = (CAVEMode.OPERATIONAL.equals(mode) - || CAVEMode.TEST.equals(mode) ? true : false); + boolean operationalMode = false; // Generate StdTextProduct and insert into db long t0 = System.currentTimeMillis(); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java index f7381d8b59..d1fa196bde 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java @@ -21,6 +21,7 @@ package com.raytheon.viz.warngen.gui; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -31,6 +32,8 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction; +import com.raytheon.viz.textworkstation.TextWorkstationDlg; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.input.EditableManager; import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; @@ -47,6 +50,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; * with minor changes. * Aug 15, 2013 DR 16418 D. Friedman Always show the dialog. * Sep 22, 2015 4859 dgilling Prevent dialog from showing in DRT mode. + * Jun 15, 2017 ---- mjames@ucar Open TextWorkstation. * * * @@ -55,6 +59,9 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; */ public class WarngenAction extends AbstractGenericToolAction { + + private static TextWorkstationDlg textWorkstationDlg; + /* * (non-Javadoc) * @@ -88,6 +95,21 @@ public class WarngenAction extends AbstractGenericToolAction { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { + + if ((textWorkstationDlg == null) || textWorkstationDlg.isDisposed()) { + textWorkstationDlg = new TextWorkstationDlg(Display.getCurrent()); + textWorkstationDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + textWorkstationDlg = null; + } + }); + textWorkstationDlg.open(); + } else { + textWorkstationDlg.bringToTop(); + } + if (!SimulatedTimeOperations.isTransmitAllowed()) { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell();