remove TextWS prefs, assume localhost, cleanup warngen ux
This commit is contained in:
parent
c0105f851a
commit
7a309091fa
9 changed files with 31 additions and 229 deletions
|
@ -65,13 +65,6 @@
|
||||||
commandId="com.raytheon.viz.texteditor.afosproduct">
|
commandId="com.raytheon.viz.texteditor.afosproduct">
|
||||||
</handler>
|
</handler>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="org.eclipse.ui.preferencePages">
|
|
||||||
<page
|
|
||||||
class="com.raytheon.viz.texteditor.TextWorkstationPreferences"
|
|
||||||
id="com.raytheon.viz.texteditor.TextWorkstationPreferences"
|
|
||||||
name="Text Workstation"/>
|
|
||||||
</extension>
|
|
||||||
<extension
|
<extension
|
||||||
point="com.raytheon.uf.viz.localization.perspective.localizationpath">
|
point="com.raytheon.uf.viz.localization.perspective.localizationpath">
|
||||||
<path
|
<path
|
||||||
|
|
|
@ -186,7 +186,6 @@ public final class AfosBrowserModel extends AbstractBrowserModel {
|
||||||
parseAfosMasterPil(
|
parseAfosMasterPil(
|
||||||
pathManager.getLocalizationFile(lc, AFOS_MASTER_PIL));
|
pathManager.getLocalizationFile(lc, AFOS_MASTER_PIL));
|
||||||
}
|
}
|
||||||
addRadarToMasterPil();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,26 +19,12 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.texteditor;
|
package com.raytheon.viz.texteditor;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
|
||||||
import org.eclipse.jface.preference.PreferenceStore;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
|
||||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
|
||||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
|
||||||
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.core.mode.CAVEMode;
|
import com.raytheon.viz.core.mode.CAVEMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,43 +37,26 @@ import com.raytheon.viz.core.mode.CAVEMode;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 11, 2009 mschenke Initial creation
|
* Nov 11, 2009 mschenke Initial creation
|
||||||
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
|
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
|
||||||
|
* Jun 15, 2017 mjames@ucar Remove preferences store, assume localhost.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TextWorkstationConstants {
|
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";
|
private static final String TEXTWORKSTATION_QUEUE = "textWorkstation";
|
||||||
|
|
||||||
public static final String P_TEXTWORKSTATION_ID = "workstationId";
|
public static final String P_TEXTWORKSTATION_ID = "workstationId";
|
||||||
|
|
||||||
private static String host = null;
|
private static String host = "localhost";
|
||||||
|
|
||||||
private static String TEXTWS = System.getenv("TEXTWS");
|
|
||||||
|
|
||||||
public static String getId() {
|
public static String getId() {
|
||||||
IPersistentPreferenceStore store = getPreferenceStore();
|
return host;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,47 +104,6 @@ public class TextWorkstationConstants {
|
||||||
return host;
|
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()
|
public static String getDestinationTextWorkstationQueueName()
|
||||||
throws UnknownHostException {
|
throws UnknownHostException {
|
||||||
StringBuilder queueName = getTextWorkstationQueueNameBuilder();
|
StringBuilder queueName = getTextWorkstationQueueNameBuilder();
|
||||||
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Nov 11, 2009 mschenke Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.
|
* dialog.
|
||||||
*/
|
*/
|
||||||
public void clearButtonology() {
|
public void clearButtonology() {
|
||||||
|
|
|
@ -54,22 +54,5 @@
|
||||||
point="com.raytheon.uf.viz.core.component">
|
point="com.raytheon.uf.viz.core.component">
|
||||||
<component key="textws" class="com.raytheon.viz.textworkstation.TextWorkstationComponent"/>
|
<component key="textws" class="com.raytheon.viz.textworkstation.TextWorkstationComponent"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
|
||||||
point="com.raytheon.uf.viz.localization.perspective.localizationpath">
|
|
||||||
<path
|
|
||||||
application="TextWS"
|
|
||||||
localizationType="CAVE_STATIC"
|
|
||||||
name="Configuration"
|
|
||||||
value="textws/gui"
|
|
||||||
recursive="true">
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
application="TextWS"
|
|
||||||
localizationType="COMMON_STATIC"
|
|
||||||
name="Mixed Case"
|
|
||||||
value="mixedCase"
|
|
||||||
recursive="false">
|
|
||||||
</path>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -38,6 +38,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Import-Package: com.raytheon.uf.common.activetable,
|
Import-Package: com.raytheon.uf.common.activetable,
|
||||||
com.raytheon.uf.common.dataplugin.text.request,
|
com.raytheon.uf.common.dataplugin.text.request,
|
||||||
com.raytheon.viz.radar,
|
com.raytheon.viz.radar,
|
||||||
|
com.raytheon.viz.textworkstation,
|
||||||
com.raytheon.viz.warnings,
|
com.raytheon.viz.warnings,
|
||||||
javax.vecmath,
|
javax.vecmath,
|
||||||
org.eclipse.core.expressions
|
org.eclipse.core.expressions
|
||||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil;
|
||||||
* Sep 13, 2013 2368 rjpeter Set delivery mode to PERSISTENT.
|
* Sep 13, 2013 2368 rjpeter Set delivery mode to PERSISTENT.
|
||||||
* May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging.
|
* May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging.
|
||||||
* Sep 03, 2015 4784 rjpeter Set notifySubscriptions on sendToTextDatabase.
|
* Sep 03, 2015 4784 rjpeter Set notifySubscriptions on sendToTextDatabase.
|
||||||
|
* Jun 15, 2017 ---- mjames@ucar Force practice mode.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mschenke
|
* @author mschenke
|
||||||
|
@ -258,9 +259,7 @@ public class WarningSender implements IWarngenObserver {
|
||||||
*/
|
*/
|
||||||
public static void sendToTextDatabase(String id, String warning)
|
public static void sendToTextDatabase(String id, String warning)
|
||||||
throws VizException {
|
throws VizException {
|
||||||
CAVEMode mode = CAVEMode.getMode();
|
boolean operationalMode = false;
|
||||||
boolean operationalMode = (CAVEMode.OPERATIONAL.equals(mode)
|
|
||||||
|| CAVEMode.TEST.equals(mode) ? true : false);
|
|
||||||
|
|
||||||
// Generate StdTextProduct and insert into db
|
// Generate StdTextProduct and insert into db
|
||||||
long t0 = System.currentTimeMillis();
|
long t0 = System.currentTimeMillis();
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.warngen.gui;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.PlatformUI;
|
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.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
|
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
|
||||||
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
|
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.input.EditableManager;
|
||||||
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
|
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
|
||||||
|
|
||||||
|
@ -47,6 +50,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
|
||||||
* with minor changes.
|
* with minor changes.
|
||||||
* Aug 15, 2013 DR 16418 D. Friedman Always show the dialog.
|
* Aug 15, 2013 DR 16418 D. Friedman Always show the dialog.
|
||||||
* Sep 22, 2015 4859 dgilling Prevent dialog from showing in DRT mode.
|
* Sep 22, 2015 4859 dgilling Prevent dialog from showing in DRT mode.
|
||||||
|
* Jun 15, 2017 ---- mjames@ucar Open TextWorkstation.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -55,6 +59,9 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class WarngenAction extends AbstractGenericToolAction<WarngenLayer> {
|
public class WarngenAction extends AbstractGenericToolAction<WarngenLayer> {
|
||||||
|
|
||||||
|
private static TextWorkstationDlg textWorkstationDlg;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -88,6 +95,21 @@ public class WarngenAction extends AbstractGenericToolAction<WarngenLayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
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()) {
|
if (!SimulatedTimeOperations.isTransmitAllowed()) {
|
||||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||||
.getShell();
|
.getShell();
|
||||||
|
|
Loading…
Add table
Reference in a new issue