Merge branch 'omaha_16.2.2' into field_16.2.2

Change-Id: Iaa9a1a801ee2059f5ffa5473a407ac8a7c1a4200

Former-commit-id: eb7beb890676babbbd203fc1721d48ceb067aba1
This commit is contained in:
Ana Rivera 2016-02-22 20:35:27 +00:00
commit 9b97d8e4c3
1574 changed files with 38512 additions and 100820 deletions

View file

@ -28,56 +28,70 @@ import com.raytheon.rcm.products.ProductInfo.Selector;
import com.raytheon.rcm.products.RadarProduct; import com.raytheon.rcm.products.RadarProduct;
import com.raytheon.rcm.products.RadarProduct.Param; import com.raytheon.rcm.products.RadarProduct.Param;
/**
public class RpsListFormatter { * Used to format a {@link RpsList} before it is written.
/* See AWIPS-1 ProductRequestList::writeList() *
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ? ? ? Initial creation.
* Jan 20, 2016 5271 bkowal Include time span / end hour for products
* that use minutes for the time span.
* </pre>
* *
*/ */
public static void formatAwips1RpsList(RpsList list, String fileName, PrintWriter s) { public class RpsListFormatter {
RadarType radarType = list.getVcp() == 80 || list.getVcp() == 90 ? /*
RadarType.TDWR : RadarType.WSR; * See AWIPS-1 ProductRequestList::writeList()
*/
public static void formatAwips1RpsList(RpsList list, String fileName,
PrintWriter s) {
RadarType radarType = list.getVcp() == 80 || list.getVcp() == 90 ? RadarType.TDWR
: RadarType.WSR;
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
s.format("RPS List %s %s... %d products\n", s.format("RPS List %s %s... %d products\n", fileName != null ? fileName
fileName != null ? fileName : "", : "",
String.format("%1$tY:%1$tm:%1$td:%1$tH:%1$tM:%1$tS", cal), String.format("%1$tY:%1$tm:%1$td:%1$tH:%1$tM:%1$tS", cal), list
list.getRequests().length); .getRequests().length);
s.print(" An RPS list contains the fields: Prod-Name, Mnemonic, Prod-Code\n" + s.print(" An RPS list contains the fields: Prod-Name, Mnemonic, Prod-Code\n"
" Number of Data Levels, Resolution, Layer Code, Elevation, Contour Interval,\n" + + " Number of Data Levels, Resolution, Layer Code, Elevation, Contour Interval,\n"
" Priority, Req Interval, Map, Lower Layer, Upper Layer, multCut, endHour, timeSpan\n" + + " Priority, Req Interval, Map, Lower Layer, Upper Layer, multCut, endHour, timeSpan\n"
" The record format is: '%-39s %-3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d'\n"); + " The record format is: '%-39s %-3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d'\n");
for (Request r : list.getRequests()) { for (Request r : list.getRequests()) {
s.println(formatAwips1Request(r, radarType)); s.println(formatAwips1Request(r, radarType));
} }
} }
private static final char[] layerCodes = {'L', 'M', 'H'}; private static final char[] layerCodes = { 'L', 'M', 'H' };
public static String formatAwips1Request(Request r, RadarType radarType) { public static String formatAwips1Request(Request r, RadarType radarType) {
RadarProduct rp = ProductInfo.getInstance().selectOne( RadarProduct rp = ProductInfo.getInstance().selectOne(
new Selector(radarType, null, (int) r.productCode, null)); new Selector(radarType, null, (int) r.productCode, null));
/* Could probably guess how to format the important parts, but this /*
* is what AWIPS-1 does anyway... * Could probably guess how to format the important parts, but this is
* what AWIPS-1 does anyway...
*/ */
if (rp == null) if (rp == null) {
throw new IllegalArgumentException("Cannot format unknown product type " + throw new IllegalArgumentException(
r.productCode + "."); "Cannot format unknown product type " + r.productCode + ".");
/* Note there is no check for rp.contains(ELEVATION) This
* is fine for the current set of products that are available in
* the RPS list editor...
*/
/* // Mimic:
if (_multCuts == 'Y' && _elev > 16384)
{
_elev -= 16384;
} }
/*
* Note there is no check for rp.contains(ELEVATION) This is fine for
* the current set of products that are available in the RPS list
* editor...
*/
/*
* // Mimic: if (_multCuts == 'Y' && _elev > 16384) { _elev -= 16384; }
*/ */
boolean multiCuts = false; boolean multiCuts = false;
int elev = r.pdw22; int elev = r.pdw22;
if (r.getElevationSelection() == Request.ALL_ELEVATIONS && if (r.getElevationSelection() == Request.ALL_ELEVATIONS
r.getElevationAngle() != 0) { && r.getElevationAngle() != 0) {
elev = r.getElevationAngle(); elev = r.getElevationAngle();
multiCuts = true; multiCuts = true;
} }
@ -100,21 +114,20 @@ public class RpsListFormatter {
} }
int endHour = -1; int endHour = -1;
int timeSpan = -1; int timeSpan = -1;
if (rp.params.contains(Param.TIME_SPAN)) { if (rp.params.contains(Param.TIME_SPAN)
|| rp.params.contains(Param.TIME_SPAN_MINUTES)) {
endHour = r.getEndHour(); endHour = r.getEndHour();
timeSpan = r.getTimeSpan(); timeSpan = r.getTimeSpan();
} }
return String.format("%-39.39s %-3.3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d", return String.format(
rp.name, rp.mnemonic, "%-39.39s %-3.3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d",
r.productCode, rp.name, rp.mnemonic, r.productCode,
rp.levels != null ? rp.levels : 0, rp.levels != null ? rp.levels : 0,
rp.resolution != null ? (int)(rp.resolution * 100) : 0, rp.resolution != null ? (int) (rp.resolution * 100) : 0,
layerCode, elev, -1 /*contour interval*/, layerCode, elev, -1 /* contour interval */, r.highPriority ? 1
r.highPriority ? 1 : 0, r.interval, : 0, r.interval, r.mapRequested ? 'Y' : 'N',
r.mapRequested ? 'Y' : 'N', lowerLayer, upperLayer, multiCuts ? 'Y' : 'N', endHour,
lowerLayer, upperLayer, timeSpan);
multiCuts ? 'Y' : 'N',
endHour, timeSpan);
} }
} }

View file

@ -73,6 +73,7 @@ import com.raytheon.rcm.server.StatusManager.RadarStatus;
* 2014-02-03 DR 14762 D. Friedman Handle updated national RPS lists. * 2014-02-03 DR 14762 D. Friedman Handle updated national RPS lists.
* 2015-06-10 4498 nabowle Rename Util->RcmUtil * 2015-06-10 4498 nabowle Rename Util->RcmUtil
* 2015-09-08 DR 17944 D. Friedman Handle elevation list file updates. * 2015-09-08 DR 17944 D. Friedman Handle elevation list file updates.
* 2016-01-20 5271 bkowal Fix resource leak.
* </pre> * </pre>
* *
*/ */
@ -181,11 +182,13 @@ public class RPSListManager extends RadarEventAdapter {
return "Error getting radar status"; return "Error getting radar status";
} }
int[] cuts = ElevationInfo.getInstance().getScanElevations(radarID, currentVCP); int[] cuts = ElevationInfo.getInstance().getScanElevations(radarID,
currentVCP);
if (cuts == null && RcmUtil.getRadarType(rc) == RadarType.WSR) if (cuts == null && RcmUtil.getRadarType(rc) == RadarType.WSR)
cuts = gsmCuts; cuts = gsmCuts;
if (list.getVcp() != RpsList.UNSPECIFIED_VCP && list.getVcp() != currentVCP) { if (list.getVcp() != RpsList.UNSPECIFIED_VCP
&& list.getVcp() != currentVCP) {
if (store) if (store)
return null; // TODO: Should warn instead. return null; // TODO: Should warn instead.
else else
@ -240,13 +243,13 @@ public class RPSListManager extends RadarEventAdapter {
rpsList = null; rpsList = null;
if (rpsList == null) { if (rpsList == null) {
int[] cuts = ElevationInfo.getInstance(). int[] cuts = ElevationInfo.getInstance().getScanElevations(
getScanElevations(rc.getRadarID(), gsm.vcp); rc.getRadarID(), gsm.vcp);
if (cuts == null && RcmUtil.getRadarType(rc) == RadarType.WSR) if (cuts == null && RcmUtil.getRadarType(rc) == RadarType.WSR)
cuts = gsm.cuts; cuts = gsm.cuts;
rpsList = getMergedRpsListForRadar(rc, gsm.opMode, gsm.vcp, rpsList = getMergedRpsListForRadar(rc, gsm.opMode, gsm.vcp, cuts,
cuts, null); null);
// TODO: Should persist this (wouldn't need clone code) // TODO: Should persist this (wouldn't need clone code)
if (rpsList != null) if (rpsList != null)
@ -279,8 +282,8 @@ public class RPSListManager extends RadarEventAdapter {
return; return;
/* /*
* We want to put these products at the end of the list so that they * We want to put these products at the end of the list so that they do
* do not have priority over existing products. * not have priority over existing products.
*/ */
Selector sel = new Selector(); Selector sel = new Selector();
sel.radarType = RadarType.TDWR; sel.radarType = RadarType.TDWR;
@ -290,8 +293,8 @@ public class RPSListManager extends RadarEventAdapter {
Request r = reqs.get(i); Request r = reqs.get(i);
sel.code = (int) r.productCode; sel.code = (int) r.productCode;
RadarProduct prod = ProductInfo.getInstance().selectOne(sel); RadarProduct prod = ProductInfo.getInstance().selectOne(sel);
if (prod != null && prod.params.contains(Param.MINI_VOLUME) && if (prod != null && prod.params.contains(Param.MINI_VOLUME)
r.getMiniVolume() != 1) { && r.getMiniVolume() != 1) {
Request r2 = r.clone(); Request r2 = r.clone();
r2.setMiniVolume(1); r2.setMiniVolume(1);
reqs.add(r2); reqs.add(r2);
@ -321,14 +324,14 @@ public class RPSListManager extends RadarEventAdapter {
Log.warnf("Cannot determine maximum RPS list size for %s", Log.warnf("Cannot determine maximum RPS list size for %s",
rc.getRadarID()); rc.getRadarID());
if (requestCount < 0) if (requestCount < 0)
Log.warnf("Cannot number of requests in RPS list for %s", rc Log.warnf("Cannot number of requests in RPS list for %s",
.getRadarID()); rc.getRadarID());
if (maxSize >= 0 && requestCount >= 0 && requestCount > maxSize) { if (maxSize >= 0 && requestCount >= 0 && requestCount > maxSize) {
int truncCount = 0; int truncCount = 0;
int i; int i;
for (i = reqs.length - 1; i >= 0; --i) { for (i = reqs.length - 1; i >= 0; --i) {
truncCount += RpsList.getRequestCount(reqs[i], rc.getRadarID(), rpsList.getVcp(), truncCount += RpsList.getRequestCount(reqs[i], rc.getRadarID(),
RcmUtil.getRadarType(rc)); rpsList.getVcp(), RcmUtil.getRadarType(rc));
if (requestCount - truncCount <= maxSize) if (requestCount - truncCount <= maxSize)
break; break;
} }
@ -337,8 +340,10 @@ public class RPSListManager extends RadarEventAdapter {
int originalCount = requestCount; int originalCount = requestCount;
requestCount = requestCount - truncCount; requestCount = requestCount - truncCount;
Log.warnf("Truncated list for %s from %d entries (%d requests) to %d entries (%d requests)", Log.warnf(
rc.getRadarID(), reqs.length, originalCount, i, requestCount); "Truncated list for %s from %d entries (%d requests) to %d entries (%d requests)",
rc.getRadarID(), reqs.length, originalCount, i,
requestCount);
// TODO: Also need to send a message to Guardian // TODO: Also need to send a message to Guardian
reqs = Arrays.copyOf(reqs, i); reqs = Arrays.copyOf(reqs, i);
rpsList = new RpsList(rpsList.getOpMode(), rpsList.getVcp(), reqs); rpsList = new RpsList(rpsList.getOpMode(), rpsList.getVcp(), reqs);
@ -346,8 +351,8 @@ public class RPSListManager extends RadarEventAdapter {
Log.warnf("Sending empty RPS list to %s", rc.getRadarID()); Log.warnf("Sending empty RPS list to %s", rc.getRadarID());
} }
Log.eventf("%s: Sending RPS list with %d entries (%d requests)", rc.getRadarID(), Log.eventf("%s: Sending RPS list with %d entries (%d requests)",
rpsList.getRequests().length, requestCount); rc.getRadarID(), rpsList.getRequests().length, requestCount);
byte[] msg = ProductRequest.encode(rpsList.getRequests()); byte[] msg = ProductRequest.encode(rpsList.getRequests());
radarServer.getConnectionManager().sendMessageToRadar(rc.getRadarID(), radarServer.getConnectionManager().sendMessageToRadar(rc.getRadarID(),
msg); msg);
@ -396,8 +401,7 @@ public class RPSListManager extends RadarEventAdapter {
path = new File(dir, rc.getRadarID().toUpperCase() path = new File(dir, rc.getRadarID().toUpperCase()
+ ".currentVCP"); + ".currentVCP");
fo = new FileOutputStream(path); fo = new FileOutputStream(path);
try { try (PrintWriter p = new PrintWriter(fo)) {
PrintWriter p = new PrintWriter(fo);
p.printf("VCP%d\n", rpsList.getVcp()); p.printf("VCP%d\n", rpsList.getVcp());
p.flush(); p.flush();
} finally { } finally {
@ -487,14 +491,12 @@ public class RPSListManager extends RadarEventAdapter {
maybeAddSPGMiniVolumeProducts(rc, reqs, vcp); maybeAddSPGMiniVolumeProducts(rc, reqs, vcp);
/* /*
* AWIPS 1 disabled duplicate merging for TDWRs because some requests * AWIPS 1 disabled duplicate merging for TDWRs because some requests in
* in the national RPS list would disappear. This was due to incorrect * the national RPS list would disappear. This was due to incorrect
* handling of multi-elevation requests. AWIPS 2 handles * handling of multi-elevation requests. AWIPS 2 handles multi-elevation
* multi-elevation request correctly. (See DCS 3472, DRs 19386, 20239, * request correctly. (See DCS 3472, DRs 19386, 20239, and 20244.)
* and 20244.)
* *
* if (vcp == 80 || vcp == 90) * if (vcp == 80 || vcp == 90) elevList = null;
* elevList = null;
*/ */
RadarType radarType = RcmUtil.getRadarType(rc); RadarType radarType = RcmUtil.getRadarType(rc);
@ -599,8 +601,8 @@ public class RPSListManager extends RadarEventAdapter {
private void resetRpsListForRadar(RadarConfig rc) { private void resetRpsListForRadar(RadarConfig rc) {
String radarID = rc.getRadarID(); String radarID = rc.getRadarID();
RadarStatus status = radarServer.getStatusManager() RadarStatus status = radarServer.getStatusManager().getRadarStatus(
.getRadarStatus(radarID); radarID);
byte[] gsmData = null; byte[] gsmData = null;
if (status != null) if (status != null)
gsmData = status.getCurrentGSM(); gsmData = status.getCurrentGSM();
@ -609,10 +611,8 @@ public class RPSListManager extends RadarEventAdapter {
if (gsmData != null) { if (gsmData != null) {
handleGSM(rc, gsmData); handleGSM(rc, gsmData);
} else { } else {
Log.debugf( Log.debugf("RPS-relevant configuration changed for %s, but "
"RPS-relevant configuration changed for %s, but " + "it is not connected. Cannot send a list now.", radarID);
+ "it is not connected. Cannot send a list now.",
radarID);
} }
} }
} }

View file

@ -21,6 +21,7 @@
<property name="excludes"> <property name="excludes">
<list> <list>
<value>com.raytheon.uf.common.dataplugin.text</value> <value>com.raytheon.uf.common.dataplugin.text</value>
<value>com.raytheon.uf.common.dataplugin.text.subscription</value>
<value>com.raytheon.uf.common.dataplugin.shef</value> <value>com.raytheon.uf.common.dataplugin.shef</value>
<value>com.raytheon.edex.plugin.shef</value> <value>com.raytheon.edex.plugin.shef</value>
<value>com.raytheon.uf.common.bmh</value> <value>com.raytheon.uf.common.bmh</value>

View file

@ -30,6 +30,7 @@ export EDEX_DEBUG_PORT=5012
export EDEX_JMX_PORT=1620 export EDEX_JMX_PORT=1620
export LOG_CONF=logback-registry.xml export LOG_CONF=logback-registry.xml
export MGMT_PORT=9605 export MGMT_PORT=9605
export HTTP_PORT=9588
export METADATA_POOL_MAX=20 export METADATA_POOL_MAX=20
export METADATA_POOL_TIMEOUT=60 export METADATA_POOL_TIMEOUT=60

View file

@ -33,3 +33,4 @@ export EDEX_DEBUG_PORT=5005
export EDEX_JMX_PORT=1616 export EDEX_JMX_PORT=1616
export LOG_CONF=logback-request.xml export LOG_CONF=logback-request.xml
export MGMT_PORT=9601 export MGMT_PORT=9601
export HTTP_PORT=9581

View file

@ -22,14 +22,13 @@
export MAX_MEM=1536 # in Meg export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2048 export MAX_MEM=2560
fi fi
export MAX_PERM_SIZE=192m export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5012 export EDEX_DEBUG_PORT=5013
export EDEX_JMX_PORT=1620 export LOG_CONF=logback-registry.xml
export LOG_CONF=logback-ebxmlRegistry.xml export MGMT_PORT=9606
export MGMT_PORT=9605
export METADATA_POOL_MAX=20 export METADATA_POOL_MAX=20
export METADATA_POOL_TIMEOUT=60 export METADATA_POOL_TIMEOUT=60

View file

@ -30,6 +30,7 @@ import groovy.util.logging.*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 4, 2014 3836 bkowal Initial Commit * Dec 4, 2014 3836 bkowal Initial Commit
* Dec 9, 2015 4216 dhladky Fix multi WA deploys
* *
* </pre> * </pre>
* *
@ -85,22 +86,7 @@ class DeployESB
architecture = architecture =
(System.getProperty("os.arch") == "amd64") ? "x86_64" : "x86" (System.getProperty("os.arch") == "amd64") ? "x86_64" : "x86"
} }
String esbLibIllusionPath = esbDirectory + File.separator + "lib" + File.separator +
"lib_illusion" + File.separator + architecture
if (new File(esbLibIllusionPath).exists() == false)
{
log.log(java.util.logging.Level.SEVERE,
"Unable to find the illusion lib associated with architecture - " + architecture)
System.exit(-1)
}
String libIllusionDestination = edexRootDirectory + File.separator +
"lib" + File.separator + "lib_illusion"
new File(libIllusionDestination).mkdirs()
ant.copy( todir : libIllusionDestination, overwrite : true )
{
fileset( dir : esbLibIllusionPath )
}
} }
public static void deployEdexConfiguration(String edexRootDirectory, String esbDirectory) public static void deployEdexConfiguration(String edexRootDirectory, String esbDirectory)

View file

@ -44,6 +44,7 @@ import IPluginCustomDeployer
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 4, 2014 3836 bkowal Initial Commit * Dec 4, 2014 3836 bkowal Initial Commit
* Dec 9, 2015 4216 dhladky Fix multi WA deploy
* *
* </pre> * </pre>
* *
@ -124,7 +125,7 @@ class DeployInstall
// complete the esb deployment // complete the esb deployment
// we need to determine the location of the build.edex project // we need to determine the location of the build.edex project
ProjectInformation projectInformation = this.projectInformationMap["build.edex"] ProjectInformation projectInformation = this.projectInformationMap["deploy.edex.awips2"]
if (projectInformation == null) if (projectInformation == null)
{ {
log.log(java.util.logging.Level.SEVERE, log.log(java.util.logging.Level.SEVERE,

View file

@ -5,7 +5,7 @@
<property name="build.version" value="1.0.0" /> <property name="build.version" value="1.0.0" />
<property name="build.os" value="linux" /> <property name="build.os" value="linux" />
<property name="build.ws" value="gtk" /> <property name="build.ws" value="gtk" />
<property name="build.arch" value="x86" /> <property name="build.arch" value="x86_64" />
<property name="workspace.dir" value="${basedir}/../" /> <property name="workspace.dir" value="${basedir}/../" />
<property name="pde.build.script" value="org.eclipse.pde.build_3.8.2.v20121114-140810/scripts/build.xml" /> <property name="pde.build.script" value="org.eclipse.pde.build_3.8.2.v20121114-140810/scripts/build.xml" />

View file

@ -0,0 +1,129 @@
@echo OFF
REM This is a MSFT Windows version of the CAVE capture script.
REM This script will identify any running CAVE processes (cave.exe)
REM and use Java to generate jstacks and (optionally) heap dumps
REM for the process(es). All of the files generated by this capture
REM script and any associated CAVE logs will be placed in a directory
REM in the user's 'My Documents' directory.
REM Usage: capture.bat [-d][-h]
REM Verify that the location of the Java JDK is known.
IF "%JAVA_JDK%" == "" (
echo ERROR: Unable to determine the location of the Java JDK. Use the JAVA_JDK Env Variable to set the location.
GOTO EOF
)
SET heap_dump=0
REM Process and validate any command line parameters, displaying usage
REM information if necessary.
IF "%1" == "" GOTO run
REM Verify that there is only one argument.
IF NOT "%2" == "" GOTO usage
REM Check for the -d argument.
IF "%1" == "-d" (
SET heap_dump=1
GOTO run
)
REM Either an invalid argument or the -h argument.
GOTO usage
:usage
echo Usage: %0 [-d][-h]
echo -d: Enables the heap dump capture
echo -h: Displays the usage message
GOTO EOF
:run
SET jstack_iterations=15
SET PROCESS=cave.exe
REM Prepare Environment
SET Path=%JAVA_JDK%\bin;%Path%
REM Build a date/time string to use in the name for the capture directory.
SET RND=%random%
SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
REM Python is used to retrieve the current date and time because the order
REM of the Windows date/time fields is not necessarily guaranteed and the
REM Windows date/time fields can only be extracted using substring operations
REM instead of -formatter- strings like Linux allows.
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
SET /p CAPTURE_DATETIME= < %RND_DATETIME_FILE%
DEL %RND_DATETIME_FILE%
SET CAPTURE_DIRECTORY=%userprofile%\capture_%CAPTURE_DATETIME%
SET CAVEDATA_LOGS_DIRECTORY=%userprofile%\%logdir%
SET CAPTURE_LOG=%CAPTURE_DIRECTORY%\capture_info.log
REM Get the PID of any currently running CAVE process.
for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq %PROCESS%" /fo csv') do call :process_pid %%~F
GOTO prepare_exit
:process_pid
IF NOT EXIST "%CAPTURE_DIRECTORY%" (MKDIR "%CAPTURE_DIRECTORY%")
SET process_pid=%1
SET jstack_counter=0
echo Found %PROCESS% with pid %process_pid% ...
echo Found %PROCESS% with pid %process_pid% ... >> %CAPTURE_LOG%
:while_jstack
if %jstack_counter% lss %jstack_iterations% (
set /a jstack_counter+=1
echo Completing jstack iteration %jstack_counter% ...
echo Completing jstack iteration %jstack_counter% ... >> %CAPTURE_LOG%
SET jstack_log=%CAPTURE_DIRECTORY%\pid_%process_pid%_jstack_%jstack_counter%.log
jstack -l %process_pid% >> "%jstack_log%"
echo Running command: jstack -l %process_pid% >> %CAPTURE_LOG%
IF ERRORLEVEL 1 (
echo jstack for pid %process_pid% failed to connect, rerunning with -F >> %CAPTURE_LOG%
echo jstack for pid %process_pid% failed to connect, rerunning with -F
echo Running command: jstack -l -F %process_pid% >> %CAPTURE_LOG%
jstack -l -F %process_pid% >> "%jstack_log%"
)
goto :while_jstack
)
REM Copy the CAVE logs for the pid to the capture directory.
echo Running command: xcopy "%CAVEDATA_LOGS_DIRECTORY%\*pid_%process_pid%*.log" "%CAPTURE_DIRECTORY%" >> %CAPTURE_LOG%
xcopy "%CAVEDATA_LOGS_DIRECTORY%\*pid_%process_pid%*.log" "%CAPTURE_DIRECTORY%" >> %CAPTURE_LOG%
IF ERRORLEVEL 0 GOTO check_heap
echo Failed to copy the CAVE logs files.
echo Failed to copy the CAVE logs files. >> %CAPTURE_LOG%
:check_heap
REM Create a heap dump if the option has been enabled.
IF %heap_dump% NEQ 1 (
echo Heap dumps have been disabled. >> %CAPTURE_LOG%
exit /b
)
SET heap_path=%CAPTURE_DIRECTORY%\pid_%process_pid%_heap.hprof
SET dump_path=%CAPTURE_DIRECTORY%\pid_%process_pid%_dump.txt
echo Running command: jmap -heap %process_pid% >> %CAPTURE_LOG%
jmap -heap %process_pid% > %heap_path%
echo Running command: jmap -dump:live,format=b,file=%dump_path% %process_pid% >> %CAPTURE_LOG%
jmap -dump:live,format=b,file=%dump_path% %process_pid%
IF ERRORLEVEL 1 (
echo jmap for pid %process_pid% failed to connect, rerunning with -F >> %CAPTURE_LOG%
echo jmap for pid %process_pid% failed to connect, rerunning with -F
echo Running command: jmap -dump:live,format=b,file=%dump_path% -F %process_pid% >> %CAPTURE_LOG%
jmap -dump:live,format=b,file=%dump_path% -F %process_pid%
)
REM end of process_pid sub-routine
exit /b
:prepare_exit
IF NOT EXIST %CAPTURE_DIRECTORY% (GOTO EOF)
echo Capture data is available in %CAPTURE_DIRECTORY% ...
start "" "%CAPTURE_DIRECTORY%"
PAUSE
:EOF

View file

@ -63,6 +63,7 @@ import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 15, 2013 bsteffen Initial creation * Aug 15, 2013 bsteffen Initial creation
* Jul 23, 2014 3410 bclement preparePointInfo() calls unpackResultLocation() * Jul 23, 2014 3410 bclement preparePointInfo() calls unpackResultLocation()
* Dec 17, 2015 5215 dgilling Set point name to stationId.
* *
* </pre> * </pre>
* *
@ -78,21 +79,27 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
private static final String LATITUDE = "location.latitude"; private static final String LATITUDE = "location.latitude";
private static final String STATION_ID = "location.stationId";
public AcarsSndNSharpResourceData() { public AcarsSndNSharpResourceData() {
super("MDCRS"); super("MDCRS");
} }
@Override @Override
protected void preparePointInfo() throws VizException { protected void preparePointInfo() throws VizException {
if (coordinate == null) { if ((coordinate == null) || (pointName == null)) {
DbQueryRequest request = new DbQueryRequest(); DbQueryRequest request = new DbQueryRequest();
request.setConstraints(getMetadataMap()); request.setConstraints(getMetadataMap());
request.addFields(new String[] { LONGITUDE, LATITUDE }); request.addFields(new String[] { STATION_ID, LONGITUDE, LATITUDE });
request.setDistinct(true); request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request); .sendRequest(request);
for (Map<String, Object> result : response.getResults()) { for (Map<String, Object> result : response.getResults()) {
if (pointName == null) {
pointName = (String) result.get(STATION_ID);
}
if (coordinate == null) { if (coordinate == null) {
coordinate = unpackResultLocation(result, LONGITUDE, coordinate = unpackResultLocation(result, LONGITUDE,
LATITUDE); LATITUDE);
@ -111,7 +118,8 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
request.addConstraint("dataTime", new RequestConstraint(new DataTime( request.addConstraint("dataTime", new RequestConstraint(new DataTime(
stnInfo.getReftime()).toString())); stnInfo.getReftime()).toString()));
try { try {
DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request); DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
ACARSSoundingRecord[] records = response ACARSSoundingRecord[] records = response
.getEntityObjects(ACARSSoundingRecord.class); .getEntityObjects(ACARSSoundingRecord.class);
if (records.length > 0) { if (records.length > 0) {
@ -127,7 +135,8 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
builder.addTemperature(layer.getTemp(), SI.KELVIN); builder.addTemperature(layer.getTemp(), SI.KELVIN);
} }
if (layer.getWindDirection() != null) { if (layer.getWindDirection() != null) {
builder.addWindDirection(layer.getWindDirection(), NonSI.DEGREE_ANGLE); builder.addWindDirection(layer.getWindDirection(),
NonSI.DEGREE_ANGLE);
} }
if (layer.getWindSpeed() != null) { if (layer.getWindSpeed() != null) {
builder.addWindSpeed(layer.getWindSpeed(), builder.addWindSpeed(layer.getWindSpeed(),

View file

@ -42,7 +42,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
@ -101,6 +100,10 @@ import com.raytheon.uf.viz.alertviz.ui.audio.IAudioAction;
* 31 May 2011 8058 cjeanbap Kill sound based on TextMsgBox id. * 31 May 2011 8058 cjeanbap Kill sound based on TextMsgBox id.
* 26 Aug 2013 #2293 lvenable Fixed color memory leaks. * 26 Aug 2013 #2293 lvenable Fixed color memory leaks.
* 02 Jun 2015 4473 mschenke Remember dialog position * 02 Jun 2015 4473 mschenke Remember dialog position
* 28 Oct 2015 5054 randerso Fix lots of multimonitor display issues.
* 14 Jan 2016 5054 randerso Fix the Tips window to display on the correct monitor
* Removed duplicate parent shell
* 25 Jan 2016 5054 randerso Converted to stand alone window
* *
* </pre> * </pre>
* *
@ -119,11 +122,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
private static final ScopedPreferenceStore dialogPrefs = new ScopedPreferenceStore( private static final ScopedPreferenceStore dialogPrefs = new ScopedPreferenceStore(
InstanceScope.INSTANCE, Activator.PLUGIN_ID); InstanceScope.INSTANCE, Activator.PLUGIN_ID);
/**
* Parent shell.
*/
private final Shell parentShell;
/** /**
* Local shell. * Local shell.
*/ */
@ -150,9 +148,9 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
private Label resizeLabel; private Label resizeLabel;
/** /**
* Location of the dialog on the screen. * Mouse down location
*/ */
private Point origin; private Point mouseDownPt;
/** /**
* Show dialog flag. * Show dialog flag.
@ -169,26 +167,11 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
*/ */
private boolean resizeDialog = false; private boolean resizeDialog = false;
/**
* Dialog location.
*/
private Point dialogLoc;
/** /**
* ArrayList of TextMsgControlComp objects. * ArrayList of TextMsgControlComp objects.
*/ */
private ArrayList<TextMsgControlComp> txtMsgCompArray; private ArrayList<TextMsgControlComp> txtMsgCompArray;
/**
* Starting X position.
*/
private int startXpos = -1;
/**
* Screen width.
*/
private int screenWidth = 0;
/** /**
* Text composite. * Text composite.
*/ */
@ -247,20 +230,21 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
/** /**
* Constructor. * Constructor.
* *
* @param parentShell * @param display
* Parent shell. * Parent display.
* @param audioCB * @param audioCB
* Audio callback. * Audio callback.
* @param showDialog * @param showDialog
* Show dialog flag. * Show dialog flag.
* @param configData * @param configData
* Configuration data. * Configuration data.
* @param alertAudioMgr
*/ */
public AlertMessageDlg(Shell parentShell, IAudioAction audioCB, public AlertMessageDlg(Display display, IAudioAction audioCB,
boolean showDialog, Configuration configData, boolean showDialog, Configuration configData,
AlertAudioMgr alertAudioMgr) { AlertAudioMgr alertAudioMgr) {
this.display = display;
this.showDialog = showDialog; this.showDialog = showDialog;
this.parentShell = parentShell;
this.alertAudioMgr = alertAudioMgr; this.alertAudioMgr = alertAudioMgr;
this.audioCB = audioCB; this.audioCB = audioCB;
@ -273,17 +257,21 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
} }
} }
/**
* @return the shell
*/
public Shell getShell() {
return shell;
}
/** /**
* Open method used to display the dialog. * Open method used to display the dialog.
* *
* @return True/False. * @return True/False.
*/ */
public Object open() { public Object open() {
display = parentShell.getDisplay(); shell = new Shell(display, SWT.ON_TOP | SWT.NO_TRIM);
shell.setBounds(restoreDialogPosition());
Shell shell1 = new Shell(parentShell, SWT.NO_TRIM);
shell = new Shell(shell1, SWT.ON_TOP);
shell.setLocation(getDialogPosition());
shell.addDisposeListener(new DisposeListener() { shell.addDisposeListener(new DisposeListener() {
@Override @Override
@ -306,6 +294,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
shell.pack(); shell.pack();
shell.open(); shell.open();
// force bar location to be within the display.
Point shellLoc = shell.getLocation(); Point shellLoc = shell.getLocation();
Point shellSize = shell.getSize(); Point shellSize = shell.getSize();
Display d = shell.getDisplay(); Display d = shell.getDisplay();
@ -333,11 +322,18 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
return returnValue; return returnValue;
} }
/**
* @return true if dialog is disposed
*/
public boolean isDisposed() {
return (shell == null) || shell.isDisposed();
}
/** /**
* Dispose of all the message timers. * Dispose of all the message timers.
*/ */
public void dispose() { public void dispose() {
setDialogPosition(dialogLoc); saveDialogPosition(shell.getBounds());
// Stop all of the message timers. // Stop all of the message timers.
for (int i = 0; i < txtMsgCompArray.size(); i++) { for (int i = 0; i < txtMsgCompArray.size(); i++) {
@ -356,6 +352,10 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
monitor.dispose(); monitor.dispose();
} }
if (shell != null) {
shell.dispose();
}
ConfigurationManager.getInstance().getCustomLocalization() ConfigurationManager.getInstance().getCustomLocalization()
.removeFileUpdatedObserver(this); .removeFileUpdatedObserver(this);
@ -374,8 +374,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
* Initialize the components on the display. * Initialize the components on the display.
*/ */
private void initializeComponents() { private void initializeComponents() {
screenWidth = display.getPrimaryMonitor().getBounds().width;
TrayConfiguration.TrayMode tm = configData.getGlobalConfiguration() TrayConfiguration.TrayMode tm = configData.getGlobalConfiguration()
.getMode(); .getMode();
boolean monitorOnly = (TrayConfiguration.TrayMode.MO.equals(tm) ? true boolean monitorOnly = (TrayConfiguration.TrayMode.MO.equals(tm) ? true
@ -402,9 +400,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
mainComp.setLayout(gl); mainComp.setLayout(gl);
mainComp.setLayoutData(gd); mainComp.setLayoutData(gd);
dialogLoc = shell.getLocation();
origin = dialogLoc;
moveLabel = new Label(mainComp, SWT.NONE); moveLabel = new Label(mainComp, SWT.NONE);
moveLabel.setImage(new Image(display, loadHandleImage())); moveLabel.setImage(new Image(display, loadHandleImage()));
moveLabel.setToolTipText("Move"); moveLabel.setToolTipText("Move");
@ -531,8 +526,8 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
} }
public void setMaxLogSize(final int maxLogSize) { public void setMaxLogSize(final int maxLogSize) {
if (txtMsgCompArray != null && txtMsgCompArray.size() > 0 if ((txtMsgCompArray != null) && (txtMsgCompArray.size() > 0)
&& maxLogSize != txtMsgCompArray.get(0).getMaxLogSize()) { && (maxLogSize != txtMsgCompArray.get(0).getMaxLogSize())) {
for (TextMsgControlComp comp : txtMsgCompArray) { for (TextMsgControlComp comp : txtMsgCompArray) {
comp.setMaxLogSize(maxLogSize); comp.setMaxLogSize(maxLogSize);
} }
@ -547,34 +542,27 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
*/ */
@Override @Override
public void mouseMove(MouseEvent e) { public void mouseMove(MouseEvent e) {
if (mouseDownPt != null) {
if ((Label) e.getSource() == moveLabel) { if ((Label) e.getSource() == moveLabel) {
if (origin != null && moveDialog == true) { if (moveDialog == true) {
dialogLoc = display.map(shell, null, e.x, e.y); Point dialogLoc = shell.getLocation();
shell.setLocation(dialogLoc.x - origin.x, dialogLoc.y dialogLoc.x = dialogLoc.x + (e.x - mouseDownPt.x);
- origin.y); dialogLoc.y = dialogLoc.y + (e.y - mouseDownPt.y);
shell.setLocation(dialogLoc);
} }
} else if ((Label) e.getSource() == resizeLabel) { } else if ((Label) e.getSource() == resizeLabel) {
if (resizeDialog == true) { if (resizeDialog == true) {
int newWidth = e.x - startXpos + shell.getSize().x; int newWidth = shell.getSize().x + (e.x - mouseDownPt.x);
if (newWidth < 300) { if (newWidth < 300) {
return; return;
} }
int shellLocationXCoord = shell.getLocation().x;
if (shellLocationXCoord > screenWidth) {
shellLocationXCoord = shellLocationXCoord - screenWidth;
}
if (newWidth >= (screenWidth - shellLocationXCoord)) {
return;
}
shell.setSize(newWidth, shell.getSize().y); shell.setSize(newWidth, shell.getSize().y);
} }
} }
} }
}
/** /**
* Mouse down event. * Mouse down event.
@ -585,13 +573,12 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
@Override @Override
public void mouseDown(MouseEvent e) { public void mouseDown(MouseEvent e) {
if (e.button != SWT.BUTTON3) { if (e.button != SWT.BUTTON3) {
origin = new Point(e.x, e.y); mouseDownPt = new Point(e.x, e.y);
if ((Label) e.getSource() == moveLabel) { if ((Label) e.getSource() == moveLabel) {
moveDialog = true; moveDialog = true;
} else if ((Label) e.getSource() == resizeLabel) { } else if ((Label) e.getSource() == resizeLabel) {
resizeDialog = true; resizeDialog = true;
startXpos = e.x;
} }
} }
} }
@ -605,14 +592,12 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
@Override @Override
public void mouseUp(MouseEvent e) { public void mouseUp(MouseEvent e) {
if (e.button != SWT.BUTTON3) { if (e.button != SWT.BUTTON3) {
mouseDownPt = null;
if ((Label) e.getSource() == moveLabel) { if ((Label) e.getSource() == moveLabel) {
moveDialog = false; moveDialog = false;
configData.getGlobalConfiguration().setPosition(
shell.getBounds());
} else if ((Label) e.getSource() == resizeLabel) { } else if ((Label) e.getSource() == resizeLabel) {
resizeDialog = false; resizeDialog = false;
startXpos = -1;
} }
} }
} }
@ -637,10 +622,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
public void showDialog(boolean showDialogFlag) { public void showDialog(boolean showDialogFlag) {
showDialog = showDialogFlag; showDialog = showDialogFlag;
// if (showDialog == true) {
// shell.setLocation(dialogLoc.x - origin.x, dialogLoc.y - origin.y);
// }
shell.setVisible(showDialog); shell.setVisible(showDialog);
} }
@ -661,7 +642,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
} }
public void resetTabControl() { public void resetTabControl() {
boolean isOpen = tabControlDlg != null && !tabControlDlg.isDisposed() boolean isOpen = (tabControlDlg != null) && !tabControlDlg.isDisposed()
&& tabControlDlg.isOpened(); && tabControlDlg.isOpened();
reLayout(); reLayout();
// TODO: Need to determine which tabs to open and populate them. // TODO: Need to determine which tabs to open and populate them.
@ -689,7 +670,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
RGB[] prevForeground = new RGB[size]; RGB[] prevForeground = new RGB[size];
dispose(); dispose();
for (int i = 0; i < txtMsgCompArray.size(); i++) { for (int i = 0; i < txtMsgCompArray.size(); i++) {
if (txtMsgCompArray.get(i) != null if ((txtMsgCompArray.get(i) != null)
&& !txtMsgCompArray.get(i).isDisposed()) { && !txtMsgCompArray.get(i).isDisposed()) {
prevMessageText[i] = txtMsgCompArray.get(i) prevMessageText[i] = txtMsgCompArray.get(i)
.getMessageText(); .getMessageText();
@ -707,15 +688,16 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
open(); open();
result = true; result = true;
for (int i = 0; i < txtMsgCompArray.size(); i++) { for (int i = 0; i < txtMsgCompArray.size(); i++) {
if (i < prevMessageText.length && prevMessageText[i] != null) { if ((i < prevMessageText.length)
&& (prevMessageText[i] != null)) {
txtMsgCompArray.get(i).setMessageText(prevMessageText[i]); txtMsgCompArray.get(i).setMessageText(prevMessageText[i]);
if (prevBackground[i] != null && prevForeground[i] != null) { if ((prevBackground[i] != null)
&& (prevForeground[i] != null)) {
txtMsgCompArray.get(i).setMessageTextBackAndForeground( txtMsgCompArray.get(i).setMessageTextBackAndForeground(
prevBackground[i], prevForeground[i]); prevBackground[i], prevForeground[i]);
} }
} }
} }
setDialogLocation();
shell.update(); shell.update();
alertAudioMgr = null; alertAudioMgr = null;
alertAudioMgr = new AlertAudioMgr(display, alertAudioMgr = new AlertAudioMgr(display,
@ -982,13 +964,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
this.configData = configData; this.configData = configData;
} }
/**
* Save the dialog location information.
*/
public void saveDialogBounds() {
configData.getGlobalConfiguration().setPosition(shell.getBounds());
}
/** /**
* Is the message dlg enabled * Is the message dlg enabled
* *
@ -1012,24 +987,23 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
return; return;
} }
Shell shell = new Shell(); infoTextShell = new Shell(this.shell.getDisplay());
shell.addDisposeListener(new DisposeListener() { infoTextShell.addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
infoTextShell = null; infoTextShell = null;
} }
}); });
infoTextShell = shell; infoTextShell.setMinimumSize(300, 200);
infoTextShell.setLayout(new GridLayout());
shell.setLayout(new FillLayout()); infoTextShell.setText(" AlertViz Tips! ");
shell.setSize(800, 900);
shell.setText(" AlertViz Tips! ");
// create the styled text widget // create the styled text widget
StyledText widget = new StyledText(shell, SWT.MULTI | SWT.WRAP StyledText widget = new StyledText(infoTextShell, SWT.MULTI
| SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
widget.setLayoutData(layoutData);
widget.setText("----------------------------------------------\n" widget.setText("----------------------------------------------\n"
+ " Here are some basic tips on how to use the AlertViz Main GUI: \n\n" + " Here are some basic tips on how to use the AlertViz Main GUI: \n\n"
@ -1069,7 +1043,26 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
+ "5 - Perhaps not even important enough for a notice of any kind. Informational. \n\n" + "5 - Perhaps not even important enough for a notice of any kind. Informational. \n\n"
+ "------------------------------------------------------------\n\n"); + "------------------------------------------------------------\n\n");
shell.open(); infoTextShell.layout();
infoTextShell.pack();
Rectangle b = this.shell.getBounds();
Monitor m = this.shell.getMonitor();
// attempt to position tips window above or below alertviz bar
// if tips window would be partially off screen it will be forced on
// screen by eclipse/window manager
if (b.y < (m.getBounds().height - (b.y + b.height))) {
// space below alertviz bar > than space above so position below
infoTextShell.setLocation(b.x, b.y + b.height);
} else {
// space above alertviz bar > than space below so position above
infoTextShell.setLocation(b.x, b.y
- infoTextShell.getBounds().height);
}
infoTextShell.open();
} }
/** /**
@ -1114,13 +1107,13 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
errorBtnBgColor = new Color(display, 237, 233, 227); errorBtnBgColor = new Color(display, 237, 233, 227);
errorBtn.setBackground(errorBtnBgColor); errorBtn.setBackground(errorBtnBgColor);
if (tabControlDlg == null || tabControlDlg.isDisposed()) { if ((tabControlDlg == null) || tabControlDlg.isDisposed()) {
tabControlDlg = TabControlDlg.getInstance(shell); tabControlDlg = TabControlDlg.getInstance(shell);
} }
if (textMsgLog == null) { if (textMsgLog == null) {
String[] categories = new String[] { "Causes", "Catch", "Error", String[] categories = new String[] { "Causes", "Catch", "Error",
"Exception" }; "Exception" };
textMsgLog = new TextMsgLog(parentShell, categories, 0, messageVec); textMsgLog = new TextMsgLog(shell, categories, 0, messageVec);
textMsgLog.setIndex(0); textMsgLog.setIndex(0);
} }
if (opened) { if (opened) {
@ -1146,7 +1139,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
if (textMsgLog == null) { if (textMsgLog == null) {
String[] categories = new String[] { "Causes", "Catch", "Error", String[] categories = new String[] { "Causes", "Catch", "Error",
"Exception" }; "Exception" };
textMsgLog = new TextMsgLog(parentShell, categories, 0, messageVec); textMsgLog = new TextMsgLog(shell, categories, 0, messageVec);
textMsgLog.setIndex(0); textMsgLog.setIndex(0);
} }
textMsgLog.addMessage(statMsg); textMsgLog.addMessage(statMsg);
@ -1173,14 +1166,14 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
for (Source source : sourceMap.values()) { for (Source source : sourceMap.values()) {
String name = source.getName(); String name = source.getName();
if (source.isMonitor() && name != null) { if (source.isMonitor() && (name != null)) {
String imageFile = source.getConfigurationMonitor() String imageFile = source.getConfigurationMonitor()
.getMonitorMetadata().getImageFile(); .getMonitorMetadata().getImageFile();
boolean omitMonitor = source.getConfigurationMonitor() boolean omitMonitor = source.getConfigurationMonitor()
.getMonitorMetadata().getOmit(); .getMonitorMetadata().getOmit();
AlertMonitor monitor = alertMonitors.get(name); AlertMonitor monitor = alertMonitors.get(name);
if (imageFile != null if ((imageFile != null)
&& (!imageFile.equals("null") && !imageFile.equals(""))) { && (!imageFile.equals("null") && !imageFile.equals(""))) {
if (monitor != null) { if (monitor != null) {
monitor.setImageName(imageFile); monitor.setImageName(imageFile);
@ -1227,42 +1220,23 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
return map; return map;
} }
public Rectangle getCurrentLocation() {
Rectangle position = new Rectangle(dialogLoc.x, dialogLoc.y,
parentShell.getBounds().width, parentShell.getBounds().height);
return position;
}
private void setDialogLocation() {
// get any monitors height; should be in an utility class also used in
// TabControlDlg.
Monitor any = (display.getMonitors())[0];
Rectangle monSize = any.getBounds();
int monY = monSize.height;
Rectangle rect = shell.getBounds();
if (shell.getBounds().y < 0) {
shell.setLocation(rect.x, rect.y + 100);
}
if (shell.getBounds().y > (monY - 100)) {
shell.setLocation(rect.x, rect.y - 100);
}
}
public AlertAudioMgr getAlertAudioManager() { public AlertAudioMgr getAlertAudioManager() {
return alertAudioMgr; return alertAudioMgr;
} }
public static Point getDialogPosition() { public static Rectangle restoreDialogPosition() {
return new Point(dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".x"), return new Rectangle(
dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".y")); dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".x"),
dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".y"),
dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".width"),
dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".height"));
} }
public static void setDialogPosition(Point p) { public static void saveDialogPosition(Rectangle r) {
dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".x", p.x); dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".x", r.x);
dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".y", p.y); dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".y", r.y);
dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".width", r.width);
dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".height", r.height);
try { try {
dialogPrefs.save(); dialogPrefs.save();
} catch (IOException e) { } catch (IOException e) {

View file

@ -42,7 +42,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.List;
@ -71,6 +70,8 @@ import com.raytheon.uf.viz.alertviz.config.AlertMetadata;
* acknowledgeLastMessage(). * acknowledgeLastMessage().
* 20 Apr 2015 4311 lvenable Fixed text field to accept really long text strings. * 20 Apr 2015 4311 lvenable Fixed text field to accept really long text strings.
* 29 Jun 2015 4311 randerso Reworking AlertViz dialogs to be resizable. * 29 Jun 2015 4311 randerso Reworking AlertViz dialogs to be resizable.
* 25 Jan 2016 5054 randerso Converted to stand alone window
* 08 Feb 2016 5312 randerso Deleted isDisposed() added isOpen()
* *
* </pre> * </pre>
* *
@ -78,8 +79,8 @@ import com.raytheon.uf.viz.alertviz.config.AlertMetadata;
* @version 1.0 * @version 1.0
* *
*/ */
public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener, public class AlertPopupMessageDlg implements MouseMoveListener, MouseListener,
MouseListener, DisposeListener { DisposeListener {
private static final int MAX_INITIAL_LINES = 5; private static final int MAX_INITIAL_LINES = 5;
private static final int WIDTH_IN_CHARS = 135; private static final int WIDTH_IN_CHARS = 135;
@ -282,8 +283,7 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
/** /**
* Constructor. * Constructor.
* *
* @param parent * @param display
* Parent shell.
* @param statMsg * @param statMsg
* Status message. * Status message.
* @param expanded * @param expanded
@ -293,9 +293,9 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
* @param startUpRGB * @param startUpRGB
* Color to be displayed at startup. * Color to be displayed at startup.
*/ */
public AlertPopupMessageDlg(Shell parent, StatusMessage statMsg, public AlertPopupMessageDlg(Display display, StatusMessage statMsg,
boolean expanded, Listener listener, RGB startUpRGB) { boolean expanded, Listener listener, RGB startUpRGB) {
super(parent, 0); this.display = display;
eventListener = listener; eventListener = listener;
statMsgArray.add(statMsg); statMsgArray.add(statMsg);
this.expanded = expanded; this.expanded = expanded;
@ -308,10 +308,7 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
* Initialize the shell * Initialize the shell
*/ */
private void initShell(RGB startUp) { private void initShell(RGB startUp) {
Shell parent = getParent(); shell = new Shell(display, SWT.ON_TOP | SWT.RESIZE);
display = parent.getDisplay();
shell = new Shell(parent, SWT.ON_TOP | SWT.RESIZE);
shell.setText("Alert Visualization Popup Message Dialog"); shell.setText("Alert Visualization Popup Message Dialog");
shell.addDisposeListener(this); shell.addDisposeListener(this);
@ -1066,12 +1063,12 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
} }
/** /**
* Returns if dialog is disposed. * Returns true if dialog is open
* *
* @return True if disposed, false if not. * @return True if open, false if not.
*/ */
public boolean isDisposed() { public boolean isOpen() {
return shell.isDisposed(); return (shell != null) && !shell.isDisposed() && shell.isVisible();
} }
} }

View file

@ -38,7 +38,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
@ -100,6 +99,8 @@ import com.raytheon.uf.viz.alertviz.ui.dialogs.ConfigurationFileDlg.Function;
* 07 Feb 2013 15490 Xiaochuan Past this object to LayoutControlsComp. * 07 Feb 2013 15490 Xiaochuan Past this object to LayoutControlsComp.
* 26 Aug 2013 #2293 lvenable Fixed color memory leak and cleaned up some code. * 26 Aug 2013 #2293 lvenable Fixed color memory leak and cleaned up some code.
* 23 Oct 2013 2303 bgonzale Old patch to fix tool tip layout. * 23 Oct 2013 2303 bgonzale Old patch to fix tool tip layout.
* 28 Oct 2005 5054 randerso Removed bar position as it was written but never read
* 25 Jan 2016 5054 randerso Converted to stand alone window
* *
* </pre> * </pre>
* *
@ -107,8 +108,8 @@ import com.raytheon.uf.viz.alertviz.ui.dialogs.ConfigurationFileDlg.Function;
* @version 1.0 * @version 1.0
* *
*/ */
public class AlertVisConfigDlg extends Dialog implements public class AlertVisConfigDlg implements IConfigurationChangedListener,
IConfigurationChangedListener, INeedsSaveListener { INeedsSaveListener {
private final String CONFIG_LABEL = "Current Config: "; private final String CONFIG_LABEL = "Current Config: ";
@ -264,16 +265,16 @@ public class AlertVisConfigDlg extends Dialog implements
/** /**
* Constructor. * Constructor.
* *
* @param parent * @param display
* Parent shell.
* @param configData * @param configData
* Configuration data. * Configuration data.
*/ */
public AlertVisConfigDlg(Shell parent, final AlertMessageDlg alertMsgDlg, public AlertVisConfigDlg(Display display,
Configuration configData, ConfigContext configContext, final AlertMessageDlg alertMsgDlg, Configuration configData,
ConfigContext configContext,
IConfigurationChangedListener configurationChangeListener, IConfigurationChangedListener configurationChangeListener,
IRestartListener restartListener) { IRestartListener restartListener) {
super(parent, 0); this.display = display;
this.configData = configData; this.configData = configData;
this.configContext = configContext; this.configContext = configContext;
sourceMap = configData.getSources(); sourceMap = configData.getSources();
@ -306,8 +307,6 @@ public class AlertVisConfigDlg extends Dialog implements
* @return True/False. * @return True/False.
*/ */
public Object open() { public Object open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(display, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE shell = new Shell(display, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE
| SWT.MAX); | SWT.MAX);
shell.setText("Alert Visualization Configuration"); shell.setText("Alert Visualization Configuration");
@ -396,6 +395,7 @@ public class AlertVisConfigDlg extends Dialog implements
layoutControls = new LayoutControlsComp(layoutGroup, configData, this, layoutControls = new LayoutControlsComp(layoutGroup, configData, this,
this); this);
layoutGroup.addMouseTrackListener(new MouseTrackAdapter() { layoutGroup.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseHover(MouseEvent e) { public void mouseHover(MouseEvent e) {
mttLayout.open(); mttLayout.open();
} }
@ -418,6 +418,7 @@ public class AlertVisConfigDlg extends Dialog implements
mttCommonSetting = new MonitorToolTip(commonSettingsGroup, true); mttCommonSetting = new MonitorToolTip(commonSettingsGroup, true);
commonSettingsGroup.addMouseTrackListener(new MouseTrackAdapter() { commonSettingsGroup.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseHover(MouseEvent e) { public void mouseHover(MouseEvent e) {
mttCommonSetting.open(); mttCommonSetting.open();
} }
@ -632,6 +633,7 @@ public class AlertVisConfigDlg extends Dialog implements
mttSource = new MonitorToolTip(sourcesLbl, false); mttSource = new MonitorToolTip(sourcesLbl, false);
sourcesLbl.addMouseTrackListener(new MouseTrackAdapter() { sourcesLbl.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseHover(MouseEvent e) { public void mouseHover(MouseEvent e) {
mttSource.open(); mttSource.open();
} }
@ -686,6 +688,7 @@ public class AlertVisConfigDlg extends Dialog implements
sourcesList.setMenu(popupMenuSourceList); sourcesList.setMenu(popupMenuSourceList);
popupMenuSourceList.addListener(SWT.Show, new Listener() { popupMenuSourceList.addListener(SWT.Show, new Listener() {
@Override
public void handleEvent(Event event) { public void handleEvent(Event event) {
MenuItem[] menuItems = popupMenuSourceList.getItems(); MenuItem[] menuItems = popupMenuSourceList.getItems();
@ -864,6 +867,7 @@ public class AlertVisConfigDlg extends Dialog implements
mttPriorities = new MonitorToolTip(priorityLbl, false); mttPriorities = new MonitorToolTip(priorityLbl, false);
priorityLbl.addMouseTrackListener(new MouseTrackAdapter() { priorityLbl.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseHover(MouseEvent e) { public void mouseHover(MouseEvent e) {
mttPriorities.open(); mttPriorities.open();
} }
@ -1134,7 +1138,7 @@ public class AlertVisConfigDlg extends Dialog implements
sourceMap.keySet()); sourceMap.keySet());
Boolean saveInfo = (Boolean) newSrcCatDlg.open(); Boolean saveInfo = (Boolean) newSrcCatDlg.open();
if (saveInfo != null && saveInfo == true) { if ((saveInfo != null) && (saveInfo == true)) {
String name = newSrcCatDlg.getTextKey(); String name = newSrcCatDlg.getTextKey();
String desc = newSrcCatDlg.getDescription(); String desc = newSrcCatDlg.getDescription();
@ -1251,17 +1255,15 @@ public class AlertVisConfigDlg extends Dialog implements
gConfig.setMode(layoutControls.getSelectedLayoutTrayMode()); // Mandatory gConfig.setMode(layoutControls.getSelectedLayoutTrayMode()); // Mandatory
// to be // to be
// HERE! // HERE!
if (alertMsgDlg != null) {
gConfig.setPosition(alertMsgDlg.getCurrentLocation());
}
} }
/** /**
* Populate the priority controls. * Populate the priority controls.
*/ */
private void populatePriorityControls() { private void populatePriorityControls() {
if (priorityControls == null) if (priorityControls == null) {
return; return;
}
int index = sourcesList.getSelectionIndex(); int index = sourcesList.getSelectionIndex();

View file

@ -22,12 +22,15 @@ package com.raytheon.uf.viz.alertviz.ui.dialogs;
import java.io.File; import java.io.File;
import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplication;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MenuDetectEvent; import org.eclipse.swt.events.MenuDetectEvent;
import org.eclipse.swt.events.MenuDetectListener; import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -35,7 +38,6 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolTip; import org.eclipse.swt.widgets.ToolTip;
import org.eclipse.swt.widgets.Tray; import org.eclipse.swt.widgets.Tray;
@ -96,6 +98,10 @@ import com.raytheon.uf.viz.core.VizApp;
* 18 Mar 2015 4234 njensen Remove reference to non-working python * 18 Mar 2015 4234 njensen Remove reference to non-working python
* 03 Jun 2015 4473 njensen Updated for new AlertvizJob API * 03 Jun 2015 4473 njensen Updated for new AlertvizJob API
* 29 Jun 2015 4311 randerso Reworking AlertViz dialogs to be resizable. * 29 Jun 2015 4311 randerso Reworking AlertViz dialogs to be resizable.
* 28 Oct 2015 5054 randerso Call AlertVisualization.dispose() on restart so all the
* other dispose methods are called.
* 25 Jan 2016 5054 randerso Removed dummy parent shell
* 08 Feb 2016 5312 randerso Changed to build tray menu on demand
* *
* </pre> * </pre>
* *
@ -106,11 +112,6 @@ import com.raytheon.uf.viz.core.VizApp;
public class AlertVisualization implements ITimerAction, IAudioAction, public class AlertVisualization implements ITimerAction, IAudioAction,
IAlertArrivedCallback, Listener, IConfigurationChangedListener, IAlertArrivedCallback, Listener, IConfigurationChangedListener,
IRestartListener { IRestartListener {
/**
* Dialog shell.
*/
protected Shell shell;
/** /**
* The display control. * The display control.
*/ */
@ -136,35 +137,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
*/ */
private TrayItem trayItem; private TrayItem trayItem;
/**
* A pop-up menu for the tray item.
*/
protected Menu trayItemMenu;
/**
* Show alert visualization menu item.
*/
private MenuItem showAlertDialogMI;
/**
* Do not disturb menu item.
*/
private MenuItem doNotDisturbMI;
/**
* Show alert dialog popup menu item
*/
private MenuItem showPopup;
/**
* Acknowledge all alerts menu item
*/
private MenuItem ackAll;
/** /**
* Alert message dialog. * Alert message dialog.
*/ */
private AlertMessageDlg alertMessageDlg; protected AlertMessageDlg alertMessageDlg;
/** /**
* Text blink count variable. * Text blink count variable.
@ -211,6 +187,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
*/ */
private boolean showAlertDlg = true; private boolean showAlertDlg = true;
private boolean ackAll = false;
private boolean showPopup = false;
/** /**
* Tool tip. * Tool tip.
*/ */
@ -221,8 +201,6 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
*/ */
protected final boolean runningStandalone; protected final boolean runningStandalone;
private Rectangle prevLocation = null;
private ConfigContext configContext; private ConfigContext configContext;
private Configuration prevConfigFile; private Configuration prevConfigFile;
@ -245,15 +223,6 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
showAlertDlg = Boolean.getBoolean("ShowAlertVizBar"); showAlertDlg = Boolean.getBoolean("ShowAlertVizBar");
doNotDisturb = true; doNotDisturb = true;
} }
initShell();
}
/**
* Initialize a main shell.
*/
private void initShell() {
shell = new Shell(display);
initializeComponents(); initializeComponents();
AlertvizJob.getInstance().addAlertArrivedCallback(this); AlertvizJob.getInstance().addAlertArrivedCallback(this);
@ -295,10 +264,6 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
alertMessageDlg.dispose(); alertMessageDlg.dispose();
} }
if (shell != null) {
shell.dispose();
}
if (display != null) { if (display != null) {
display.dispose(); display.dispose();
} }
@ -322,9 +287,9 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
* Initialize the alert message dialog. * Initialize the alert message dialog.
*/ */
private void initAlertMessageDialog() { private void initAlertMessageDialog() {
alertMessageDlg = new AlertMessageDlg(shell, this, showAlertDlg, alertMessageDlg = new AlertMessageDlg(display, this, showAlertDlg,
configData, audioMgr); configData, audioMgr);
display.asyncExec(new Runnable() { display.syncExec(new Runnable() {
@Override @Override
public void run() { public void run() {
alertMessageDlg.open(); alertMessageDlg.open();
@ -361,14 +326,13 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
trayItem = new TrayItem(tray, SWT.NONE); trayItem = new TrayItem(tray, SWT.NONE);
updateToolTip(); updateToolTip();
trayItemMenu = new Menu(shell, SWT.POP_UP);
createTrayMenuItems();
// Right click action // Right click action
trayItem.addMenuDetectListener(new MenuDetectListener() { trayItem.addMenuDetectListener(new MenuDetectListener() {
@Override @Override
public void menuDetected(MenuDetectEvent de) { public void menuDetected(MenuDetectEvent de) {
Menu trayItemMenu = new Menu(alertMessageDlg.getShell(),
SWT.POP_UP);
createTrayMenuItems(trayItemMenu);
trayItemMenu.setVisible(true); trayItemMenu.setVisible(true);
} }
}); });
@ -389,10 +353,12 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
/** /**
* Create the tray menu items. * Create the tray menu items.
*
* @param menu
*/ */
protected void createTrayMenuItems() { protected void createTrayMenuItems(Menu menu) {
showAlertDialogMI = new MenuItem(trayItemMenu, SWT.CHECK); MenuItem showAlertDialogMI = new MenuItem(menu, SWT.CHECK);
showAlertDialogMI.setText("Show Alert Dialog"); showAlertDialogMI.setText("Show Alert Dialog");
showAlertDialogMI.setSelection(showAlertDlg); showAlertDialogMI.setSelection(showAlertDlg);
showAlertDialogMI.addSelectionListener(new SelectionAdapter() { showAlertDialogMI.addSelectionListener(new SelectionAdapter() {
@ -411,20 +377,21 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
}); });
if (Boolean.getBoolean("SystemTray")) { if (Boolean.getBoolean("SystemTray")) {
doNotDisturbMI = new MenuItem(trayItemMenu, SWT.CHECK); MenuItem doNotDisturbMI = new MenuItem(menu, SWT.CHECK);
doNotDisturbMI.setText("Do Not Disturb"); doNotDisturbMI.setText("Do Not Disturb");
doNotDisturbMI.setSelection(doNotDisturb); doNotDisturbMI.setSelection(doNotDisturb);
doNotDisturbMI.addSelectionListener(new SelectionAdapter() { doNotDisturbMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
doNotDisturb = doNotDisturbMI.getSelection(); MenuItem item = (MenuItem) event.widget;
doNotDisturb = item.getSelection();
} }
}); });
} }
new MenuItem(trayItemMenu, SWT.SEPARATOR); new MenuItem(menu, SWT.SEPARATOR);
MenuItem configTrayMI = new MenuItem(trayItemMenu, SWT.NONE); MenuItem configTrayMI = new MenuItem(menu, SWT.NONE);
configTrayMI.setText("Configuration..."); configTrayMI.setText("Configuration...");
configTrayMI.addSelectionListener(new SelectionAdapter() { configTrayMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
@ -433,7 +400,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
} }
}); });
MenuItem viewLogMI = new MenuItem(trayItemMenu, SWT.NONE); MenuItem viewLogMI = new MenuItem(menu, SWT.NONE);
viewLogMI.setText("System Log..."); viewLogMI.setText("System Log...");
viewLogMI.addSelectionListener(new SelectionAdapter() { viewLogMI.addSelectionListener(new SelectionAdapter() {
SimpleLogViewer slv = null; SimpleLogViewer slv = null;
@ -441,7 +408,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if ((slv == null) || slv.isDisposed()) { if ((slv == null) || slv.isDisposed()) {
slv = new SimpleLogViewer(shell); slv = new SimpleLogViewer(display);
slv.open(); slv.open();
} else { } else {
slv.bringToTop(); slv.bringToTop();
@ -449,22 +416,23 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
} }
}); });
new MenuItem(trayItemMenu, SWT.SEPARATOR); new MenuItem(menu, SWT.SEPARATOR);
showPopup = new MenuItem(trayItemMenu, SWT.NONE); MenuItem showPopupMI = new MenuItem(menu, SWT.NONE);
showPopup.setText("Show Alert Popup Dialog..."); showPopupMI.setText("Show Alert Popup Dialog...");
showPopup.setEnabled(false); showPopupMI.setEnabled(showPopup && (alertPopupDlg != null)
showPopup.addSelectionListener(new SelectionAdapter() { && !alertPopupDlg.isOpen());
showPopupMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
openAlertPopupDialog(); openAlertPopupDialog();
} }
}); });
ackAll = new MenuItem(trayItemMenu, SWT.NONE); MenuItem ackAllMI = new MenuItem(menu, SWT.NONE);
ackAll.setText("Acknowledge All Messages"); ackAllMI.setText("Acknowledge All Messages");
ackAll.setEnabled(false); ackAllMI.setEnabled(ackAll);
ackAll.addSelectionListener(new SelectionAdapter() { ackAllMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (alertPopupDlg != null) { if (alertPopupDlg != null) {
@ -479,16 +447,31 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
}); });
if (this.runningStandalone) { if (this.runningStandalone) {
new MenuItem(trayItemMenu, SWT.SEPARATOR); new MenuItem(menu, SWT.SEPARATOR);
MenuItem restartMI = new MenuItem(trayItemMenu, SWT.NONE); MenuItem restartMI = new MenuItem(menu, SWT.NONE);
restartMI.setText("Restart"); restartMI.setText("Restart");
restartMI.addSelectionListener(new SelectionAdapter() { restartMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION MessageDialog dialog = new MessageDialog(
| SWT.YES | SWT.NO); alertMessageDlg.getShell(),
mb.setMessage("Any unsaved changes will be lost. Restart anyway?"); "Confirm Restart!",
if (mb.open() == SWT.YES) { null,
"Any unsaved changes will be lost. Restart anyway?",
MessageDialog.QUESTION, new String[] {
IDialogConstants.YES_LABEL,
IDialogConstants.NO_LABEL }, 0);
dialog.create();
// center dialog on display
Shell shell = dialog.getShell();
Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Rectangle bounds = alertMessageDlg.getShell().getMonitor()
.getBounds();
shell.setLocation(bounds.x + ((bounds.width - size.x) / 2),
bounds.y + ((bounds.height - size.y) / 2));
if (dialog.open() == 0) {
restart(); restart();
} }
} }
@ -586,7 +569,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
if ((configDlg != null) && !configDlg.isDisposed()) { if ((configDlg != null) && !configDlg.isDisposed()) {
configDlg.close(); configDlg.close();
} }
configDlg = new AlertVisConfigDlg(shell, alertMessageDlg, configData, configDlg = new AlertVisConfigDlg(display, alertMessageDlg, configData,
configContext, this, this); configContext, this, this);
configDlg.open(); configDlg.open();
} }
@ -608,7 +591,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
final AlertMetadata amd, final Category cat, final AlertMetadata amd, final Category cat,
final TrayConfiguration gConfig) { final TrayConfiguration gConfig) {
if (shell.isDisposed()) { if ((alertMessageDlg == null) || alertMessageDlg.isDisposed()) {
Container.logInternal(Priority.ERROR, statMsg.getMessage() + "\n" Container.logInternal(Priority.ERROR, statMsg.getMessage() + "\n"
+ statMsg.getDetails()); + statMsg.getDetails());
return; return;
@ -690,10 +673,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
// Pop-up message // Pop-up message
if (amd.isPopup() == true) { if (amd.isPopup() == true) {
if (alertPopupDlg == null) { if (alertPopupDlg == null) {
alertPopupDlg = new AlertPopupMessageDlg(shell, statMsg, alertPopupDlg = new AlertPopupMessageDlg(display, statMsg,
gConfig.isExpandedPopup(), this, amd.getBackground()); gConfig.isExpandedPopup(), this, amd.getBackground());
showPopup.setEnabled(true); showPopup = true;
ackAll.setEnabled(true); ackAll = true;
startBlinkTrayTimer(); startBlinkTrayTimer();
} else { } else {
alertPopupDlg.addNewMessage(statMsg, amd); alertPopupDlg.addNewMessage(statMsg, amd);
@ -761,7 +744,8 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
toolTip.dispose(); toolTip.dispose();
} }
toolTip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_WARNING); toolTip = new ToolTip(alertMessageDlg.getShell(), SWT.BALLOON
| SWT.ICON_WARNING);
toolTip.setText(cat.getCategoryName()); toolTip.setText(cat.getCategoryName());
toolTip.setMessage(statMsg.getMessage()); toolTip.setMessage(statMsg.getMessage());
@ -797,6 +781,9 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
} }
} }
/**
* @return the exit status
*/
public Integer getExitStatus() { public Integer getExitStatus() {
return exitStatus; return exitStatus;
} }
@ -809,8 +796,8 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
public void handleEvent(Event event) { public void handleEvent(Event event) {
switch (event.type) { switch (event.type) {
case SWT.Hide: case SWT.Hide:
ackAll.setEnabled(true); ackAll = true;
showPopup.setEnabled(true); showPopup = true;
startBlinkTrayTimer(); startBlinkTrayTimer();
updateToolTip(); updateToolTip();
break; break;
@ -819,8 +806,9 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
alertPopupDlg = null; alertPopupDlg = null;
cancelTimer(); cancelTimer();
updateToolTip(); updateToolTip();
ackAll.setEnabled(false);
showPopup.setEnabled(false); ackAll = false;
showPopup = false;
break; break;
default: default:
Container.logInternal(Priority.WARN, "Unexpected event type: " Container.logInternal(Priority.WARN, "Unexpected event type: "
@ -838,7 +826,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
// such as Integer(1) the executable attempts to bring // such as Integer(1) the executable attempts to bring
// up an error screen before exiting with the error code. // up an error screen before exiting with the error code.
exitStatus = IApplication.EXIT_RELAUNCH; exitStatus = IApplication.EXIT_RELAUNCH;
display.dispose(); this.dispose();
} }
} }
@ -848,19 +836,16 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
configData = ConfigurationManager.getInstance() configData = ConfigurationManager.getInstance()
.getCurrentConfiguration(); .getCurrentConfiguration();
configContext = ConfigurationManager.getInstance().getCurrentContext(); configContext = ConfigurationManager.getInstance().getCurrentContext();
if ((alertMessageDlg != null) && (showAlertDialogMI != null)) { if (alertMessageDlg != null) {
alertMessageDlg.setConfigData(configData); alertMessageDlg.setConfigData(configData);
if (configData.isMonitorLayoutChanged(prevConfigFile)) { if (configData.isMonitorLayoutChanged(prevConfigFile)) {
if (alertMessageDlg.reLayout()) { if (alertMessageDlg.reLayout()) {
showAlertDialogMI.setEnabled(true); showAlertDlg = true;
} }
prevConfigFile = configData.clone(); prevConfigFile = configData.clone();
} }
audioMgr = alertMessageDlg.getAlertAudioManager(); audioMgr = alertMessageDlg.getAlertAudioManager();
} }
// if (configDlg != null && !configDlg.isDisposed()) {
// configDlg.restart(requestRestart);
// }
} }
/** /**

View file

@ -34,7 +34,6 @@ import java.util.Vector;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
@ -55,7 +54,6 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -73,6 +71,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* 07 Dec 2010 6531 cjeanbap Refactored class to be an Abstract class. * 07 Dec 2010 6531 cjeanbap Refactored class to be an Abstract class.
* 02 Mar 2011 5632 cjeanbap Update Listbox title text * 02 Mar 2011 5632 cjeanbap Update Listbox title text
* 06 May 2011 9101 cjeanbap Changed Constructor method signature. * 06 May 2011 9101 cjeanbap Changed Constructor method signature.
* 12 Nov 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -268,7 +268,7 @@ public class FileSelectDlg extends Dialog {
fileList.add(locFile.getFile(false).getName()); fileList.add(locFile.getFile(false).getName());
} }
fileList.select(getIndex()); fileList.select(getIndex());
fileList.addSelectionListener(new SelectionListener() { fileList.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
selectedIndex = fileList.getSelectionIndex(); selectedIndex = fileList.getSelectionIndex();
@ -287,10 +287,6 @@ public class FileSelectDlg extends Dialog {
associatedTextBox.setText(name); associatedTextBox.setText(name);
} }
} }
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
}); });
} }
@ -313,6 +309,7 @@ public class FileSelectDlg extends Dialog {
okBtn.setText("OK"); okBtn.setText("OK");
okBtn.setLayoutData(gd); okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() { okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
returnObj = true; returnObj = true;
shell.dispose(); shell.dispose();
@ -324,6 +321,7 @@ public class FileSelectDlg extends Dialog {
cancelBtn.setText("Cancel"); cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd); cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() { cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (isSelected()) { if (isSelected()) {
returnObj = false; returnObj = false;
@ -339,6 +337,7 @@ public class FileSelectDlg extends Dialog {
importNewBtn1.setText("Import"); importNewBtn1.setText("Import");
importNewBtn1.setLayoutData(gd); importNewBtn1.setLayoutData(gd);
importNewBtn1.addSelectionListener(new SelectionAdapter() { importNewBtn1.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
FileDialog newFileDlg = new FileDialog(shell, SWT.OPEN FileDialog newFileDlg = new FileDialog(shell, SWT.OPEN
| SWT.SINGLE); | SWT.SINGLE);
@ -368,10 +367,7 @@ public class FileSelectDlg extends Dialog {
} }
setSelectedFile(newFile.getName()); setSelectedFile(newFile.getName());
} }
} catch (LocalizationOpFailedException e) { } catch (LocalizationException | IOException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (IOException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e); e.getLocalizedMessage(), e);
} }
@ -382,7 +378,7 @@ public class FileSelectDlg extends Dialog {
} }
private boolean saveToLocalizationFile(File file, LocalizationFile locFile) private boolean saveToLocalizationFile(File file, LocalizationFile locFile)
throws IOException, LocalizationOpFailedException { throws IOException, LocalizationException {
File newFile = locFile.getFile(); File newFile = locFile.getFile();
InputStream in = new FileInputStream(file); InputStream in = new FileInputStream(file);
OutputStream out = new FileOutputStream(newFile); OutputStream out = new FileOutputStream(newFile);

View file

@ -20,9 +20,14 @@
package com.raytheon.uf.viz.alertviz.ui.dialogs; package com.raytheon.uf.viz.alertviz.ui.dialogs;
import java.io.File; import java.io.File;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -36,7 +41,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.FileDialog;
@ -71,6 +75,8 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration;
* Jun 02, 2015 4473 njensen Cleaned up warnings * Jun 02, 2015 4473 njensen Cleaned up warnings
* Jul 01, 2015 4473 njensen Fix update of table on alert arrival * Jul 01, 2015 4473 njensen Fix update of table on alert arrival
* Jun 29, 2015 4311 randerso Reworking AlertViz dialogs to be resizable. * Jun 29, 2015 4311 randerso Reworking AlertViz dialogs to be resizable.
* Jan 25, 2016 5054 randerso Converted to stand alone window
* Feb 11, 2016 5314 dgilling Fix System Log functionality.
* *
* </pre> * </pre>
* *
@ -78,7 +84,7 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration;
* @version 1.0 * @version 1.0
*/ */
public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback { public class SimpleLogViewer implements IAlertArrivedCallback {
private Display display; private Display display;
@ -88,8 +94,6 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
private Button showLog; private Button showLog;
int[] range;
private Table table; private Table table;
private Color yellow; private Color yellow;
@ -104,13 +108,12 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
/** /**
* *
* @param parent * @param display
*/ */
public SimpleLogViewer(Shell parent) { public SimpleLogViewer(Display display) {
super(parent, SWT.NONE);
first = true; first = true;
display = parent.getDisplay(); this.display = display;
// Create a new shell object and set the text for the dialog. // Create a new shell object and set the text for the dialog.
shell = new Shell(display, SWT.DIALOG_TRIM | SWT.MIN | SWT.TITLE shell = new Shell(display, SWT.DIALOG_TRIM | SWT.MIN | SWT.TITLE
@ -171,15 +174,10 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
columns[3].setWidth(100); columns[3].setWidth(100);
columns[4].setText("Message"); columns[4].setText("Message");
columns[4].setWidth(100); columns[4].setWidth(100);
int sz = 0; int sz = 0;
try { try {
range = SystemStatusHandler.getCurrentRange(); sz = SystemStatusHandler.getMessageCount();
if ((range[0] == 0) && (range[1] == 0)) {
// database is empty
sz = 0;
} else {
sz = (range[1] - range[0]) + 1;
}
} catch (AlertvizException e2) { } catch (AlertvizException e2) {
Container Container
.logInternal( .logInternal(
@ -199,17 +197,27 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
table.addSelectionListener(new SelectionAdapter() { table.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
Integer pk = (Integer) e.item.getData();
int idx = table.getSelectionIndex(); int idx = table.getSelectionIndex();
StatusMessage sm = null; StatusMessage sm = null;
try { try {
/*
sm = SystemStatusHandler.retrieveByPk(idx + range[0]); * This event is triggered during initialization before the
* first TableItem has been assigned a PK in its data field.
* So we fall back to item selection index just in case.
*/
if (pk != null) {
sm = SystemStatusHandler.retrieveByPk(pk.intValue());
} else {
sm = SystemStatusHandler.retrieveByRowOffset(idx);
}
} catch (Exception e1) { } catch (Exception e1) {
Container Container
.logInternal( .logInternal(
Priority.ERROR, Priority.ERROR,
"SimpleLogViewer: exception retrieving StatusMessage by key from SystemStatusHandler: " "SimpleLogViewer: exception retrieving StatusMessage by key from SystemStatusHandler: "
+ (idx + range[0]), e1); + (idx + 1), e1);
} }
detailsComp.displayDetails(sm); detailsComp.displayDetails(sm);
} }
@ -227,12 +235,13 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
int index = table.indexOf(item); int index = table.indexOf(item);
try { try {
StatusMessage sm = SystemStatusHandler StatusMessage sm = SystemStatusHandler
.retrieveByPk(range[0] + index); .retrieveByRowOffset(index);
item.setText(0, "" + sm.getEventTime().toString()); item.setText(0, "" + sm.getEventTime().toString());
item.setText(1, "" + sm.getPriority().ordinal()); item.setText(1, "" + sm.getPriority().ordinal());
item.setText(2, sm.getSourceKey()); item.setText(2, sm.getSourceKey());
item.setText(3, sm.getCategory()); item.setText(3, sm.getCategory());
item.setText(4, sm.getMessage()); item.setText(4, sm.getMessage());
item.setData(Integer.valueOf(sm.getPk()));
if (sm.getPriority() == Priority.CRITICAL) { if (sm.getPriority() == Priority.CRITICAL) {
item.setForeground(red); item.setForeground(red);
@ -247,14 +256,15 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
} }
} catch (AlertvizException e1) { } catch (AlertvizException e1) {
Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Container
"Error fetching the data", e1); .logInternal(
ErrorDialog.openError( Priority.ERROR,
Display.getCurrent().getActiveShell(), "SimpleLogViewer: exception retrieving StatusMessage by row offset from SystemStatusHandler: "
"Error fetching data", + index, e1);
"Error fetching the log data", s); errorDialogWithStackTrace(Display.getCurrent()
.getActiveShell(), "Error fetching data",
"Error fetching the log data", e1);
} }
} }
}); });
@ -281,10 +291,12 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
LogUtil.saveLogToFile(new File(fileName), LogUtil.saveLogToFile(new File(fileName),
new Timestamp(0), Order.AFTER); new Timestamp(0), Order.AFTER);
} catch (AlertvizException e1) { } catch (AlertvizException e1) {
final Status s = new Status(IStatus.ERROR, Container.logInternal(Priority.ERROR,
Activator.PLUGIN_ID, "Error saving log", e1); "SimpleLogViewer: exception saving log file: "
ErrorDialog.openError(shell, "Error saving log", + fileName, e1);
"Error saving log", s); errorDialogWithStackTrace(Display.getCurrent()
.getActiveShell(), "Error saving log",
"Error saving log", e1);
} }
} }
} }
@ -356,8 +368,11 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
AlertvizJob.getInstance().addAlertArrivedCallback(this); AlertvizJob.getInstance().addAlertArrivedCallback(this);
shell.open(); shell.open();
if (table.getItemCount() > 0) {
table.showItem(table.getItem(table.getItemCount() - 1)); table.showItem(table.getItem(table.getItemCount() - 1));
table.select(table.getItemCount() - 1); table.select(table.getItemCount() - 1);
}
// Wait until the shell is disposed. // Wait until the shell is disposed.
Display display = shell.getDisplay(); Display display = shell.getDisplay();
@ -404,4 +419,26 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
size.y += delta; size.y += delta;
shell.setSize(size); shell.setSize(size);
} }
private static void errorDialogWithStackTrace(Shell parentShell,
String dialogTitle, String msg, Throwable t) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
String trace = sw.toString();
Collection<Status> childStatuses = new ArrayList<>();
String lineSep = System.getProperty("line.separator");
for (String line : trace.split(lineSep)) {
childStatuses.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
line));
}
MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR,
childStatuses.toArray(new Status[0]), t.getLocalizedMessage(),
t);
ErrorDialog.openError(parentShell, dialogTitle, msg, ms);
}
} }

View file

@ -1,248 +0,0 @@
package com.raytheon.uf.viz.alertviz.ui.dialogs;
import java.io.File;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
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.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
public abstract class TmpFileSelectDlg extends Dialog {
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
/**
* Control font.
*/
private Font controlFont;
/**
* Sound file list control.
*/
private List soundFileList;
/**
* Return object when the shell is disposed.
*/
private Boolean returnObj = null;
/**
* Array of localization files.
*/
private LocalizationFile[] locFiles;
/**
* Current sound file.
*/
public File currentFile;
/**
* New sound file.
*/
private File newFile;
private String path;
private String fileExtension;
public TmpFileSelectDlg(Shell parent, int style) {
super(parent, style);
}
/**
* Open method used to display the dialog.
*
* @param audioFile
* The name of the audio file, if null default to index 0.
* @return True/False.
*/
public Object open(String title, String actionFile) {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.TITLE);
//shell.setText("Action File Selection");
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 2;
mainLayout.marginWidth = 2;
mainLayout.verticalSpacing = 2;
shell.setLayout(mainLayout);
// Initialize all of the controls and layouts
initializeComponents();
if (actionFile != null) {
setSelectedAudioFile(actionFile);
}
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
controlFont.dispose();
return returnObj;
}
/**
* Initialize the controls on the display.
*/
private void initializeComponents() {
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
createListControl();
// Create the buttons at the bottom of the display.
createBottomButtons();
getAvailableFiles();
}
/**
* Set the selected index of file list object based upon the
* audio file.
*
* @param audioFile The name of the audio file.
*/
private void setSelectedAudioFile(String audioFile) {
String[] audioFiles = soundFileList.getItems();
int index = 0;
for (int i = 0; i < audioFiles.length; i++) {
if (audioFile.endsWith(audioFiles[i])) {
index = i;
break;
}
}
soundFileList.select(index);
}
/**
* Create the list control.
*/
private void createListControl() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite listComp = new Composite(shell, SWT.NONE);
listComp.setLayout(new GridLayout(1, false));
listComp.setLayoutData(gd);
Label listLbl = new Label(listComp, SWT.NONE);
listLbl.setText("Available Sound Files:");
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 400;
gd.heightHint = 400;
gd.horizontalSpan = 2;
soundFileList = new List(listComp, SWT.BORDER | SWT.SINGLE
| SWT.V_SCROLL | SWT.H_SCROLL);
soundFileList.setLayoutData(gd);
soundFileList.setFont(controlFont);
}
/**
* Create the buttons at the bottom of the dialog.
*/
private void createBottomButtons() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainButtonComp = new Composite(shell, SWT.NONE);
mainButtonComp.setLayout(new GridLayout(1, false));
mainButtonComp.setLayoutData(gd);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, false));
buttonComp.setLayoutData(gd);
gd = new GridData(100, SWT.DEFAULT);
Button okBtn = new Button(buttonComp, SWT.PUSH);
okBtn.setText("OK");
okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (soundFileList.getSelectionIndex() != 0) {
newFile = locFiles[soundFileList.getSelectionIndex()].getFile();
} else {
newFile = locFiles[0].getFile();
}
returnObj = true;
shell.dispose();
}
});
gd = new GridData(100, SWT.DEFAULT);
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
returnObj = false;
shell.dispose();
}
});
}
/**
* Get the list of available sound files.
*/
private void getAvailableFiles() {
String[] extensions = new String[] { fileExtension };
locFiles = PathManagerFactory.getPathManager().listStaticFiles(
path, extensions, true, true);
for (int i = 0; i < locFiles.length; i++) {
soundFileList.add(locFiles[i].getName());
}
if (currentFile != null) {
soundFileList.select(soundFileList.indexOf(currentFile
.getName()));
}
}
/**
* Get the selected sound file.
*
* @return The sound file.
*/
public File getSelectedFile() {
return newFile;
}
public void setFileExtension(String fileExtension) {
this.fileExtension = fileExtension;
}
public void setFile(String file) {
if (file != null) {
this.currentFile = new File(file);
}
}
public void setFilesLocationPath(String path) {
this.path = path;
}
}

View file

@ -19,11 +19,8 @@
**/ **/
package com.raytheon.uf.viz.alertviz; package com.raytheon.uf.viz.alertviz;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -34,13 +31,15 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller; import javax.xml.bind.Unmarshaller;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -58,14 +57,18 @@ import com.raytheon.uf.viz.alertviz.config.Source;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 7, 2010 mschenke Initial creation * Apr 07, 2010 mschenke Initial creation
* Mar 16, 2011 6531 rferrel Start up loads host dependent * Mar 16, 2011 6531 rferrel Start up loads host dependent
* configuration file. * configuration file.
* Aug 28 2012 13528 Xiaochuan Using setNewConfiguration() to * Aug 28, 2012 13528 Xiaochuan Using setNewConfiguration() to
* re-set configuration data and * re-set configuration data and
* run notifyListeners(). * run notifyListeners().
* Apr 07 2015 4346 rferrel Created {@link #retrieveBaseConfiguration()}. * Apr 07, 2015 4346 rferrel Created {@link #retrieveBaseConfiguration}.
* May 20, 2015 4346 rjpeter Updated to also load from common_static. * May 20, 2015 4346 rjpeter Updated to also load from common_static.
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated ILocalizationFile methods
* Feb 12, 2016 4834 bsteffen Fix multiple saves of the customConfiguration.
*
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -166,7 +169,7 @@ public class ConfigurationManager {
ConfigContext workstationContext = DEFAULT_WORKSTATION_CONFIG; ConfigContext workstationContext = DEFAULT_WORKSTATION_CONFIG;
try { try {
LocalizationFile file = getLocalizationFile(workstationContext); ILocalizationFile file = getLocalizationFile(workstationContext);
if (file == null || !file.exists()) { if (file == null || !file.exists()) {
ConfigContext sourceContext = DEFAULT_SITE_CONFIG; ConfigContext sourceContext = DEFAULT_SITE_CONFIG;
@ -262,7 +265,7 @@ public class ConfigurationManager {
/** /**
* Delete the configuration passed in * Delete the configuration passed in
* *
* @param name * @param context
*/ */
public void deleteConfiguration(ConfigContext context) { public void deleteConfiguration(ConfigContext context) {
if (context.isBaseOrConfiguredLevel() || isDefaultConfig(context)) { if (context.isBaseOrConfiguredLevel() || isDefaultConfig(context)) {
@ -272,7 +275,7 @@ public class ConfigurationManager {
if (current.equals(context)) { if (current.equals(context)) {
loadAsCurrent(DEFAULT_WORKSTATION_CONFIG); loadAsCurrent(DEFAULT_WORKSTATION_CONFIG);
} }
LocalizationFile file = getLocalizationFile(context); ILocalizationFile file = getLocalizationFile(context);
try { try {
file.delete(); file.delete();
} catch (Exception e) { } catch (Exception e) {
@ -317,10 +320,10 @@ public class ConfigurationManager {
private void loadFromLocalizationType(LocalizationType type) { private void loadFromLocalizationType(LocalizationType type) {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext[] contexts = pm.getLocalSearchHierarchy(type); LocalizationContext[] contexts = pm.getLocalSearchHierarchy(type);
LocalizationFile[] files = pm.listFiles(contexts, CONFIG_DIR, ILocalizationFile[] files = pm.listFiles(contexts, CONFIG_DIR,
EXTENSIONS, true, true); // Win32 EXTENSIONS, true, true); // Win32
for (LocalizationFile file : files) { for (ILocalizationFile file : files) {
LocalizationContext fileContext = file.getContext(); LocalizationContext fileContext = file.getContext();
/* /*
@ -329,8 +332,8 @@ public class ConfigurationManager {
*/ */
if ((fileContext.getLocalizationLevel() != LocalizationLevel.BASE) if ((fileContext.getLocalizationLevel() != LocalizationLevel.BASE)
|| ((fileContext.getLocalizationLevel() == LocalizationLevel.BASE) && DEFAULT_BASE_CONFIG || ((fileContext.getLocalizationLevel() == LocalizationLevel.BASE) && DEFAULT_BASE_CONFIG
.getLocalizationFileName().equals(file.getName()))) { .getLocalizationFileName().equals(file.getPath()))) {
String fileName = file.getName(); String fileName = file.getPath();
LocalizationContext locContext = file.getContext(); LocalizationContext locContext = file.getContext();
String name = fileName.substring( String name = fileName.substring(
fileName.lastIndexOf(IPathManager.SEPARATOR) + 1, // win32 fileName.lastIndexOf(IPathManager.SEPARATOR) + 1, // win32
@ -362,7 +365,7 @@ public class ConfigurationManager {
} }
public Configuration retrieveConfiguration(ConfigContext configContext) { public Configuration retrieveConfiguration(ConfigContext configContext) {
LocalizationFile file = getLocalizationFile(configContext); ILocalizationFile file = getLocalizationFile(configContext);
if (DEFAULT_BASE_CONFIG.equals(configContext)) { if (DEFAULT_BASE_CONFIG.equals(configContext)) {
if (baseConfiguration == null) { if (baseConfiguration == null) {
baseConfiguration = retrieveBaseConfiguration(); baseConfiguration = retrieveBaseConfiguration();
@ -379,7 +382,7 @@ public class ConfigurationManager {
* @return configuration * @return configuration
*/ */
private Configuration retrieveBaseConfiguration() { private Configuration retrieveBaseConfiguration() {
LocalizationFile file = getLocalizationFile(DEFAULT_BASE_CONFIG); ILocalizationFile file = getLocalizationFile(DEFAULT_BASE_CONFIG);
Configuration configuration = retrieveConfiguration(file); Configuration configuration = retrieveConfiguration(file);
configuration = mergeBaseConfigurations(LocalizationType.CAVE_STATIC, configuration = mergeBaseConfigurations(LocalizationType.CAVE_STATIC,
configuration); configuration);
@ -393,12 +396,12 @@ public class ConfigurationManager {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(type, LocalizationContext context = pm.getContext(type,
LocalizationLevel.BASE); LocalizationLevel.BASE);
LocalizationFile[] files = pm.listFiles(context, CONFIG_DIR, ILocalizationFile[] files = pm.listFiles(context, CONFIG_DIR,
EXTENSIONS, false, true); EXTENSIONS, false, true);
for (LocalizationFile f : files) { for (ILocalizationFile f : files) {
// Merge other base files with the default. // Merge other base files with the default.
if (!DEFAULT_BASE_CONFIG.getLocalizationFileName().equals( if (!DEFAULT_BASE_CONFIG.getLocalizationFileName().equals(
f.getName())) { f.getPath())) {
Configuration fileConfig = retrieveConfiguration(f); Configuration fileConfig = retrieveConfiguration(f);
Configuration mergeConfig = configuration.mergeUnder( Configuration mergeConfig = configuration.mergeUnder(
fileConfig, true); fileConfig, true);
@ -409,14 +412,11 @@ public class ConfigurationManager {
return configuration; return configuration;
} }
public Configuration retrieveConfiguration(LocalizationFile file) { public Configuration retrieveConfiguration(ILocalizationFile file) {
Configuration config = null; Configuration config = null;
if (file != null) { if (file != null && file.exists()) {
try { try {
File actualFile = file.getFile(); config = (Configuration) deserializeFromFile(file);
if (actualFile != null && actualFile.exists()) {
config = (Configuration) deserializeFromFile(actualFile);
}
} catch (SerializationException e) { } catch (SerializationException e) {
statusHandler.handle(Priority.CRITICAL, statusHandler.handle(Priority.CRITICAL,
"Error deserializing configuration xml", e); "Error deserializing configuration xml", e);
@ -427,18 +427,12 @@ public class ConfigurationManager {
private boolean saveToFile(ConfigContext cContext, Configuration config) { private boolean saveToFile(ConfigContext cContext, Configuration config) {
boolean success = true; boolean success = true;
LocalizationFile file = getLocalizationFile(cContext); ILocalizationFile file = getLocalizationFile(cContext);
try { try {
// do not attempt to save to base // do not attempt to save to base
if (file != null if (file != null
&& file.getContext().getLocalizationLevel() != LocalizationLevel.BASE) { && file.getContext().getLocalizationLevel() != LocalizationLevel.BASE) {
serializeToFile(config, file.getFile()); serializeToFile(config, file);
if (!file.save()) {
// failed to save delete the local copy and switch to the
// default config.
file.delete();
success = false;
}
} }
} catch (SerializationException e) { } catch (SerializationException e) {
statusHandler.handle(Priority.CRITICAL, statusHandler.handle(Priority.CRITICAL,
@ -468,62 +462,27 @@ public class ConfigurationManager {
} }
} }
private void serializeToFile(Object obj, File file) private void serializeToFile(Object obj, ILocalizationFile file)
throws SerializationException { throws SerializationException {
FileWriter writer = null; try (SaveableOutputStream os = file.openOutputStream()) {
Marshaller msh = marshaller; marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
try { new Boolean(true));
File dir = file.getParentFile(); marshaller.marshal(obj, os);
if (dir.isDirectory() == false) { os.save();
dir.delete();
dir.mkdirs();
}
msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
writer = new FileWriter(file);
msh.marshal(obj, writer);
} catch (Exception e) { } catch (Exception e) {
throw new SerializationException(e); throw new SerializationException(e);
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
// Log to internal Log4j log
Container
.logInternal(
Priority.ERROR,
"ConfigurationManager: exception closing file writer.",
e);
}
}
} }
} }
private Object deserializeFromFile(File file) throws SerializationException { private Object deserializeFromFile(ILocalizationFile file)
FileReader reader = null; throws SerializationException {
Unmarshaller msh = unmarshaller; try (InputStream is = file.openInputStream()) {
try { return unmarshaller.unmarshal(is);
reader = new FileReader(file); } catch (LocalizationException | IOException | JAXBException e) {
Object obj = msh.unmarshal(reader);
return obj;
} catch (FileNotFoundException e) {
Container.logInternal(Priority.ERROR, Container.logInternal(Priority.ERROR,
"AlertViz ConfigurationManager unable to find file: " "ConfigurationManager: Exception unmarshalling from file: "
+ file.getAbsolutePath(), e); + file.getPath(), e);
throw new SerializationException(e); throw new SerializationException(e);
} catch (JAXBException e) {
Container.logInternal(Priority.ERROR,
"ConfigurationManager: JAXB exception unmarshalling from file: "
+ file.getAbsolutePath(), e);
throw new SerializationException(e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// ignore
}
}
} }
} }
@ -531,15 +490,12 @@ public class ConfigurationManager {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext ctx = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationContext ctx = pm.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.SITE); LocalizationLevel.SITE);
LocalizationFile file = pm.getLocalizationFile(ctx, ILocalizationFile file = pm.getLocalizationFile(ctx,
ConfigContext.ALERTVIZ_DIR + IPathManager.SEPARATOR ConfigContext.ALERTVIZ_DIR + IPathManager.SEPARATOR
+ "AlertVizForced.xml"); + "AlertVizForced.xml");
File actualFile = file.getFile(); if (file != null && file.exists()) {
// Win32: JHB put in check for length try (InputStream is = file.openInputStream()) {
if (actualFile != null && actualFile.exists() return (ForcedConfiguration) unmarshaller.unmarshal(is);
&& actualFile.length() > 0) {
try {
return (ForcedConfiguration) unmarshaller.unmarshal(actualFile);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT,
"Error deserializing forced configuration", e); "Error deserializing forced configuration", e);
@ -569,10 +525,9 @@ public class ConfigurationManager {
} }
private void updateCustom(boolean isRemove, Object obj) { private void updateCustom(boolean isRemove, Object obj) {
LocalizationFile locFile = getCustomLocalization(); ILocalizationFile locFile = getCustomLocalization();
File customFile = locFile.getFile();
try { try {
customConfiguration = (Configuration) deserializeFromFile(customFile); customConfiguration = (Configuration) deserializeFromFile(locFile);
if (obj instanceof Category) { if (obj instanceof Category) {
Map<String, Category> categories = customConfiguration Map<String, Category> categories = customConfiguration
.getCategories(); .getCategories();
@ -594,12 +549,11 @@ public class ConfigurationManager {
} }
customConfiguration.setSources(sources); customConfiguration.setSources(sources);
} }
serializeToFile(customConfiguration, customFile); serializeToFile(customConfiguration, locFile);
locFile.save(); /* Must reload fresh copy next time it is used. */
customLocalization = null;
} catch (SerializationException e) { } catch (SerializationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} }
} }

View file

@ -28,7 +28,6 @@ import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.message.StatusMessage; import com.raytheon.uf.common.message.StatusMessage;
@ -58,6 +57,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Jun 03, 2013 2026 randerso Fixed typo * Jun 03, 2013 2026 randerso Fixed typo
* Jul 27, 2015 4654 skorolev Added a localization level filtration * Jul 27, 2015 4654 skorolev Added a localization level filtration
* Sep 21, 2015 4654 njensen Made filter logic strict instead of eager * Sep 21, 2015 4654 njensen Made filter logic strict instead of eager
* Jan 14, 2016 5054 randerso Remove dummy shell
* *
* </pre> * </pre>
* *
@ -315,7 +315,7 @@ public class Container implements IConfigurationChangedListener {
} }
// Status status = null; // Status status = null;
ErrorDialog.openError(new Shell(), ErrorDialog.openError(null,
"Error saving to internal database", "Error saving to internal database",
"Serious internal error occurred", new Status( "Serious internal error occurred", new Status(
IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Activator.PLUGIN_ID,

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.viz.alertviz.internal.LogMessageDAO;
* Aug 26, 2013 2142 njensen Changed to use SLF4J * Aug 26, 2013 2142 njensen Changed to use SLF4J
* Jul 02, 2014 3337 njensen Disabled logback packaging data * Jul 02, 2014 3337 njensen Disabled logback packaging data
* May 22, 2015 4473 njensen Refactored * May 22, 2015 4473 njensen Refactored
* Feb 11, 2016 5314 dgilling Add retrieveByRowOffset.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -122,16 +123,30 @@ public class SystemStatusHandler extends AbstractStatusHandler {
} }
/** /**
* Get the current range of persisted StatusMessages * Retrieve a status message by row offset
* *
* @param index
* The row offset, 0-based index.
* @return the status message
* @throws AlertvizException
* If an error occurred querying the database for the status
* message
*/
public static StatusMessage retrieveByRowOffset(int index)
throws AlertvizException {
return LogMessageDAO.getInstance().loadByRowOffset(index);
}
/**
* Get the current number of persisted StatusMessages.
* <p>
* NOTE: This only works when called from inside the alertviz container * NOTE: This only works when called from inside the alertviz container
* *
* * @return
* @return the range [min, max] of values
* @throws AlertvizException * @throws AlertvizException
*/ */
public static int[] getCurrentRange() throws AlertvizException { public static int getMessageCount() throws AlertvizException {
return LogMessageDAO.getInstance().getLogRange(); return LogMessageDAO.getInstance().getMessageCount();
} }
/** /**
@ -148,5 +163,4 @@ public class SystemStatusHandler extends AbstractStatusHandler {
int count) throws AlertvizException { int count) throws AlertvizException {
return LogMessageDAO.getInstance().load(count, category); return LogMessageDAO.getInstance().load(count, category);
} }
} }

View file

@ -31,7 +31,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode; import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode;
/** /**
@ -49,6 +48,7 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode;
* May 3, 2011 9067 cjeanbap Add isMonitorLayoutChanged() method. * May 3, 2011 9067 cjeanbap Add isMonitorLayoutChanged() method.
* Apr 27 2012 13744 Xiaochuan Update isMonitorLayoutChanged() to compare * Apr 27 2012 13744 Xiaochuan Update isMonitorLayoutChanged() to compare
* source size in Previous and current. * source size in Previous and current.
* Oct 28, 2005 5054 randerso removed bar position as it was written but never read
* *
* </pre> * </pre>
* *
@ -57,7 +57,7 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode;
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "alertConfiguration") @XmlRootElement(name = "alertConfiguration")
public class Configuration implements ISerializableObject { public class Configuration {
@XmlAttribute @XmlAttribute
private String name; private String name;
@ -127,7 +127,7 @@ public class Configuration implements ISerializableObject {
* Look up a source * Look up a source
* *
* @param componentName * @param componentName
* @return * @return the source
*/ */
public Source lookupSource(String componentName) { public Source lookupSource(String componentName) {
return this.sourceMap.get(componentName); return this.sourceMap.get(componentName);
@ -137,7 +137,7 @@ public class Configuration implements ISerializableObject {
* Look up a category * Look up a category
* *
* @param componentName * @param componentName
* @return * @return the category
*/ */
public Category lookupCategory(String componentName) { public Category lookupCategory(String componentName) {
return this.categoryMap.get(componentName); return this.categoryMap.get(componentName);
@ -148,7 +148,7 @@ public class Configuration implements ISerializableObject {
* *
* This is usually used by serialization, not end users. * This is usually used by serialization, not end users.
* *
* @param collection * @param sources
*/ */
@XmlElement(name = "source") @XmlElement(name = "source")
public void setSourceCollection(Source[] sources) { public void setSourceCollection(Source[] sources) {
@ -163,7 +163,7 @@ public class Configuration implements ISerializableObject {
* *
* This is usually used by serialization, not end users. * This is usually used by serialization, not end users.
* *
* @return * @return the source collection
*/ */
public Source[] getSourceCollection() { public Source[] getSourceCollection() {
return sourceMap.values().toArray(new Source[sourceMap.size()]); return sourceMap.values().toArray(new Source[sourceMap.size()]);
@ -174,7 +174,7 @@ public class Configuration implements ISerializableObject {
* *
* This is usually used by serialization, not end users. * This is usually used by serialization, not end users.
* *
* @param collection * @param categories
*/ */
@XmlElement(name = "category") @XmlElement(name = "category")
public void setCategoryCollection(Category[] categories) { public void setCategoryCollection(Category[] categories) {
@ -189,20 +189,27 @@ public class Configuration implements ISerializableObject {
* *
* This is usually used by serialization, not end users. * This is usually used by serialization, not end users.
* *
* @return * @return the category collection
*/ */
public Category[] getCategoryCollection() { public Category[] getCategoryCollection() {
return categoryMap.values().toArray(new Category[categoryMap.size()]); return categoryMap.values().toArray(new Category[categoryMap.size()]);
} }
/**
* @return the name
*/
public String getName() { public String getName() {
return name; return name;
} }
/**
* @param name
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
@Override
public Configuration clone() { public Configuration clone() {
Configuration newConfig = new Configuration(); Configuration newConfig = new Configuration();
newConfig.name = name; newConfig.name = name;
@ -225,6 +232,7 @@ public class Configuration implements ISerializableObject {
return newConfig; return newConfig;
} }
@Override
public String toString() { public String toString() {
String rval = getName() + ":\n"; String rval = getName() + ":\n";
rval += "\tTrayConfig:\n"; rval += "\tTrayConfig:\n";
@ -232,8 +240,7 @@ public class Configuration implements ISerializableObject {
+ globalConfiguration.getAudioDuration() + " blinkDuration=" + globalConfiguration.getAudioDuration() + " blinkDuration="
+ globalConfiguration.getBlinkDuration() + " logLength=" + globalConfiguration.getBlinkDuration() + " logLength="
+ globalConfiguration.getLogLength() + "\n"; + globalConfiguration.getLogLength() + "\n";
rval += "\t\t" + "mode=" + globalConfiguration.getMode() + " position=" rval += "\t\t" + "mode=" + globalConfiguration.getMode() + "\n";
+ globalConfiguration.getPosition() + "\n";
rval += "\t\t" + "categoryShown=" rval += "\t\t" + "categoryShown="
+ globalConfiguration.isCategoryShown() + " expandedPopup=" + globalConfiguration.isCategoryShown() + " expandedPopup="
+ globalConfiguration.isExpandedPopup() + " priorityShown=" + globalConfiguration.isExpandedPopup() + " priorityShown="
@ -406,11 +413,13 @@ public class Configuration implements ISerializableObject {
} }
/** /**
* Determine if a Monitor was added/omitted (enable/disabled) and/or if the Layout of the * Determine if a Monitor was added/omitted (enable/disabled) and/or if the
* Alert Message Dialog was changed. * Layout of the Alert Message Dialog was changed.
* *
* @param configData the current save Configuration Data. * @param configData
* @return boolean, true if either Monitor and/or Layout was changed otherwise false. * the current save Configuration Data.
* @return boolean, true if either Monitor and/or Layout was changed
* otherwise false.
*/ */
public boolean isMonitorLayoutChanged(Configuration configData) { public boolean isMonitorLayoutChanged(Configuration configData) {
boolean modified = false; boolean modified = false;

View file

@ -23,10 +23,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.common.serialization.ISerializableObject;
/** /**
* Global configuration items for alertviz * Global configuration items for alertviz
* *
@ -35,13 +31,14 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 18, 2008 1433 chammack Initial creation * Sep 18, 2008 1433 chammack Initial creation
* Oct 28, 2005 5054 randerso removed bar position as it was written but never read
* </pre> * </pre>
* *
* @author chammack * @author chammack
* @version 1.0 * @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class TrayConfiguration implements ISerializableObject { public class TrayConfiguration {
/** /**
* The mode of the display: * The mode of the display:
@ -109,21 +106,6 @@ public class TrayConfiguration implements ISerializableObject {
@XmlAttribute @XmlAttribute
private int logLength; private int logLength;
/**
* The position of the bar
*/
@XmlAttribute
private int xPosition;
@XmlAttribute
private int yPosition;
@XmlAttribute
private int width;
@XmlAttribute
private int height;
/** /**
* @return the mode * @return the mode
*/ */
@ -154,28 +136,6 @@ public class TrayConfiguration implements ISerializableObject {
this.priorityShown = priorityShown; this.priorityShown = priorityShown;
} }
/**
* @return the position
*/
public Rectangle getPosition() {
Rectangle position = null;
if (xPosition >= 0 && yPosition >= 0 && width >= 1 && height >= 1) {
position = new Rectangle(xPosition, yPosition, width, height);
}
return position;
}
/**
* @param position
* the position to set
*/
public void setPosition(Rectangle position) {
this.xPosition = position.x;
this.yPosition = position.y;
this.width = position.width;
this.height = position.height;
}
/** /**
* @return the sourceKeyShown * @return the sourceKeyShown
*/ */
@ -259,59 +219,24 @@ public class TrayConfiguration implements ISerializableObject {
} }
/** /**
* @param messageLogLength * @param logLength
* the messageLogLength to set * the messageLogLength to set
*/ */
public void setLogLength(int logLength) { public void setLogLength(int logLength) {
this.logLength = logLength; this.logLength = logLength;
} }
public int getXPosition() { @Override
return xPosition;
}
public void setXPosition(int position) {
xPosition = position;
}
public int getYPosition() {
return yPosition;
}
public void setYPosition(int position) {
yPosition = position;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public TrayConfiguration clone() { public TrayConfiguration clone() {
TrayConfiguration newConfig = new TrayConfiguration(); TrayConfiguration newConfig = new TrayConfiguration();
newConfig.audioDuration = audioDuration; newConfig.audioDuration = audioDuration;
newConfig.blinkDuration = blinkDuration; newConfig.blinkDuration = blinkDuration;
newConfig.categoryShown = categoryShown; newConfig.categoryShown = categoryShown;
newConfig.expandedPopup = expandedPopup; newConfig.expandedPopup = expandedPopup;
newConfig.height = height;
newConfig.logLength = logLength; newConfig.logLength = logLength;
newConfig.mode = mode; newConfig.mode = mode;
newConfig.priorityShown = priorityShown; newConfig.priorityShown = priorityShown;
newConfig.sourceKeyShown = sourceKeyShown; newConfig.sourceKeyShown = sourceKeyShown;
newConfig.width = width;
newConfig.xPosition = xPosition;
newConfig.yPosition = yPosition;
return newConfig; return newConfig;
} }

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 11, 2008 1433 chammack Initial creation * Sep 11, 2008 1433 chammack Initial creation
* Feb 11, 2016 5314 dgilling Add loadByRowOffset.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -64,11 +65,13 @@ public class LogMessageDAO {
private static final String SELECT_ALL_QUERY_BY_PK = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log WHERE pk = ?"; private static final String SELECT_ALL_QUERY_BY_PK = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log WHERE pk = ?";
private static final String SELECT_ALL_QUERY_BY_ROW_OFFSET = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log ORDER BY pk OFFSET ? ROWS FETCH NEXT ROW ONLY";
private static final String PURGE_TIME_QUERY = "SELECT purge_time FROM dbMetadata"; private static final String PURGE_TIME_QUERY = "SELECT purge_time FROM dbMetadata";
private static final String PURGE_TIME_UPDATE = "UPDATE dbMetadata SET purge_time = ?"; private static final String PURGE_TIME_UPDATE = "UPDATE dbMetadata SET purge_time = ?";
private static final String DATA_RANGE_QUERY = "SELECT MIN(pk), MAX(pk) FROM log"; private static final String MESSAGE_COUNT_QUERY = "SELECT COUNT(pk) FROM log";
private static final String SELECT_ALL_BY_DATE_AND_SOURCE_AFTER = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log WHERE event_time > ?"; private static final String SELECT_ALL_BY_DATE_AND_SOURCE_AFTER = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log WHERE event_time > ?";
@ -353,6 +356,45 @@ public class LogMessageDAO {
} }
} }
/**
* Retrieves the specified status message from the message store using the
* specified index as a row offset.
*
* @param index
* The index of the message to retrieve
* @return The status message
* @throws AlertvizException
* If an error occurred retrieving the message from the message
* store.
*/
public StatusMessage loadByRowOffset(int index) throws AlertvizException {
ResultSet rs = null;
PreparedStatement statement = null;
boolean errorOccurred = false;
try {
Connection conn = getConnection();
statement = conn.prepareStatement(SELECT_ALL_QUERY_BY_ROW_OFFSET);
statement.setInt(1, index);
rs = statement.executeQuery();
conn.commit();
return reconstituteResults(rs)[0];
} catch (SQLException e) {
errorOccurred = true;
throw new AlertvizException("Error loading " + index, e);
} catch (RuntimeException e) {
errorOccurred = true;
throw new AlertvizException("Error loading " + index, e);
} finally {
closeResultSet(rs);
closeStatement(statement);
if (errorOccurred) {
closeConnection();
}
}
}
public StatusMessage[] load(int count) throws AlertvizException { public StatusMessage[] load(int count) throws AlertvizException {
ResultSet rs = null; ResultSet rs = null;
Statement statement = null; Statement statement = null;
@ -383,15 +425,16 @@ public class LogMessageDAO {
boolean errorOccurred = false; boolean errorOccurred = false;
try { try {
Connection conn = getConnection(); Connection conn = getConnection();
if (order == Order.BEFORE) if (order == Order.BEFORE) {
statement = conn statement = conn
.prepareStatement(SELECT_ALL_BY_DATE_AND_SOURCE_BEFORE); .prepareStatement(SELECT_ALL_BY_DATE_AND_SOURCE_BEFORE);
else if (order == Order.AFTER) } else if (order == Order.AFTER) {
statement = conn statement = conn
.prepareStatement(SELECT_ALL_BY_DATE_AND_SOURCE_AFTER); .prepareStatement(SELECT_ALL_BY_DATE_AND_SOURCE_AFTER);
else } else {
throw new IllegalArgumentException("Unsupported order : " throw new IllegalArgumentException("Unsupported order : "
+ order); + order);
}
statement.setMaxFieldSize(count); statement.setMaxFieldSize(count);
statement.setTimestamp(1, filter); statement.setTimestamp(1, filter);
@ -477,7 +520,12 @@ public class LogMessageDAO {
} }
} }
public int[] getLogRange() throws AlertvizException { /**
* Retrieves the number of status messages in the message store.
*
* @return Total number of messages.
*/
public int getMessageCount() throws AlertvizException {
ResultSet rs = null; ResultSet rs = null;
Statement statement = null; Statement statement = null;
boolean errorOccurred = false; boolean errorOccurred = false;
@ -485,15 +533,12 @@ public class LogMessageDAO {
Connection conn = getConnection(); Connection conn = getConnection();
statement = conn.createStatement(); statement = conn.createStatement();
statement.setMaxFieldSize(1); statement.setMaxFieldSize(1);
rs = statement.executeQuery(DATA_RANGE_QUERY); rs = statement.executeQuery(MESSAGE_COUNT_QUERY);
if (rs.next()) { if (rs.next()) {
int min = rs.getInt(1); int count = rs.getInt(1);
int max = rs.getInt(2); return count;
return new int[] { min, max };
} }
conn.commit(); conn.commit();
return null;
} catch (SQLException e) { } catch (SQLException e) {
errorOccurred = true; errorOccurred = true;
throw new AlertvizException("Error getting time range ", e); throw new AlertvizException("Error getting time range ", e);
@ -504,6 +549,8 @@ public class LogMessageDAO {
closeConnection(); closeConnection();
} }
} }
return 0;
} }
public Timestamp getLastPurgeTime() throws AlertvizException { public Timestamp getLastPurgeTime() throws AlertvizException {
@ -547,8 +594,9 @@ public class LogMessageDAO {
sm.setAcknowledgedBy(rs.getString(8)); sm.setAcknowledgedBy(rs.getString(8));
Timestamp ts = rs.getTimestamp(9); Timestamp ts = rs.getTimestamp(9);
if (ts != null) if (ts != null) {
sm.setAcknowledgedAt(new Date(ts.getTime())); sm.setAcknowledgedAt(new Date(ts.getTime()));
}
retVal.add(sm); retVal.add(sm);
} }

View file

@ -40,6 +40,6 @@
id="org.apache.commons.compress" id="org.apache.commons.compress"
download-size="0" download-size="0"
install-size="0" install-size="0"
version="1.5.0"/> version="1.10.0"/>
</feature> </feature>

View file

@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Archive Bundle-Name: Archive
Bundle-SymbolicName: com.raytheon.uf.viz.archive;singleton:=true Bundle-SymbolicName: com.raytheon.uf.viz.archive;singleton:=true
Bundle-Version: 1.14.0.qualifier Bundle-Version: 1.15.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.ui;bundle-version="3.8.2", Require-Bundle: org.eclipse.ui;bundle-version="3.8.2",
org.eclipse.core.runtime, org.eclipse.core.runtime,
org.apache.commons.lang;bundle-version="2.3.0", org.apache.commons.lang3;bundle-version="3.4.0",
org.apache.commons.io;bundle-version="2.4.0", org.apache.commons.io;bundle-version="2.4.0",
com.raytheon.viz.ui;bundle-version="1.12.1174", com.raytheon.viz.ui;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174", com.raytheon.uf.common.serialization;bundle-version="1.12.1174",

View file

@ -49,7 +49,7 @@ import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConstants; import com.raytheon.uf.common.archive.config.ArchiveConstants;
import com.raytheon.uf.common.archive.config.CategoryConfig; import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.archive.config.DisplayData; import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.util.SizeUtil; import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.ArchiveInfo; import com.raytheon.uf.viz.archive.data.ArchiveInfo;
import com.raytheon.uf.viz.archive.data.CategoryInfo; import com.raytheon.uf.viz.archive.data.CategoryInfo;
@ -83,6 +83,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 10, 2014 3023 rferrel Added setTotalSelectedSize method. * Apr 10, 2014 3023 rferrel Added setTotalSelectedSize method.
* Apr 23, 2014 3045 rferrel Changes to prevent race condition while getting labels. * Apr 23, 2014 3045 rferrel Changes to prevent race condition while getting labels.
* Aug 26, 2014 3553 rferrel Force redisplay of table after getting all display labels. * Aug 26, 2014 3553 rferrel Force redisplay of table after getting all display labels.
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* *
* </pre> * </pre>
* *
@ -473,7 +474,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
String fileName = ArchiveConstants.selectFileName(type, selectName); String fileName = ArchiveConstants.selectFileName(type, selectName);
try { try {
manager.deleteSelection(fileName); manager.deleteSelection(fileName);
} catch (LocalizationOpFailedException e) { } catch (LocalizationException e) {
MessageDialog.openError(shell, "Case Error", MessageDialog.openError(shell, "Case Error",
"Unable to delete file: " + fileName); "Unable to delete file: " + fileName);
} }
@ -819,6 +820,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
* *
* @param startTimeOffset * @param startTimeOffset
*/ */
@Override
public void setRetentionTimes(long startTimeOffset) { public void setRetentionTimes(long startTimeOffset) {
// do nothing override by sub-classes // do nothing override by sub-classes
} }
@ -858,6 +860,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
/** /**
* Perform updates once all the display data is loaded. * Perform updates once all the display data is loaded.
*/ */
@Override
public void loadedAllDisplayData() { public void loadedAllDisplayData() {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {

View file

@ -24,7 +24,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;

View file

@ -80,6 +80,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Aug 14, 2014 3523 mapeters Updated deprecated {@link DrawableString#textStyle} * Aug 14, 2014 3523 mapeters Updated deprecated {@link DrawableString#textStyle}
* assignments. * assignments.
* Jul 7, 2015 10352 byin Added SymbolLoader to plot symbols * Jul 7, 2015 10352 byin Added SymbolLoader to plot symbols
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
* </pre> * </pre>
* *
* @author bsteffen * @author bsteffen
@ -194,7 +195,7 @@ public class AdvisoryResource extends
if (font != null) { if (font != null) {
font.dispose(); font.dispose();
} }
this.font = target.initializeFont("Monospace", 10, new Style[] {}); this.font = target.initializeFont("Monospace", 8, new Style[] {});
this.symbolLoader = new SymbolLoader(); this.symbolLoader = new SymbolLoader();
} }

View file

@ -29,8 +29,6 @@ import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.bufrsigwx.SigWxData; import com.raytheon.uf.common.dataplugin.bufrsigwx.SigWxData;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.pointdata.PointDataView;
@ -56,6 +54,8 @@ import com.raytheon.viz.pointdata.PointDataRequest;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 28, 2009 3099 bsteffen Initial creation * Sep 28, 2009 3099 bsteffen Initial creation
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
* Feb 04, 2015 5309 tgurney Remove dependency on dataURI
* *
* </pre> * </pre>
* *
@ -155,7 +155,7 @@ public abstract class SigWxResource extends
if (font != null) { if (font != null) {
font.dispose(); font.dispose();
} }
this.font = target.initializeFont("Monospace", 10, this.font = target.initializeFont("Monospace", 8,
new Style[] { Style.BOLD }); new Style[] { Style.BOLD });
} }
@ -167,21 +167,11 @@ public abstract class SigWxResource extends
* @throws VizException * @throws VizException
*/ */
protected void updateRecords(DataTime dataTime) throws VizException { protected void updateRecords(DataTime dataTime) throws VizException {
RequestConstraint constraint = new RequestConstraint();
constraint.setConstraintType(ConstraintType.IN);
for (SigWxData record : recordsToParse.get(dataTime)) {
constraint.addToConstraintValueList(record.getDataURI());
}
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>();
constraints.put("dataURI", constraint);
// Request the point data // Request the point data
PointDataContainer pdc = PointDataRequest.requestPointDataAllLevels( PointDataContainer pdc = PointDataRequest.requestPointDataAllLevels(
dataTime, resourceData.getMetadataMap().get("pluginName") dataTime, resourceData.getMetadataMap().get("pluginName")
.getConstraintValue(), getParameters(), null, .getConstraintValue(), getParameters(), null,
constraints); resourceData.getMetadataMap());
if (recordsToDisplay.containsKey(dataTime)) { if (recordsToDisplay.containsKey(dataTime)) {
recordsToDisplay.get(dataTime).combine(pdc); recordsToDisplay.get(dataTime).combine(pdc);
} else { } else {

View file

@ -100,6 +100,13 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.text.subscription"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.edex.ndm" id="com.raytheon.uf.edex.ndm"
download-size="0" download-size="0"

View file

@ -27,6 +27,18 @@
install-size="0" install-size="0"
version="0.0.0"/> version="0.0.0"/>
<plugin
id="org.w3c.xml.ext"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="org.apache.xmlgraphics"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin <plugin
id="org.apache.batik" id="org.apache.batik"
download-size="0" download-size="0"
@ -94,4 +106,10 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="org.apache.commons.ssl"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature> </feature>

View file

@ -81,6 +81,8 @@ import com.vividsolutions.jts.geom.Polygon;
* compabilities. * compabilities.
* May 11, 2015 4379 nabowle Display all current CWAs for each frame. * May 11, 2015 4379 nabowle Display all current CWAs for each frame.
* Jun 15, 2015 4379 nabowle Make last frame a live frame. * Jun 15, 2015 4379 nabowle Make last frame a live frame.
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
*
* </pre> * </pre>
* *
* @author jsanchez * @author jsanchez
@ -186,11 +188,11 @@ public class CWAResource extends
constraints.put(END, constraint); constraints.put(END, constraint);
// Request the point data // Request the point data
this.pdc = PointDataRequest this.pdc = PointDataRequest.requestPointDataAllLevels(
.requestPointDataAllLevels((DataTime) null, (DataTime) null,
resourceData.getMetadataMap().get("pluginName") resourceData.getMetadataMap().get("pluginName")
.getConstraintValue(), .getConstraintValue(), getParameters(), null,
getParameters(), null, constraints); constraints);
if (wfs != null) { if (wfs != null) {
wfs.dispose(); wfs.dispose();
@ -424,7 +426,7 @@ public class CWAResource extends
@Override @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
this.font = target.initializeFont("Monospace", 11, this.font = target.initializeFont("Monospace", 9,
new Style[] { Style.ITALIC }); new Style[] { Style.ITALIC });
updateLiveFrame(now()); updateLiveFrame(now());
scheduleRefreshTask(this); scheduleRefreshTask(this);

View file

@ -72,7 +72,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 16JUN2009 2037 dhladky Initial Creation. * 16JUN2009 2037 dhladky Initial Creation.
* Apr 17, 2013 1916 njensen Overrode getDataTimes() * Apr 17, 2013 1916 njensen Overrode getDataTimes()
* * Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
* *
* </pre> * </pre>
* *
@ -180,7 +180,7 @@ public class CWATResource extends
@Override @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
if (this.font == null) { if (this.font == null) {
this.font = target.initializeFont("Dialog", 11, null); this.font = target.initializeFont("Dialog", 9, null);
} }
init = true; init = true;
} }

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Core Plug-in Bundle-Name: Core Plug-in
Bundle-SymbolicName: com.raytheon.uf.viz.d2d.core;singleton:=true Bundle-SymbolicName: com.raytheon.uf.viz.d2d.core;singleton:=true
Bundle-Version: 1.14.0.qualifier Bundle-Version: 1.15.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui, org.eclipse.ui,
@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0", com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0",
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174", com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174",
com.raytheon.viz.ui;bundle-version="1.12.1174", com.raytheon.viz.ui;bundle-version="1.12.1174",
org.apache.commons.lang;bundle-version="2.3.0" org.apache.commons.lang3;bundle-version="3.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.d2d.core, Export-Package: com.raytheon.uf.viz.d2d.core,

View file

@ -35,7 +35,7 @@
categoryId="com.raytheon.uf.viz.core.theme.d2d" categoryId="com.raytheon.uf.viz.core.theme.d2d"
id="com.raytheon.uf.viz.d2d.core.map.D2DColorBarResourceFont" id="com.raytheon.uf.viz.d2d.core.map.D2DColorBarResourceFont"
label="D2D Colorbar Font" label="D2D Colorbar Font"
value="Monospace-regular-11"> value="Monospace-regular-9">
<description> <description>
Colorbar font for D2D Colorbar font for D2D
</description> </description>
@ -53,7 +53,7 @@
categoryId="com.raytheon.uf.viz.core.theme.d2d" categoryId="com.raytheon.uf.viz.core.theme.d2d"
id="com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource" id="com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource"
label="D2D Legend Font" label="D2D Legend Font"
value="Monospace-bold-14"> value="Monospace-bold-12">
<description> <description>
Legend font for D2D Legend font for D2D
</description> </description>
@ -62,7 +62,7 @@
categoryId="com.raytheon.uf.viz.core.theme.d2d" categoryId="com.raytheon.uf.viz.core.theme.d2d"
id="com.raytheon.uf.viz.d2d.core.sampling.D2DSamplingResource" id="com.raytheon.uf.viz.d2d.core.sampling.D2DSamplingResource"
label="Sampling Font" label="Sampling Font"
value="Monospaced-bold-12"> value="Monospace-bold-10">
<description> <description>
The sampling font for D2D The sampling font for D2D
</description> </description>

View file

@ -74,6 +74,7 @@ import com.raytheon.viz.ui.actions.DummyAction;
* Aug 2, 2013 DR 16427 Qinglu Lin (David's approach) Changing InputPriority.SYSTEM_RESOURCE to * Aug 2, 2013 DR 16427 Qinglu Lin (David's approach) Changing InputPriority.SYSTEM_RESOURCE to
* InputPriority.SYSTEM_RESOURCE_LOW in initInternal(). * InputPriority.SYSTEM_RESOURCE_LOW in initInternal().
* Jun 30, 2015 RM14663 kshresth Font size increased for Contour labels. * Jun 30, 2015 RM14663 kshresth Font size increased for Contour labels.
* Nov 05, 2015 5070 randerso Removed incorrect magnification limits
* *
* </pre> * </pre>
* *
@ -508,7 +509,8 @@ public class D2DLegendResource extends
* by being added later, runs before the changeModelHandler. See * by being added later, runs before the changeModelHandler. See
* InputManager.handeMouseXxx. * InputManager.handeMouseXxx.
*/ */
rc.registerMouseHandler(changeModeHandler, InputPriority.SYSTEM_RESOURCE_LOW); rc.registerMouseHandler(changeModeHandler,
InputPriority.SYSTEM_RESOURCE_LOW);
rc.registerMouseHandler(legendHandler, rc.registerMouseHandler(legendHandler,
InputPriority.SYSTEM_RESOURCE_LOW); InputPriority.SYSTEM_RESOURCE_LOW);
} }
@ -572,8 +574,8 @@ public class D2DLegendResource extends
private float getScaledMagnification() { private float getScaledMagnification() {
float magnification = getCapability(MagnificationCapability.class) float magnification = getCapability(MagnificationCapability.class)
.getMagnification().floatValue(); .getMagnification().floatValue();
if (magnification < 0.9f) { if (magnification < 0.6f) {
magnification = 1.0f; magnification = 0.6f;
} else if (magnification > 1.0f) { } else if (magnification > 1.0f) {
magnification = 1 + (magnification / 4.0f); magnification = 1 + (magnification / 4.0f);
} }

View file

@ -28,7 +28,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.AbstractTimeMatcher; import com.raytheon.uf.viz.core.AbstractTimeMatcher;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.VizConstants;
@ -41,13 +40,10 @@ import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay; import com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay;
import com.raytheon.uf.viz.core.maps.scales.MapScalesManager;
import com.raytheon.uf.viz.core.maps.scales.MapScalesManager.ManagedMapScale;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.IResourceGroup;
import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener; import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.d2d.core.D2DProperties; import com.raytheon.uf.viz.d2d.core.D2DProperties;
@ -61,18 +57,21 @@ import com.raytheon.viz.core.imagery.ImageCombiner;
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ---------- -------------------------------------------
* Feb 09, 2009 njensen Initial creation * Feb 09, 2009 1960 njensen Initial creation
* Mar 21, 2013 1638 mschenke Made map scales not tied to d2d * Mar 21, 2013 1638 mschenke Made map scales not tied to d2d
* Mar 22, 2013 1638 mschenke Moved map scale code to MapScaleRenderableDisplay * Mar 22, 2013 1638 mschenke Moved map scale code to
* Apr 06, 2015 ASM #17215 D. Friedman Implement clear to avoid removing time match basis * MapScaleRenderableDisplay
* Apr 06, 2015 17215 dfriedman Implement clear to avoid removing time
* match basis
* Sep 03, 2015 4779 njensen Removed DataScale references * Sep 03, 2015 4779 njensen Removed DataScale references
* Dec 03, 2015 5147 bsteffen Reset TimeMatcher on clear
* *
* </pre> * </pre>
* *
* @author njensen * @author njensen
* @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement @XmlRootElement
@ -313,65 +312,21 @@ public class D2DMapRenderableDisplay extends MapScaleRenderableDisplay
} }
/** /**
* Like MapScaleRenderableDisplayer.clear, but avoids removing the time * Replace the time matcher with a copy before clearing. The existing time
* match basis until other resources are removed. This reduces time matching * matcher is carefully tracking information for the resources(especially
* churn and reduces the chances of lockups. * the time match basis), replacing the timeMatcher saves time updating or
* * removing the saved information since the resources will all be removed
* @see com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay#clear() * anyway.
*/ */
@Override @Override
public void clear() { public void clear() {
AbstractVizResource<?, ?> timeMatchBasis = null;
AbstractTimeMatcher timeMatcher = descriptor.getTimeMatcher(); AbstractTimeMatcher timeMatcher = descriptor.getTimeMatcher();
if (timeMatcher instanceof D2DTimeMatcher) { if (timeMatcher instanceof D2DTimeMatcher) {
timeMatchBasis = ((D2DTimeMatcher) timeMatcher).getTimeMatchBasis(); D2DTimeMatcher newTimeMatcher = new D2DTimeMatcher();
} timeMatcher.copyFrom(newTimeMatcher);
ManagedMapScale scale = MapScalesManager.getInstance().getScaleByName( descriptor.setTimeMatcher(newTimeMatcher);
getScaleName());
if (scale != null) {
ResourceList list = descriptor.getResourceList();
for (ResourcePair rp : list) {
if (rp.getProperties().isSystemResource() == false) {
// Keep system resources
if (rp.getResource() != timeMatchBasis) {
list.remove(rp);
}
}
}
if (timeMatchBasis != null) {
list.removeRsc(timeMatchBasis);
}
loadScale(scale);
} else {
// Map scale could not be found, default to remove all
// non-map/system layers and reset display
ResourceList list = descriptor.getResourceList();
for (ResourcePair rp : list) {
ResourceProperties props = rp.getProperties();
if (props.isMapLayer() == false
&& props.isSystemResource() == false) {
if (rp.getResource() != timeMatchBasis) {
list.remove(rp);
}
} else {
try {
props.setVisible(true);
rp.getResource().recycle();
} catch (Throwable e) {
props.setVisible(false);
statusHandler.handle(Priority.PROBLEM, "Clear error: "
+ e.getMessage() + ":: The resource ["
+ rp.getResource().getSafeName()
+ "] has been disabled.", e);
}
}
}
if (timeMatchBasis != null) {
list.removeRsc(timeMatchBasis);
}
scaleToClientArea(getBounds());
} }
super.clear();
} }
} }

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 20, 2010 mschenke Initial creation * Dec 20, 2010 mschenke Initial creation
* Aug 04, 2014 3489 mapeters Updated deprecated getStringBounds() calls. * Aug 04, 2014 3489 mapeters Updated deprecated getStringBounds() calls.
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
* *
* </pre> * </pre>
* *
@ -131,12 +132,10 @@ public class D2DSelectedPaneResource extends
/ paintProps.getCanvasBounds().height; / paintProps.getCanvasBounds().height;
stringL.basics.x = stringI.basics.x = plus.basics.x = paintProps stringL.basics.x = stringI.basics.x = plus.basics.x = paintProps
.getView() .getView().getExtent().getMinX()
.getExtent().getMinX()
+ (LEFT_OFFSET * ratioX); + (LEFT_OFFSET * ratioX);
stringL.basics.y = stringI.basics.y = plus.basics.y = paintProps stringL.basics.y = stringI.basics.y = plus.basics.y = paintProps
.getView() .getView().getExtent().getMaxY()
.getExtent().getMaxY()
- (BOTTOM_OFFSET * ratioY); - (BOTTOM_OFFSET * ratioY);
if (editor.getNumberofPanes() > 1 if (editor.getNumberofPanes() > 1
@ -178,7 +177,7 @@ public class D2DSelectedPaneResource extends
*/ */
@Override @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
font = target.initializeFont(Font.MONOSPACED, 24, font = target.initializeFont(Font.MONOSPACED, 20,
new Style[] { Style.BOLD }); new Style[] { Style.BOLD });
stringL = new DrawableString("L", L_COLOR); stringL = new DrawableString("L", L_COLOR);

View file

@ -28,12 +28,15 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import org.apache.commons.lang.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -47,7 +50,6 @@ import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.comm.PerspectiveSpecificLoadProperties; import com.raytheon.uf.viz.core.comm.PerspectiveSpecificLoadProperties;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
@ -71,28 +73,29 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ---------- -------------------------------------------
* Feb 10, 2009 chammack Initial creation * Feb 10, 2009 1959 chammack Initial creation
* Jul 03, 2013 2159 bsteffen Synchronize TimeCache access. * Jul 03, 2013 2159 bsteffen Synchronize TimeCache access.
* Aug 9, 2013 16448 D. Friedman Validate time match basis in * Aug 09, 2013 16448 dfriedman Validate time match basis in
* redoTimeMatching * redoTimeMatching
* May 5, 2014 17201 D. Friedman Make same-radar time matching work more * May 05, 2014 17201 dfriedman Make same-radar time matching work more
* like A1. * like A1.
* May 5, 2014 3265 bsteffen Better handling of resources returning * May 05, 2014 3265 bsteffen Better handling of resources returning null
* null dataTimes. * dataTimes.
* May 13, 2015 4461 bsteffen Move the logic to change frames into the * May 13, 2015 4461 bsteffen Move the logic to change frames into the
* FrameCoordinator. * FrameCoordinator.
* Jul 14, 2015 DR 13900 D. Friedman Validate descriptor of time match basis * Jul 14, 2015 13900 dfriedman Validate descriptor of time match basis
* before time matching it. * before time matching it.
* Jul 30, 2015 17761 D. Friedman Allow resources to return data times based * Jul 30, 2015 17761 dfriedman Allow resources to return data times based
* on base frame times. * on base frame times.
* Sep 10, 2015 4856 njensen Removed unnecessary code * Sep 10, 2015 4856 njensen Removed unnecessary code
* Dec 03, 2015 5147 bsteffen Make timeMatchBasis atomic.
* *
* </pre> * </pre>
* *
* @author chammack * @author chammack
* @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class D2DTimeMatcher extends AbstractTimeMatcher { public class D2DTimeMatcher extends AbstractTimeMatcher {
@ -108,7 +111,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* The last set of times that the resource with these properties was * The last set of times that the resource with these properties was
* matched against. As long as we are matching against these same times * matched against. As long as we are matching against these same times
* then lastFrameTimes is valid. * then lastFrameTimes is valid. This will be null for the
* TimeMatchBasis.
*/ */
private DataTime[] lastBaseTimes; private DataTime[] lastBaseTimes;
@ -144,21 +148,21 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
/** /**
* the rsc that determines the frame times to be displayed, i.e. other * The resource that determines the frame times to be displayed, i.e. other
* resources on the same descriptor will time match against the * resources on the same descriptor will time match against the
* timeMatchBasis * timeMatchBasis. This is an atomic reference to allow safe concurrent
* modification. It is never safe to assume that 2 calls to get will return
* the same value so complex operations(such as redoTimeMatching) will need
* to get a reference to the basis once at the beginning of the operation
* and use that reference throughout the operation.
*/ */
protected transient AbstractVizResource<?, ?> timeMatchBasis; protected final AtomicReference<AbstractVizResource<?, ?>> timeMatchBasisRef = new AtomicReference<>();
private final IDisposeListener timeMatchBasisDisposeListener = new IDisposeListener() { private final IDisposeListener timeMatchBasisDisposeListener = new IDisposeListener() {
@Override @Override
public void disposed(AbstractVizResource<?, ?> resource) { public void disposed(AbstractVizResource<?, ?> resource) {
if ((resource == timeMatchBasis)) { timeMatchBasisRef.compareAndSet(resource, null);
synchronized (D2DTimeMatcher.this) {
timeMatchBasis = null;
}
}
} }
}; };
@ -187,9 +191,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
private final Map<AbstractVizResource<?, ?>, TimeCache> timeCacheMap = new IdentityHashMap<AbstractVizResource<?, ?>, D2DTimeMatcher.TimeCache>(); private final Map<AbstractVizResource<?, ?>, TimeCache> timeCacheMap = new IdentityHashMap<AbstractVizResource<?, ?>, D2DTimeMatcher.TimeCache>();
/**
* Default Constructor.
*/
public D2DTimeMatcher() { public D2DTimeMatcher() {
super(); super();
try { try {
@ -218,9 +219,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* Checks if a resource is contained in the {@link IResourceGroup} * Checks if a resource is contained in the {@link IResourceGroup}
* recursively checking for {@link IResourceGroup}s in the group's list * recursively checking for {@link IResourceGroup}s in the group's list
* *
* @param group
* @param resource
* @return
*/ */
private boolean contained(IResourceGroup group, private boolean contained(IResourceGroup group,
AbstractVizResource<?, ?> resource) { AbstractVizResource<?, ?> resource) {
@ -241,52 +239,40 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
@Override @Override
public void redoTimeMatching(IDescriptor descriptor) throws VizException { public void redoTimeMatching(IDescriptor descriptor) {
synchronized (this) { synchronized (this) {
if ((timeMatchBasis != null) /* Find the times for the time match basis. */
&& (timeMatchBasis.getDescriptor() == descriptor) Pair<AbstractVizResource<?, ?>, DataTime[]> basisInfo = findBasisTimes(descriptor);
&& !validateTimeMatchBasis(descriptor)) { if (basisInfo == null) {
changeTimeMatchBasis(null);
}
if (timeMatchBasis != null) {
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
if (tmDescriptor != null) {
if (tmDescriptor != descriptor
&& tmDescriptor.getTimeMatcher() == this
&& hasContainer(descriptor)) {
if (validateDescriptor(tmDescriptor)) {
redoTimeMatching(tmDescriptor);
} else {
changeTimeMatchBasis(null);
}
} else if (contained(tmDescriptor, timeMatchBasis) == false) {
// Checks to ensure the timeMatchBasis is not "orphaned"
timeMatchBasis = null;
}
}
}
// Find the times for the time match basis.
DataTime[] timeSteps = findBasisTimes(descriptor.getResourceList(),
descriptor.getNumberOfFrames());
if (timeSteps == null) {
descriptor.setFramesInfo(new FramesInfo(null, -1)); descriptor.setFramesInfo(new FramesInfo(null, -1));
return; return;
} }
AbstractVizResource<?, ?> timeMatchBasis = basisInfo.getLeft();
DataTime[] timeSteps = basisInfo.getRight();
Map<AbstractVizResource<?, ?>, DataTime[]> resourceTimeMap = new HashMap<AbstractVizResource<?, ?>, DataTime[]>(); Map<AbstractVizResource<?, ?>, DataTime[]> resourceTimeMap = new HashMap<AbstractVizResource<?, ?>, DataTime[]>();
resourceTimeMap.put(timeMatchBasis, timeSteps); resourceTimeMap.put(timeMatchBasis, timeSteps);
// Find times for every other resource /* Find the times for the time match basis. */
Iterator<ResourcePair> pairIterator = descriptor.getResourceList() Iterator<ResourcePair> pairIterator = descriptor.getResourceList()
.listIterator(); .listIterator();
while (pairIterator.hasNext()) { while (pairIterator.hasNext()) {
AbstractVizResource<?, ?> rsc = pairIterator.next() AbstractVizResource<?, ?> rsc = pairIterator.next()
.getResource(); .getResource();
recursiveOverlay(descriptor, new FramesInfo(timeSteps, -1, recursiveOverlay(descriptor, timeMatchBasis, new FramesInfo(
resourceTimeMap), rsc, resourceTimeMap); timeSteps, -1, resourceTimeMap), rsc, resourceTimeMap);
} }
// Update the descriptor to the new times. if (descriptor.getTimeMatcher() != this) {
/*
* The descriptor has switched to a new time matcher so the
* results of this operation are no longer relevant and are
* discarded. This can happen when the display is cleared.
*/
return;
}
/* Update the descriptor to the new times. */
if ((timeMatchBasis.getDescriptor() != null) if ((timeMatchBasis.getDescriptor() != null)
&& (timeMatchBasis.getDescriptor() != descriptor)) { && (timeMatchBasis.getDescriptor() != descriptor)) {
int idx = timeMatchBasis.getDescriptor().getFramesInfo() int idx = timeMatchBasis.getDescriptor().getFramesInfo()
@ -303,7 +289,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
resourceTimeMap)); resourceTimeMap));
} }
// Add Remove data for all the resources. /* Add Remove data for all the resources. */
for (Entry<AbstractVizResource<?, ?>, DataTime[]> entry : resourceTimeMap for (Entry<AbstractVizResource<?, ?>, DataTime[]> entry : resourceTimeMap
.entrySet()) { .entrySet()) {
if (entry.getKey().getDescriptor() == descriptor) { if (entry.getKey().getDescriptor() == descriptor) {
@ -319,17 +305,22 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* *
* @param descriptor * @param descriptor
* the descriptor that is being updated * the descriptor that is being updated
* @param timeMatchBasis
* the current timeMatchBasis, used to ensure that it is not time
* matched again, even if it is located in a IResourceGroup
* @param framesInfo
* the matched times for the rsc passed in will be added to the
* map of this FramesInfo
* @param rsc * @param rsc
* the resource being updated. * the resource being updated.
* @param frameTimesSoure * @param frameTimesSoure
* map of all previously time matched resources that may be used * map of all previously time matched resources that may be used
* to determine the frame times * to determine the frame times
* @throws VizException
*/ */
private void recursiveOverlay(IDescriptor descriptor, private void recursiveOverlay(IDescriptor descriptor,
FramesInfo framesInfo, AbstractVizResource<?, ?> rsc, AbstractVizResource<?, ?> timeMatchBasis, FramesInfo framesInfo,
Map<AbstractVizResource<?, ?>, DataTime[]> frameTimesSoure) AbstractVizResource<?, ?> rsc,
throws VizException { Map<AbstractVizResource<?, ?>, DataTime[]> frameTimesSoure) {
if (rsc == null) { if (rsc == null) {
return; return;
} }
@ -338,7 +329,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
frameTimesSoure); frameTimesSoure);
for (ResourcePair rp : ((IResourceGroup) rsc).getResourceList()) { for (ResourcePair rp : ((IResourceGroup) rsc).getResourceList()) {
AbstractVizResource<?, ?> rsc1 = rp.getResource(); AbstractVizResource<?, ?> rsc1 = rp.getResource();
recursiveOverlay(descriptor, framesInfo, rsc1, completed); recursiveOverlay(descriptor, timeMatchBasis, framesInfo, rsc1,
completed);
} }
} }
@ -347,8 +339,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
.getLoadProperties()); .getLoadProperties());
TimeCache timeCache = getTimeCache(rsc); TimeCache timeCache = getTimeCache(rsc);
synchronized (timeCache) { synchronized (timeCache) {
DataTime[] timeSteps = getFrameTimes(descriptor, framesInfo, DataTime[] timeSteps = getFrameTimes(descriptor,
frameTimesSoure); timeMatchBasis, framesInfo, frameTimesSoure);
if (Arrays.equals(timeSteps, timeCache.getLastBaseTimes())) { if (Arrays.equals(timeSteps, timeCache.getLastBaseTimes())) {
framesInfo.getTimeMap().put(rsc, framesInfo.getTimeMap().put(rsc,
timeCache.getLastFrameTimes()); timeCache.getLastFrameTimes());
@ -378,15 +370,10 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* Determine the times to match this resource against, for single panel this * Determine the times to match this resource against, for single panel this
* is the timeMatchBasisTimes, for four panel it is a bit more complex. * is the timeMatchBasis times, for four panel it is a bit more complex.
*
* @param descriptor
* @param frameInfo
* @param frameTimesSoure
* @return
*/ */
private DataTime[] getFrameTimes(IDescriptor descriptor, private DataTime[] getFrameTimes(IDescriptor descriptor,
FramesInfo frameInfo, AbstractVizResource<?, ?> timeMatchBasis, FramesInfo frameInfo,
Map<AbstractVizResource<?, ?>, DataTime[]> frameTimesSource) { Map<AbstractVizResource<?, ?>, DataTime[]> frameTimesSource) {
DataTime[] descTimes = frameInfo.getFrameTimes(); DataTime[] descTimes = frameInfo.getFrameTimes();
if ((timeMatchBasis != null) if ((timeMatchBasis != null)
@ -394,17 +381,19 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
return descTimes; return descTimes;
} }
// If the time match basis is not in this descriptor we should instead /*
// fall back on the first resource in this descriptor which has times * If the time match basis is not in this descriptor we should instead
// for this frame. This concept was adopted from Frame::dataTime() in * fall back on the first resource in this descriptor which has times
// the A1 source. * for this frame. This concept was adopted from Frame::dataTime() in
* the A1 source.
*/
DataTime[] times = new DataTime[frameInfo.getFrameCount()]; DataTime[] times = new DataTime[frameInfo.getFrameCount()];
for (ResourcePair rp : descriptor.getResourceList()) { for (ResourcePair rp : descriptor.getResourceList()) {
DataTime[] rscTimes = frameTimesSource.get(rp.getResource()); DataTime[] rscTimes = frameTimesSource.get(rp.getResource());
if ((rscTimes == null) || (rscTimes.length != times.length)) { if ((rscTimes == null) || (rscTimes.length != times.length)) {
if (rp.getResource() instanceof IResourceGroup) { if (rp.getResource() instanceof IResourceGroup) {
// Descend into resource groups. /* Descend into resource groups. */
for (ResourcePair rp1 : ((IResourceGroup) rp.getResource()) for (ResourcePair rp1 : ((IResourceGroup) rp.getResource())
.getResourceList()) { .getResourceList()) {
rscTimes = frameTimesSource.get(rp1.getResource()); rscTimes = frameTimesSource.get(rp1.getResource());
@ -437,16 +426,48 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* Attempts to find the frame times for a time match basis, if time match * Attempts to find the frame times for a time match basis, if time match
* basis is not defined attempts to find a new time match basis. Returns * basis is not defined attempts to find a new time match basis. Returns
* null if no Time Match basis can be found. * null if no Time Match basis can be found. This method will update the
* * {@link #timeMatchBasisRef} if needed.
* @param descriptor
* @param resourceList
* @return
* @throws VizException
*/ */
private DataTime[] findBasisTimes(ResourceList resourceList, private Pair<AbstractVizResource<?, ?>, DataTime[]> findBasisTimes(
int numberOfFrames) throws VizException { IDescriptor descriptor) {
if (timeMatchBasis != null) { int numberOfFrames = descriptor.getNumberOfFrames();
AbstractVizResource<?, ?> timeMatchBasis = timeMatchBasisRef.get();
if (timeMatchBasis == null) {
Pair<AbstractVizResource<?, ?>, DataTime[]> pair = findNewBasis(
descriptor.getResourceList(), numberOfFrames);
if (pair != null) {
AbstractVizResource<?, ?> rsc = pair.getLeft();
configureBasis(rsc);
if (!timeMatchBasisRef.compareAndSet(null, rsc)) {
unconfigureBasis(rsc);
}
}
return pair;
}
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
if ((tmDescriptor == descriptor)
&& !validateTimeMatchBasis(descriptor, timeMatchBasis)) {
changeTimeMatchBasis(null);
return findBasisTimes(descriptor);
}
if (tmDescriptor != null) {
if (tmDescriptor != descriptor
&& tmDescriptor.getTimeMatcher() == this
&& hasContainer(descriptor)) {
if (validateDescriptor(tmDescriptor)) {
redoTimeMatching(tmDescriptor);
} else {
changeTimeMatchBasis(null);
return findBasisTimes(descriptor);
}
} else if (contained(tmDescriptor, timeMatchBasis) == false) {
/* Checks to ensure the timeMatchBasis is not "orphaned" */
timeMatchBasisRef.compareAndSet(timeMatchBasis, null);
return findBasisTimes(descriptor);
}
}
TimeCache timeCache = getTimeCache(timeMatchBasis); TimeCache timeCache = getTimeCache(timeMatchBasis);
DataTime[] times = null; DataTime[] times = null;
synchronized (timeCache) { synchronized (timeCache) {
@ -458,11 +479,32 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
} }
if (times != null) { if (times != null) {
return times; return new ImmutablePair<AbstractVizResource<?, ?>, DataTime[]>(
timeMatchBasis, times);
} else { } else {
timeMatchBasis = null; /*
* This might fail if another thread has assigned a basis while this
* method was looking for one. In this case the current operation
* will proceed with the wrong basis. Proceed anyway since the basis
* that was chosen would have been the correct basis when this
* method began. Whatever operation set the basis should have
* initiated redoTimeMatching which will run after this and assign
* times with the new basis.
*/
timeMatchBasisRef.compareAndSet(timeMatchBasis, null);
return findBasisTimes(descriptor);
} }
} }
/**
* Recursive operation to search for a resource that is able to be the time
* match basis. Returns the resource and the matched times for that
* resource. If no resources is able to be the timeMatchBasis then null is
* returned. This method does not actually change {@link #timeMatchBasisRef}
* .
*/
public Pair<AbstractVizResource<?, ?>, DataTime[]> findNewBasis(
ResourceList resourceList, int numberOfFrames) {
Iterator<ResourcePair> pairIterator = resourceList.iterator(); Iterator<ResourcePair> pairIterator = resourceList.iterator();
while (pairIterator.hasNext()) { while (pairIterator.hasNext()) {
ResourcePair pair = pairIterator.next(); ResourcePair pair = pairIterator.next();
@ -476,13 +518,12 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
if (rsc.getResourceData() instanceof IResourceGroup) { if (rsc.getResourceData() instanceof IResourceGroup) {
DataTime[] times = findBasisTimes( IResourceGroup group = (IResourceGroup) rsc.getResourceData();
((IResourceGroup) rsc.getResourceData()) Pair<AbstractVizResource<?, ?>, DataTime[]> resultPair = findNewBasis(
.getResourceList(), group.getResourceList(), numberOfFrames);
numberOfFrames);
if (times != null) { if (resultPair != null) {
return times; return resultPair;
} }
} else { } else {
DataTime[] times = makeEmptyLoadList(numberOfFrames, rsc); DataTime[] times = makeEmptyLoadList(numberOfFrames, rsc);
@ -491,7 +532,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
synchronized (cache) { synchronized (cache) {
cache.setTimes(null, times, numberOfFrames); cache.setTimes(null, times, numberOfFrames);
} }
return times; return new ImmutablePair<AbstractVizResource<?, ?>, DataTime[]>(
rsc, times);
} }
} }
} }
@ -499,21 +541,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
/** /**
* Make an empty load list for a resource, if this is successful the * Make an empty load list for a resource. Only a time match basis should
* resource will be defined as the time match basis * use this method for getting matched times.
*
* @param descriptor
* @param rsc
* @return
* @throws VizException
*/ */
private DataTime[] makeEmptyLoadList(int numberOfFrames, private DataTime[] makeEmptyLoadList(int numberOfFrames,
AbstractVizResource<?, ?> rsc) throws VizException { AbstractVizResource<?, ?> rsc) {
if ((timeMatchBasis != null) && (rsc != timeMatchBasis)) {
throw new IllegalArgumentException(
"Cannot make Empty Load List for a resource which is not the Time Match Basis.");
}
TimeMatchingConfiguration config = getConfiguration( TimeMatchingConfiguration config = getConfiguration(
rsc.getLoadProperties()).clone(); rsc.getLoadProperties()).clone();
if ((config.getDataTimes() == null) if ((config.getDataTimes() == null)
@ -531,19 +563,14 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
if ((timeSteps == null) || (timeSteps.length == 0)) { if ((timeSteps == null) || (timeSteps.length == 0)) {
return null; return null;
} }
changeTimeMatchBasis(rsc);
return timeSteps; return timeSteps;
} }
/** /**
* Remove unused times from a resource and add in any new times. * Remove unused times from a resource and add in any new times.
*
* @param rsc
* @param timeSteps
* @throws VizException
*/ */
private void timeMatchUpdate(AbstractVizResource<?, ?> rsc, private void timeMatchUpdate(AbstractVizResource<?, ?> rsc,
DataTime[] timeSteps) throws VizException { DataTime[] timeSteps) {
if (rsc.getResourceData() instanceof IResourceGroup) { if (rsc.getResourceData() instanceof IResourceGroup) {
for (ResourcePair tmp : ((IResourceGroup) rsc.getResourceData()) for (ResourcePair tmp : ((IResourceGroup) rsc.getResourceData())
@ -562,9 +589,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* Find the Time Matching Configuration for this resource. If one can't be * Find the Time Matching Configuration for this resource. If one can't be
* found, return an empty configuration. * found, return an empty configuration.
*
* @param properties
* @return
*/ */
private TimeMatchingConfiguration getConfiguration(LoadProperties properties) { private TimeMatchingConfiguration getConfiguration(LoadProperties properties) {
if (properties == null) { if (properties == null) {
@ -582,6 +606,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
return new TimeMatchingConfiguration(); return new TimeMatchingConfiguration();
} }
/**
* Thread safe access to {@link #timeCacheMap}. If the map has no entry for
* this resource then a new {@link TimeCache} is created, added to the map,
* and returned.
*/
private TimeCache getTimeCache(AbstractVizResource<?, ?> resource) { private TimeCache getTimeCache(AbstractVizResource<?, ?> resource) {
synchronized (timeCacheMap) { synchronized (timeCacheMap) {
TimeCache cache = timeCacheMap.get(resource); TimeCache cache = timeCacheMap.get(resource);
@ -596,8 +625,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* Populates all unset fields of the configuration with defaults except * Populates all unset fields of the configuration with defaults except
* dataTimes, dataTimes should be set before calling this function. * dataTimes, dataTimes should be set before calling this function.
*
* @param config
*/ */
private void populateConfiguration(TimeMatchingConfiguration config) { private void populateConfiguration(TimeMatchingConfiguration config) {
Arrays.sort(config.getDataTimes()); Arrays.sort(config.getDataTimes());
@ -626,29 +653,33 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
/** /**
* Retrieves the latest times from a time sequence resource * Retrieves the latest times from a resource
* *
* If the resource is also requestable, we check the catalog for the latest * If the resource data is an {@link AbstractRequestableResourceData} then
* product times. * this will query for the available times.
* *
* @param rsc
* @param timeSteps
* @return
* @throws VizException
*/ */
protected DataTime[] getLatestTimes(AbstractVizResource<?, ?> rsc, protected DataTime[] getLatestTimes(AbstractVizResource<?, ?> rsc,
DataTime[] timeSteps) throws VizException { DataTime[] timeSteps) {
DataTime[] availableTimes = null; DataTime[] availableTimes = null;
// If resource is handling requests itself, just return the datatimes /*
// listed in the resource * If resource is handling requests itself, just return the datatimes
* listed in the resource
*/
AbstractResourceData resourceData = rsc.getResourceData(); AbstractResourceData resourceData = rsc.getResourceData();
if (resourceData instanceof AbstractRequestableResourceData) { if (resourceData instanceof AbstractRequestableResourceData) {
AbstractRequestableResourceData req = (AbstractRequestableResourceData) resourceData; AbstractRequestableResourceData req = (AbstractRequestableResourceData) resourceData;
if (req.isRequeryNecessaryOnTimeMatch() if (req.isRequeryNecessaryOnTimeMatch()
|| (rsc.getDataTimes() == null) || (rsc.getDataTimes() == null)
|| (rsc.getDataTimes().length == 0)) { || (rsc.getDataTimes().length == 0)) {
try {
availableTimes = req.getAvailableTimes(); availableTimes = req.getAvailableTimes();
} catch (VizException e) {
statusHandler
.error("Unable to query times for "
+ rsc.getSafeName(), e);
}
} }
} }
@ -662,7 +693,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* Prunes data that is no longer used by calling * Prunes data that is no longer used by calling
* AbstractVizResource.remove(DataTime). * {@link AbstractVizResource#remove(DataTime)}
* *
* @param rsc * @param rsc
* the resource to prune * the resource to prune
@ -715,10 +746,9 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* available dataTimes * available dataTimes
* @param resource * @param resource
* the resource to update * the resource to update
* @throws VizException
*/ */
private void updateResourceWithLatest(DataTime[] dataTimes, private void updateResourceWithLatest(DataTime[] dataTimes,
AbstractVizResource<?, ?> resource) throws VizException { AbstractVizResource<?, ?> resource) {
Validate.notNull(resource, "Resource must not be null"); Validate.notNull(resource, "Resource must not be null");
if (resource.getResourceData() == null) { if (resource.getResourceData() == null) {
return; return;
@ -735,11 +765,17 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* place to break things. * place to break things.
*/ */
Arrays.sort(dt, new DataTimeComparator()); Arrays.sort(dt, new DataTimeComparator());
PluginDataObject[] pdo = arrd.getLatestPluginDataObjects(dataTimes, try {
dt); PluginDataObject[] pdo = arrd.getLatestPluginDataObjects(
dataTimes, dt);
if (pdo.length > 0) { if (pdo.length > 0) {
resource.getResourceData().update(pdo); resource.getResourceData().update(pdo);
} }
} catch (VizException e) {
statusHandler.error(
"Unable to update data for " + resource.getSafeName(),
e);
}
} }
} }
@ -747,40 +783,40 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override @Override
public void handleRemove(AbstractVizResource<?, ?> resource, public void handleRemove(AbstractVizResource<?, ?> resource,
IDescriptor descriptor) { IDescriptor descriptor) {
if ((resource == timeMatchBasis) timeMatchBasisRef.compareAndSet(resource, null);
&& (descriptor instanceof AbstractDescriptor)) {
synchronized (this) {
timeMatchBasis = null;
}
}
synchronized (timeCacheMap) { synchronized (timeCacheMap) {
timeCacheMap.remove(resource); timeCacheMap.remove(resource);
} }
} }
/**
* @return the loadMode
*/
public LoadMode getLoadMode() { public LoadMode getLoadMode() {
return loadMode; return loadMode;
} }
/**
* @param loadMode
* the loadMode to set
*/
public void setLoadMode(LoadMode loadMode) { public void setLoadMode(LoadMode loadMode) {
this.loadMode = loadMode; this.loadMode = loadMode;
} }
/**
* Attempt to match the provided availableTimes against the current state of
* the time matcher. This can be used while loading a resource to determine
* if any matching times are possible and for preloading any data for those
* times.
*
* This method is also responsible for using the
* AbstractTimeMatchingConfigurationFactory for this matcher to configure
* the time match settings. The final times the resource displays may change
* if other resources are being loaded concurrently. When a resource is done
* loading {@link #redoTimeMatching(IDescriptor)} must be used to properly
* add the resource to the {@link FramesInfo} of the {@link IDescriptor}.
*/
@Override @Override
public DataTime[] initialLoad(LoadProperties loadProps, public DataTime[] initialLoad(LoadProperties loadProps,
DataTime[] availableTimes, IDescriptor descriptor) DataTime[] availableTimes, IDescriptor descriptor)
throws VizException { throws VizException {
DataTime[] dataTimesToLoad = null; DataTime[] dataTimesToLoad = null;
TimeMatchingConfiguration config = null; TimeMatchingConfiguration config = null;
AbstractVizResource<?, ?> timeMatchBasis = timeMatchBasisRef.get();
if (timeMatchBasis == null) { if (timeMatchBasis == null) {
config = configFactory.getConfiguration(loadProps, this, config = configFactory.getConfiguration(loadProps, this,
availableTimes, descriptor); availableTimes, descriptor);
@ -810,8 +846,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
} }
populateConfiguration(config); populateConfiguration(config);
DataTime[] existingDataTimes = getFrameTimes(descriptor, DataTime[] existingDataTimes = getFrameTimes(descriptor,
descriptor.getFramesInfo(), descriptor.getFramesInfo() timeMatchBasis, descriptor.getFramesInfo(), descriptor
.getTimeMap()); .getFramesInfo().getTimeMap());
TimeMatcher tm = new TimeMatcher(); TimeMatcher tm = new TimeMatcher();
dataTimesToLoad = tm.makeOverlayList(config.getDataTimes(), dataTimesToLoad = tm.makeOverlayList(config.getDataTimes(),
@ -821,7 +857,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
if ((timeMatchBasis.getDescriptor() != null) if ((timeMatchBasis.getDescriptor() != null)
&& (timeMatchBasis.getDescriptor() != descriptor)) { && (timeMatchBasis.getDescriptor() != descriptor)) {
// Still use my times, but the index from the time match basis /* Still use my times, but the index from the time match basis */
FramesInfo myFi = descriptor.getFramesInfo(); FramesInfo myFi = descriptor.getFramesInfo();
FramesInfo tmFi = timeMatchBasis.getDescriptor() FramesInfo tmFi = timeMatchBasis.getDescriptor()
.getFramesInfo(); .getFramesInfo();
@ -836,90 +872,77 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/** /**
* Changes the time match basis for the time matcher to be the specified * Changes the time match basis for the time matcher to be the specified
* resource * resource
*
* @param resource
*/ */
public void changeTimeMatchBasis(AbstractVizResource<?, ?> resource) { public void changeTimeMatchBasis(AbstractVizResource<?, ?> resource) {
if (timeMatchBasis != resource) { if (resource != null) {
if (timeMatchBasis != null) { configureBasis(resource);
TimeMatchingConfiguration config = getConfiguration(timeMatchBasis
.getLoadProperties());
config.setTimeMatchBasis(false);
TimeCache timeCache = getTimeCache(timeMatchBasis);
synchronized (timeCache) {
timeCache.setTimes(null, null);
}
timeMatchBasis
.unregisterListener(timeMatchBasisDisposeListener);
}
timeMatchBasis = resource;
if (timeMatchBasis != null) {
TimeMatchingConfiguration config = getConfiguration(timeMatchBasis
.getLoadProperties());
config.setTimeMatchBasis(true);
TimeCache timeCache = getTimeCache(timeMatchBasis);
synchronized (timeCache) {
timeCache.setTimes(null, null);
}
timeMatchBasis.registerListener(timeMatchBasisDisposeListener);
} }
AbstractVizResource<?, ?> prev = timeMatchBasisRef.getAndSet(resource);
if (prev != null) {
unconfigureBasis(prev);
} }
} }
/** /**
* Returns the time match basis for the D2DTimeMatcher * Used to setup the {@link TimeMatchingConfiguration} and
* * {@link #timeMatchBasisDisposeListener} for a new timeMatchBasis. This
* @return * should be used before modifying the {@link TimeMatchBasisRef}.
*/ */
private void configureBasis(AbstractVizResource<?, ?> newBasis) {
TimeMatchingConfiguration config = getConfiguration(newBasis
.getLoadProperties());
config.setTimeMatchBasis(true);
TimeCache timeCache = getTimeCache(newBasis);
synchronized (timeCache) {
timeCache.setTimes(null, null);
}
newBasis.registerListener(timeMatchBasisDisposeListener);
}
/**
* Used to revert the {@link TimeMatchingConfiguration} and
* {@link #timeMatchBasisDisposeListener} when a timeMatchBasis is removed.
* This should be used after modifying the {@link TimeMatchBasisRef}.
*/
private void unconfigureBasis(AbstractVizResource<?, ?> oldBasis) {
TimeMatchingConfiguration config = getConfiguration(oldBasis
.getLoadProperties());
config.setTimeMatchBasis(false);
TimeCache timeCache = getTimeCache(oldBasis);
synchronized (timeCache) {
timeCache.setTimes(null, null);
}
oldBasis.unregisterListener(timeMatchBasisDisposeListener);
}
public AbstractVizResource<?, ?> getTimeMatchBasis() { public AbstractVizResource<?, ?> getTimeMatchBasis() {
return timeMatchBasis; return timeMatchBasisRef.get();
} }
public boolean hasTimeMatchBasis() { public boolean hasTimeMatchBasis() {
return (timeMatchBasis != null); return (timeMatchBasisRef.get() != null);
} }
/**
* @return the clockFilter
*/
public Date getClockFilter() { public Date getClockFilter() {
return clockFilter; return clockFilter;
} }
/**
* @return the forecastFilter
*/
public long getForecastFilter() { public long getForecastFilter() {
return forecastFilter; return forecastFilter;
} }
/**
* @return the deltaFilter
*/
public long getDeltaFilter() { public long getDeltaFilter() {
return deltaFilter; return deltaFilter;
} }
/**
* @return the isTimeOptionsSelected
*/
public boolean isTimeOptionsSelected() { public boolean isTimeOptionsSelected() {
return isTimeOptionsSelected; return isTimeOptionsSelected;
} }
/**
* @param isTimeOptionsSelected
* the isTimeOptionsSelected to set
*/
public void setTimeOptionsSelected(boolean isTimeOptionsSelected) { public void setTimeOptionsSelected(boolean isTimeOptionsSelected) {
this.isTimeOptionsSelected = isTimeOptionsSelected; this.isTimeOptionsSelected = isTimeOptionsSelected;
} }
/**
* @return the dataTimeDialogManager
*/
public AbstractTimeMatchingConfigurationFactory getTimeMatchingConfigurationFactory() { public AbstractTimeMatchingConfigurationFactory getTimeMatchingConfigurationFactory() {
return configFactory; return configFactory;
} }
@ -927,7 +950,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override @Override
public List<AbstractRenderableDisplay> getDisplayLoadOrder( public List<AbstractRenderableDisplay> getDisplayLoadOrder(
List<AbstractRenderableDisplay> displays) { List<AbstractRenderableDisplay> displays) {
// if any of the displays have a set time match basis then load it first /* if any of the displays have a set time match basis then load it first */
AbstractRenderableDisplay basisDisplay = null; AbstractRenderableDisplay basisDisplay = null;
for (AbstractRenderableDisplay display : displays) { for (AbstractRenderableDisplay display : displays) {
if (getBasisResourcePair(display.getDescriptor().getResourceList()) != null) { if (getBasisResourcePair(display.getDescriptor().getResourceList()) != null) {
@ -947,8 +970,10 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override @Override
public List<ResourcePair> getResourceLoadOrder(List<ResourcePair> resources) { public List<ResourcePair> getResourceLoadOrder(List<ResourcePair> resources) {
// if any of the resources are set as the time match basis then load it /*
// first * if any of the resources are set as the time match basis then load it
* first
*/
ResourcePair basisPair = getBasisResourcePair(resources); ResourcePair basisPair = getBasisResourcePair(resources);
if (basisPair != null) { if (basisPair != null) {
List<ResourcePair> results = new ArrayList<ResourcePair>(resources); List<ResourcePair> results = new ArrayList<ResourcePair>(resources);
@ -979,7 +1004,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
public void copyFrom(AbstractTimeMatcher timeMatcher) { public void copyFrom(AbstractTimeMatcher timeMatcher) {
if (timeMatcher instanceof D2DTimeMatcher) { if (timeMatcher instanceof D2DTimeMatcher) {
D2DTimeMatcher d2d = (D2DTimeMatcher) timeMatcher; D2DTimeMatcher d2d = (D2DTimeMatcher) timeMatcher;
if (timeMatchBasis == null) { if (timeMatchBasisRef.get() == null) {
this.clockFilter = d2d.clockFilter; this.clockFilter = d2d.clockFilter;
this.forecastFilter = d2d.forecastFilter; this.forecastFilter = d2d.forecastFilter;
this.deltaFilter = d2d.deltaFilter; this.deltaFilter = d2d.deltaFilter;
@ -994,7 +1019,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
configFactory.resetMultiload(); configFactory.resetMultiload();
} }
private boolean validateTimeMatchBasis(IDescriptor descriptor) { private static boolean validateTimeMatchBasis(IDescriptor descriptor,
AbstractVizResource<?, ?> timeMatchBasis) {
/* /*
* If a resource is shared by multiple panels (this can be the case with * If a resource is shared by multiple panels (this can be the case with
* tools, at least), then it is necessary to search all of them as * tools, at least), then it is necessary to search all of them as
@ -1010,18 +1036,21 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
IDescriptor paneDescriptor = paneDisplay != null ? paneDisplay IDescriptor paneDescriptor = paneDisplay != null ? paneDisplay
.getDescriptor() : null; .getDescriptor() : null;
if ((paneDescriptor != null) if ((paneDescriptor != null)
&& validateTimeMatchBasis(paneDescriptor && validateTimeMatchBasis(
.getResourceList())) { paneDescriptor.getResourceList(),
timeMatchBasis)) {
return true; return true;
} }
} }
} else { } else {
return validateTimeMatchBasis(descriptor.getResourceList()); return validateTimeMatchBasis(descriptor.getResourceList(),
timeMatchBasis);
} }
return false; return false;
} }
private boolean validateTimeMatchBasis(ResourceList list) { private static boolean validateTimeMatchBasis(ResourceList list,
AbstractVizResource<?, ?> timeMatchBasis) {
for (ResourcePair rp : list) { for (ResourcePair rp : list) {
AbstractVizResource<?, ?> rsc = rp.getResource(); AbstractVizResource<?, ?> rsc = rp.getResource();
if (rsc == timeMatchBasis) { if (rsc == timeMatchBasis) {
@ -1031,8 +1060,9 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
continue; continue;
} else if ((rsc != null) } else if ((rsc != null)
&& (rsc.getResourceData() instanceof IResourceGroup)) { && (rsc.getResourceData() instanceof IResourceGroup)) {
if (validateTimeMatchBasis(((IResourceGroup) rsc IResourceGroup group = (IResourceGroup) rsc.getResourceData();
.getResourceData()).getResourceList())) { if (validateTimeMatchBasis(group.getResourceList(),
timeMatchBasis)) {
return true; return true;
} }
} }
@ -1045,7 +1075,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
return display.getContainer() != null; return display.getContainer() != null;
} }
private boolean validateDescriptor(IDescriptor descriptor) { private static boolean validateDescriptor(IDescriptor descriptor) {
IRenderableDisplay display = descriptor.getRenderableDisplay(); IRenderableDisplay display = descriptor.getRenderableDisplay();
IDisplayPaneContainer container = display != null ? display IDisplayPaneContainer container = display != null ? display
.getContainer() : null; .getContainer() : null;
@ -1054,10 +1084,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
IRenderableDisplay paneDisplay = pane.getRenderableDisplay(); IRenderableDisplay paneDisplay = pane.getRenderableDisplay();
IDescriptor paneDescriptor = paneDisplay != null ? paneDisplay IDescriptor paneDescriptor = paneDisplay != null ? paneDisplay
.getDescriptor() : null; .getDescriptor() : null;
if (paneDescriptor == descriptor) if (paneDescriptor == descriptor) {
return true; return true;
} }
} }
}
return false; return false;
} }

View file

@ -31,7 +31,7 @@
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Bethel, AK (PABE)" id="raobRarotonga" menuText="Bethel, AK (PABE)" id="raobBethel_AK"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="70219"/> <substitute key="stationId" value="70219"/>
</contribute> </contribute>
@ -86,7 +86,7 @@
<substitute key="stationId" value="70133"/> <substitute key="stationId" value="70133"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="St. Paul Island, AK (PASN)" id="raobSTPaulIsland_AK" menuText="St. Paul Island, AK (PASN)" id="raobStPaulIsland_AK"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="70308"/> <substitute key="stationId" value="70308"/>
</contribute> </contribute>

View file

@ -77,13 +77,13 @@
<substitute key="stationId" value="78970"/> <substitute key="stationId" value="78970"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Howard AFB, PM (MPHO)" id="raobHowardAFB_PM " menuText="Howard AFB, PM (MPHO)" id="raobHowardAFB_PM"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="78806"/> <substitute key="stationId" value="78806"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Guantanamo Bay, CU (MUGM)" id="raobPortland_ME" menuText="Guantanamo Bay, CU (MUGM)" id="raobGuantanamoBay_CU"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="78367"/> <substitute key="stationId" value="78367"/>
</contribute> </contribute>
@ -108,12 +108,12 @@
<substitute key="stationId" value="81405"/> <substitute key="stationId" value="81405"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Le Ralset, Guadeloupe (TFFR)" id="LeRalset_Guadeloupe" menuText="Le Ralset, Guadeloupe (TFFR)" id="raobLeRalset_Guadeloupe"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="78897"/> <substitute key="stationId" value="78897"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="San Juan, PR (TJSJ)" id="raobWashington_DC" menuText="San Juan, PR (TJSJ)" id="raobSanJuan_PR"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="78526"/> <substitute key="stationId" value="78526"/>
</contribute> </contribute>

View file

@ -20,7 +20,7 @@
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Willis Island (94299)" id="raobWillis Island" menuText="Willis Island (94299)" id="raobWillisIsland"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="94299"/> <substitute key="stationId" value="94299"/>
</contribute> </contribute>
@ -155,7 +155,7 @@
<substitute key="stationId" value="94750"/> <substitute key="stationId" value="94750"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Sydney Arpt (YSSY)" id="raobSydney Arpt" menuText="Sydney Arpt (YSSY)" id="raobSydneyArpt"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="94767"/> <substitute key="stationId" value="94767"/>
</contribute> </contribute>

View file

@ -70,7 +70,7 @@
<substitute key="stationId" value="71907"/> <substitute key="stationId" value="71907"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Yarmouth, NS (CYQI)" id="raobAtlanta_GA" menuText="Yarmouth, NS (CYQI)" id="raobYarmouth_NS"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="71603"/> <substitute key="stationId" value="71603"/>
</contribute> </contribute>
@ -95,7 +95,7 @@
<substitute key="stationId" value="71801"/> <substitute key="stationId" value="71801"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Toronto Int'l, ON (CYYZ)" id="raobTorontoIntl_ON " menuText="Toronto Int'l, ON (CYYZ)" id="raobTorontoIntl_ON"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="71624"/> <substitute key="stationId" value="71624"/>
</contribute> </contribute>

View file

@ -158,7 +158,7 @@
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Ishigakijima (ROIG)" id="raobIshigakijima " menuText="Ishigakijima (ROIG)" id="raobIshigakijima"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="47918"/> <substitute key="stationId" value="47918"/>
</contribute> </contribute>
@ -168,7 +168,7 @@
<substitute key="stationId" value="47945"/> <substitute key="stationId" value="47945"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Clark AFB (RPMK)" id="raobClearkAFB" menuText="Clark AFB (RPMK)" id="raobClarkAFB"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="98327"/> <substitute key="stationId" value="98327"/>
</contribute> </contribute>

View file

@ -30,12 +30,12 @@
<substitute key="stationId" value="76840"/> <substitute key="stationId" value="76840"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Ciudad Del Carmen, MX (MCME)" id="raobCiudadDelCarmen_MX " menuText="Ciudad Del Carmen, MX (MCME)" id="raobCiudadDelCarmen_MX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="76749"/> <substitute key="stationId" value="76749"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Ciudad Victoria, MX (MCVM)" id="raobCiudadVictoria_MX " menuText="Ciudad Victoria, MX (MCVM)" id="raobCiudadVictoria_MX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="76225"/> <substitute key="stationId" value="76225"/>
</contribute> </contribute>
@ -45,7 +45,7 @@
<substitute key="stationId" value="76649"/> <substitute key="stationId" value="76649"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Isle of Guadalupe, MX (MILS)" id="raobIsleofGuadalupe_MX " menuText="Isle of Guadalupe, MX (MILS)" id="raobIsleofGuadalupe_MX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="76151"/> <substitute key="stationId" value="76151"/>
</contribute> </contribute>
@ -70,12 +70,12 @@
<substitute key="stationId" value="76361"/> <substitute key="stationId" value="76361"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Chihuahua, MX (MMCU)" id="raobChihuahua_MX " menuText="Chihuahua, MX (MMCU)" id="raobChihuahua_MX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="76225"/> <substitute key="stationId" value="76225"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Mexico/Central, MX (MMDF)" id="raobCentral, MX" menuText="Mexico/Central, MX (MMDF)" id="raobCentral_MX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="76679"/> <substitute key="stationId" value="76679"/>
</contribute> </contribute>

View file

@ -81,7 +81,7 @@
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Midway Island (Navy) (PMDY)" id="raobPortland_ME" menuText="Midway Island (Navy) (PMDY)" id="raobMidwayIs"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="91066"/> <substitute key="stationId" value="91066"/>
</contribute> </contribute>

View file

@ -25,7 +25,7 @@
<substitute key="stationId" value="99027"/> <substitute key="stationId" value="99027"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Honiara (AGGH)" id="raobHonlara" menuText="Honiara (AGGH)" id="raobHoniara"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="91517"/> <substitute key="stationId" value="91517"/>
</contribute> </contribute>
@ -72,12 +72,12 @@
<substitute key="stationId" value="91592"/> <substitute key="stationId" value="91592"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Guam/Taguac, GU (PGAC)" id="raobTaguac_GU " menuText="Guam/Taguac, GU (PGAC)" id="raobTaguac_GU"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="91217"/> <substitute key="stationId" value="91217"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Guam/Anderson AFB, GU (PGUA)" id="raobAndersonAFB_GU " menuText="Guam/Anderson AFB, GU (PGUA)" id="raobAndersonAFB_GU"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="91218"/> <substitute key="stationId" value="91218"/>
</contribute> </contribute>
@ -122,7 +122,7 @@
<substitute key="stationId" value="91413"/> <substitute key="stationId" value="91413"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Wake Island (PWAK)" id="raobWake Island" menuText="Wake Island (PWAK)" id="raobWakeIsland"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="91245"/> <substitute key="stationId" value="91245"/>
</contribute> </contribute>

View file

@ -20,7 +20,7 @@
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Mys Uzlen (25399)" id="raobMys Uzlen" menuText="Mys Uzlen (25399)" id="raobMysUzlen"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="25399"/> <substitute key="stationId" value="25399"/>
</contribute> </contribute>
@ -135,12 +135,12 @@
<substitute key="stationId" value="21824"/> <substitute key="stationId" value="21824"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Anadyr' (UHMA)" id="raobnadyr'" menuText="Anadyr (UHMA)" id="raobAnadyr"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="25563"/> <substitute key="stationId" value="25563"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Bukhta Provideniya (UHMD)" id="raobBukhta Provideniya" menuText="Bukhta Provideniya (UHMD)" id="raobBukhtaProvideniya"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="25594"/> <substitute key="stationId" value="25594"/>
</contribute> </contribute>

View file

@ -65,7 +65,7 @@
<substitute key="stationId" value="72364"/> <substitute key="stationId" value="72364"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Fort Worth, TX (KFWD)" id="raobFortWorth_TX " menuText="Fort Worth, TX (KFWD)" id="raobFortWorth_TX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72249"/> <substitute key="stationId" value="72249"/>
</contribute> </contribute>
@ -100,7 +100,7 @@
<substitute key="stationId" value="72340"/> <substitute key="stationId" value="72340"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Midland, TX (KMAF)" id="raobSanNicholasIsland_CA" menuText="Midland, TX (KMAF)" id="raobMidland_TX"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72265"/> <substitute key="stationId" value="72265"/>
</contribute> </contribute>
@ -115,7 +115,7 @@
<substitute key="stationId" value="72558"/> <substitute key="stationId" value="72558"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Oklahoma City, OK (KOUN)" id="raobOklahomaCity_OK " menuText="Oklahoma City, OK (KOUN)" id="raobOklahomaCity_OK"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72357"/> <substitute key="stationId" value="72357"/>
</contribute> </contribute>

View file

@ -165,7 +165,7 @@
<substitute key="stationId" value="72221"/> <substitute key="stationId" value="72221"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Wallops Island, VA (KWAL)" id="raobWallopsIsland_VA " menuText="Wallops Island, VA (KWAL)" id="raobWallopsIsland_VA"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72402"/> <substitute key="stationId" value="72402"/>
</contribute> </contribute>

View file

@ -35,12 +35,12 @@
<substitute key="stationId" value="74004"/> <substitute key="stationId" value="74004"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Yuma PG Site 2, AZ (K1Y8)" id="raobYuma_AZ" menuText="Yuma PG Site 2, AZ (K1Y8)" id="raobYumaPgSite2_AZ"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="74005"/> <substitute key="stationId" value="74005"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Yuma PG Site 3, AZ (K1Y9)" id="raobYuma_AZ" menuText="Yuma PG Site 3, AZ (K1Y9)" id="raobYumaPgSite3_AZ"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="74006"/> <substitute key="stationId" value="74006"/>
</contribute> </contribute>
@ -65,7 +65,7 @@
<substitute key="stationId" value="72387"/> <substitute key="stationId" value="72387"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Edwards AFB, CA (KEDW)" id="raobEdwardsAFB_CA " menuText="Edwards AFB, CA (KEDW)" id="raobEdwardsAFB_CA"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72381"/> <substitute key="stationId" value="72381"/>
</contribute> </contribute>
@ -130,7 +130,7 @@
<substitute key="stationId" value="74626"/> <substitute key="stationId" value="74626"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Reno, NV (KREV)" id="raobReno_NV " menuText="Reno, NV (KREV)" id="raobReno_NV"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="72489"/> <substitute key="stationId" value="72489"/>
</contribute> </contribute>

View file

@ -45,6 +45,11 @@
<constraint constraintValue="A" constraintType="EQUALS" /> <constraint constraintValue="A" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
<timeQueryMetadataMap>
<mapping key="pluginName">
<constraint constraintValue="svrwx" constraintType="EQUALS" />
</mapping>
</timeQueryMetadataMap>
</resourceData> </resourceData>
</resource> </resource>
<resource> <resource>
@ -69,6 +74,11 @@
<constraint constraintValue="W" constraintType="EQUALS" /> <constraint constraintValue="W" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
<timeQueryMetadataMap>
<mapping key="pluginName">
<constraint constraintValue="svrwx" constraintType="EQUALS" />
</mapping>
</timeQueryMetadataMap>
</resourceData> </resourceData>
</resource> </resource>
<resource> <resource>
@ -93,6 +103,11 @@
<constraint constraintValue="T" constraintType="EQUALS" /> <constraint constraintValue="T" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
<timeQueryMetadataMap>
<mapping key="pluginName">
<constraint constraintValue="svrwx" constraintType="EQUALS" />
</mapping>
</timeQueryMetadataMap>
</resourceData> </resourceData>
</resource> </resource>
</descriptor> </descriptor>

View file

@ -28,12 +28,12 @@
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/TrackSummaryPlot.xml" <contribute xsi:type="bundleItem" file="bundles/TrackSummaryPlot.xml"
menuText="E Pacific" id="easternPacificTrackSummary"> menuText="E Pacific" id="easternPacificTrackSummary">
<substitute key="productType" value="TCMEP1,TCMEP2,TCMEP3,TCMEP4,TCMEP5" /> <substitute key="productType" value="TCMEP1,TCMEP2,TCMEP3,TCMEP4,TCMEP5,TCMCP1,TCMCP2,TCMCP3,TCMCP4,TCMCP5" />
<substitute key="legend" value="E Pacific" /> <substitute key="legend" value="E Pacific" />
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/TrackSummaryPlot.xml" <contribute xsi:type="bundleItem" file="bundles/TrackSummaryPlot.xml"
menuText="W Pacific" id="westernPacificTrackSummary"> menuText="W Pacific" id="westernPacificTrackSummary">
<substitute key="productType" value="TCMWP1,TCMWP2,TCMWP3,TCMWP4,TCMWP5,TCP" /> <substitute key="productType" value="TCMCP1,TCMCP2,TCMCP3,TCMCP4,TCMCP5,TCMWP1,TCMWP2,TCMWP3,TCMWP4,TCMWP5,TCP" />
<substitute key="legend" value="W Pacific" /> <substitute key="legend" value="W Pacific" />
</contribute> </contribute>
<contribute xsi:type="subMenu" menuText="Hourly Forecasts"> <contribute xsi:type="subMenu" menuText="Hourly Forecasts">

View file

@ -19,12 +19,4 @@
further_licensing_information. further_licensing_information.
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" menuText="Added Features">
<contribute xsi:type="subMenu" menuText="Archive">
<contribute xsi:type="placeholder" menuText=" "/>
</contribute>
<contribute xsi:type="subMenu" menuText="Composite">
<contribute xsi:type="placeholder" menuText=" "/>
</contribute>
</contribute>
</menuTemplate> </menuTemplate>

View file

@ -98,7 +98,6 @@
<substitute key="legend" value="Sfc Profiler"/> <substitute key="legend" value="Sfc Profiler"/>
</contribute> </contribute>
</contribute> </contribute>
<contribute xsi:type="placeholder" <contribute xsi:type="separator" id="npnPerspective"/>
menuText="NPN Perspective" id="npnPerspective"/>
<contribute xsi:type="separator" id="MySeparatorId1"/> <contribute xsi:type="separator" id="MySeparatorId1"/>
</menuTemplate> </menuTemplate>

View file

@ -168,6 +168,5 @@
<substitute key="label" value="925mb"/> <substitute key="label" value="925mb"/>
</contribute> </contribute>
</contribute> </contribute>
<contribute xsi:type="placeholder" menuText="VWP perspective"/>
<contribute xsi:type="separator" id="MySeparatorId2"/> <contribute xsi:type="separator" id="MySeparatorId2"/>
</menuTemplate> </menuTemplate>

View file

@ -268,14 +268,42 @@
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet"> definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference> </reference>
</visibleWhen> </visibleWhen>
<separator <separator name="tools.A" visible="false" />
name="tools.start" <separator name="tools.B" visible="false" />
visible="false"> <separator name="tools.C" visible="false" />
</separator> <separator name="tools.Da" visible="false" />
<separator <separator name="tools.Di" visible="false" />
name="D2D.Tools.Additions" <separator name="tools.E" visible="false" />
visible="false"> <separator name="tools.Fa" visible="false" />
</separator> <separator name="tools.Fe" visible="false" />
<separator name="tools.Fs" visible="false" />
<separator name="tools.G" visible="false" />
<separator name="tools.H" visible="false" />
<separator name="tools.I" visible="false" />
<separator name="tools.J" visible="false" />
<separator name="tools.K" visible="false" />
<separator name="tools.L" visible="false" />
<separator name="tools.M" visible="false" />
<separator name="tools.N" visible="false" />
<separator name="tools.O" visible="false" />
<separator name="tools.Pa" visible="false" />
<separator name="tools.Pg" visible="false" />
<separator name="tools.Po" visible="false" />
<separator name="tools.Pu" visible="false" />
<separator name="tools.Q" visible="false" />
<separator name="tools.Raa" visible="false" />
<separator name="tools.Rad" visible="false" />
<separator name="tools.Ran" visible="false" />
<separator name="tools.S" visible="false" />
<separator name="tools.Ta" visible="false" />
<separator name="tools.Te" visible="false" />
<separator name="tools.Ti" visible="false" />
<separator name="tools.U" visible="false" />
<separator name="tools.V" visible="false" />
<separator name="tools.W" visible="false" />
<separator name="tools.X" visible="false" />
<separator name="tools.Y" visible="false" />
<separator name="tools.Z" visible="false" />
</menu> </menu>
<menu <menu
id="volume" id="volume"

View file

@ -24,9 +24,9 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -36,8 +36,6 @@ import com.raytheon.viz.ui.dialogs.localization.VizLocalizationFileListDlg;
import com.raytheon.viz.ui.dialogs.localization.VizLocalizationFileListDlg.Mode; import com.raytheon.viz.ui.dialogs.localization.VizLocalizationFileListDlg.Mode;
/** /**
* DeleteAWIPSProcedure
*
* Delete an AWIPS procedure * Delete an AWIPS procedure
* *
* <pre> * <pre>
@ -52,6 +50,8 @@ import com.raytheon.viz.ui.dialogs.localization.VizLocalizationFileListDlg.Mode;
* Jun 02, 2015 #4401 bkowal Updated to use {@link VizLocalizationFileListDlg}. * Jun 02, 2015 #4401 bkowal Updated to use {@link VizLocalizationFileListDlg}.
* Jun 30, 2015 #4401 bkowal Specify the localization type when constructing a * Jun 30, 2015 #4401 bkowal Specify the localization type when constructing a
* {@link VizLocalizationFileListDlg}. * {@link VizLocalizationFileListDlg}.
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -64,13 +64,6 @@ public class DeleteAWIPSProcedure extends AbstractHandler {
private VizLocalizationFileListDlg listDlg; private VizLocalizationFileListDlg listDlg;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
if (listDlg == null || listDlg.getShell() == null if (listDlg == null || listDlg.getShell() == null
@ -83,15 +76,15 @@ public class DeleteAWIPSProcedure extends AbstractHandler {
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
if (returnValue instanceof LocalizationFile) { if (returnValue instanceof ILocalizationFile) {
LocalizationFile selectedFile = (LocalizationFile) returnValue; ILocalizationFile selectedFile = (ILocalizationFile) returnValue;
try { try {
selectedFile.delete(); selectedFile.delete();
} catch (LocalizationOpFailedException e) { } catch (LocalizationException e) {
statusHandler.handle( statusHandler.handle(
Priority.PROBLEM, Priority.PROBLEM,
"Error deleting procedure: " "Error deleting procedure: "
+ selectedFile.getName()); + selectedFile.getPath());
} }
} }
} }

View file

@ -39,7 +39,9 @@ import com.raytheon.viz.ui.actions.AbstractGlobalsButtonHandler;
* Jul 23, 2007 randerso Initial Creation. * Jul 23, 2007 randerso Initial Creation.
* Sep 4, 2012 15335 kshresth Will now display lightning/wind * Sep 4, 2012 15335 kshresth Will now display lightning/wind
* fields when magnification set to 0 * fields when magnification set to 0
* &#064;author randerso * Nov 05, 2015 5070 randerso Removed override of 0.0 magnification
*
* @author randerso
* *
*/ */
public class MagButtonHandler extends AbstractGlobalsButtonHandler implements public class MagButtonHandler extends AbstractGlobalsButtonHandler implements
@ -53,7 +55,6 @@ public class MagButtonHandler extends AbstractGlobalsButtonHandler implements
protected void updateGlobalValue(IWorkbenchWindow changedWindow, protected void updateGlobalValue(IWorkbenchWindow changedWindow,
UIElement element, Object value) { UIElement element, Object value) {
Double mag = (Double) value; Double mag = (Double) value;
if (mag <= 0.1) mag=0.0;
element.setText("Mag: " + mag); element.setText("Mag: " + mag);
} }
} }

View file

@ -49,6 +49,7 @@ import com.raytheon.viz.ui.EditorUtil;
* Jul 19, 2007 randerso Initial Creation. * Jul 19, 2007 randerso Initial Creation.
* Sep 4, 2012 15335 kshresth Will now display lightning/wind * Sep 4, 2012 15335 kshresth Will now display lightning/wind
* fields when magnification set to 0 * fields when magnification set to 0
* Nov 05, 2015 5070 randerso Removed override of 0.0 magnification
* *
* </pre> * </pre>
* *
@ -73,8 +74,6 @@ public class MagHandler extends AbstractHandler implements IElementUpdater {
double magnification = Double.parseDouble((arg0 double magnification = Double.parseDouble((arg0
.getParameter("magnification"))); .getParameter("magnification")));
if (editor != null) { if (editor != null) {
if (magnification == 0.0f)
magnification = 0.1;
IDisplayPane[] panes = editor.getDisplayPanes(); IDisplayPane[] panes = editor.getDisplayPanes();
for (IDisplayPane pane : panes) { for (IDisplayPane pane : panes) {
IRenderableDisplay disp = pane.getRenderableDisplay(); IRenderableDisplay disp = pane.getRenderableDisplay();

View file

@ -36,7 +36,6 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.actions.LoadPerspectiveHandler; import com.raytheon.viz.ui.actions.LoadPerspectiveHandler;
import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.dialogs.localization.VizLocalizationFileListDlg;
import com.raytheon.viz.ui.dialogs.localization.VizOpenLocalizationFileListDlg; import com.raytheon.viz.ui.dialogs.localization.VizOpenLocalizationFileListDlg;
/** /**
@ -56,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.localization.VizOpenLocalizationFileListDlg;
* Jun 02, 2015 #4401 bkowal Updated to use {@link VizOpenLocalizationFileListDlg}. * Jun 02, 2015 #4401 bkowal Updated to use {@link VizOpenLocalizationFileListDlg}.
* Jun 30, 2015 #4401 bkowal Specify the localization type when constructing a * Jun 30, 2015 #4401 bkowal Specify the localization type when constructing a
* {@link VizOpenLocalizationFileListDlg}. * {@link VizOpenLocalizationFileListDlg}.
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -68,13 +68,6 @@ public class OpenAWIPSProcedure extends AbstractHandler {
private static final IUFStatusHandler log = UFStatus private static final IUFStatusHandler log = UFStatus
.getHandler(OpenAWIPSProcedure.class); .getHandler(OpenAWIPSProcedure.class);
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
@ -95,7 +88,7 @@ public class OpenAWIPSProcedure extends AbstractHandler {
log.info("Loading display file: " log.info("Loading display file: "
+ f.getAbsolutePath()); + f.getAbsolutePath());
ProcedureDlg.displayDialog(LocalizationUtil ProcedureDlg.displayDialog(LocalizationUtil
.extractName(selectedFile.getName()), p, .extractName(selectedFile.getPath()), p,
VizWorkbenchManager.getInstance() VizWorkbenchManager.getInstance()
.getCurrentWindow().getShell()); .getCurrentWindow().getShell());
} }

View file

@ -34,9 +34,9 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -62,6 +62,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction;
* Sep 13, 2010 mschenke Initial creation * Sep 13, 2010 mschenke Initial creation
* Oct 16, 2012 1229 rferrel Updated to use bringToTop to * Oct 16, 2012 1229 rferrel Updated to use bringToTop to
* activate existing dialog. * activate existing dialog.
* Jan 15, 2015 5054 randerso Remove unnecessary new Shell
* *
* </pre> * </pre>
* *
@ -110,8 +111,10 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
D2DMapRenderableDisplay[] displays) { D2DMapRenderableDisplay[] displays) {
ImageBlinkDialog dlg = dialogMap.get(resource); ImageBlinkDialog dlg = dialogMap.get(resource);
if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) { if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) {
dlg = new ImageBlinkDialog(new Shell(Display.getCurrent()), rates, Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
currRate, resource, rscProps, displays); .getShell();
dlg = new ImageBlinkDialog(shell, rates, currRate, resource,
rscProps, displays);
dialogMap.put(resource, dlg); dialogMap.put(resource, dlg);
dlg.open(); dlg.open();
} else { } else {

View file

@ -27,8 +27,7 @@ import java.awt.image.ComponentColorModel;
import java.awt.image.IndexColorModel; import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -63,12 +62,13 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner; import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; 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.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
@ -85,7 +85,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.editor.AbstractEditor;
/** /**
* TODO Add Description * Class representing a print dialog with various print settings.
* *
* <pre> * <pre>
* *
@ -94,12 +94,12 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 15, 2011 bkowal Initial creation * Feb 15, 2011 bkowal Initial creation
* ======================================
* AWIPS2 DR Work
* 08/15/2012 1053 jkorman Added capability to save/restore user * 08/15/2012 1053 jkorman Added capability to save/restore user
* print settings. * print settings.
* 10/12/2012 1229 rferrel Made dialog non-blocking. * 10/12/2012 1229 rferrel Made dialog non-blocking.
* 12/09/2014 ASM #11982 D. Friedman Fix print-to-file * 12/09/2014 ASM #11982 D. Friedman Fix print-to-file
* 01/11/2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
*
* *
* </pre> * </pre>
* *
@ -651,8 +651,8 @@ public class PrintDialog extends CaveSWTDialog {
} else if (this.fileRadioButton.getSelection()) { } else if (this.fileRadioButton.getSelection()) {
printerSettings.selectedPrinter = this.printToFileData; printerSettings.selectedPrinter = this.printToFileData;
printerSettings.selectedPrinter.printToFile = true; printerSettings.selectedPrinter.printToFile = true;
printerSettings.selectedPrinter.fileName = printerSettings.selectedPrinter.fileName = this.destinationFileText
this.destinationFileText.getText(); .getText();
} }
printerSettings.selectedPrinter.copyCount = this.copiesSpinner printerSettings.selectedPrinter.copyCount = this.copiesSpinner
.getSelection(); .getSelection();
@ -910,25 +910,15 @@ public class PrintDialog extends CaveSWTDialog {
LocalizationContext ctx = initUserLocalization(); LocalizationContext ctx = initUserLocalization();
// Get a list of localization files! // Get a list of localization files!
LocalizationFile f = PathManagerFactory.getPathManager() ILocalizationFile f = PathManagerFactory.getPathManager()
.getLocalizationFile(ctx, SETTINGS_FILENAME); .getLocalizationFile(ctx, SETTINGS_FILENAME);
OutputStream strm = null;
try { try (SaveableOutputStream strm = f.openOutputStream()) {
strm = f.openOutputStream();
JAXB.marshal(settings, strm); JAXB.marshal(settings, strm);
// Ensure that the file is saved on the server! // Ensure that the file is saved on the server!
f.save(); strm.save();
} catch (Exception e) { } catch (Exception e) {
statusHandler.error("Could not save user print settings", e); statusHandler.error("Could not save user print settings", e);
} finally {
if (f != null) {
try {
strm.close();
} catch (IOException ioe) {
statusHandler.error("Could not close user print settings",
ioe);
}
}
} }
} }
@ -940,15 +930,15 @@ public class PrintDialog extends CaveSWTDialog {
LocalizationContext ctx = initUserLocalization(); LocalizationContext ctx = initUserLocalization();
// Get a list of localization files! // Get a list of localization files!
LocalizationFile f = PathManagerFactory.getPathManager() ILocalizationFile f = PathManagerFactory.getPathManager()
.getLocalizationFile(ctx, SETTINGS_FILENAME); .getLocalizationFile(ctx, SETTINGS_FILENAME);
// If its not there, no previous settings have been saved. Just exit. // If its not there, no previous settings have been saved. Just exit.
if (f.exists()) { if (f.exists()) {
UserPrintSettings settings = null; UserPrintSettings settings = null;
try { try (InputStream strm = f.openInputStream()) {
settings = (UserPrintSettings) JAXB.unmarshal( settings = (UserPrintSettings) JAXB.unmarshal(strm,
f.openInputStream(), UserPrintSettings.class); UserPrintSettings.class);
} catch (Exception e) { } catch (Exception e) {
statusHandler.error( statusHandler.error(

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.viz.d2d.ui.dialogs.procedures; package com.raytheon.uf.viz.d2d.ui.dialogs.procedures;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -56,17 +55,17 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPartReference; import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; 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.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.DescriptorMap; import com.raytheon.uf.viz.core.DescriptorMap;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor; import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
@ -118,6 +117,7 @@ import com.raytheon.viz.ui.views.PartAdapter2;
* Mar 12, 2015 4204 njensen Ensure renamed bundle goes into tab name on next load * Mar 12, 2015 4204 njensen Ensure renamed bundle goes into tab name on next load
* Apr 08, 2015 4185 mapeters Disable Copy In when not applicable for active editor * Apr 08, 2015 4185 mapeters Disable Copy In when not applicable for active editor
* Jun 02, 2015 4401 bkowal Updated to use {@link VizLocalizationFileListDlg}. * Jun 02, 2015 4401 bkowal Updated to use {@link VizLocalizationFileListDlg}.
* Feb 12, 2016 5242 dgilling Remove calls to deprecated Localization APIs.
* *
* </pre> * </pre>
* *
@ -358,14 +358,6 @@ public class ProcedureDlg extends CaveSWTDialog {
ProcedureComm.getInstance().addCopyOutStateListener(changeListener); ProcedureComm.getInstance().addCopyOutStateListener(changeListener);
final ProcedureComm.ICopyOutListener copyOutListener = new ProcedureComm.ICopyOutListener() { final ProcedureComm.ICopyOutListener copyOutListener = new ProcedureComm.ICopyOutListener() {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.procedure.ProcedureComm.ICopyOutListener
* #copyOut(com.raytheon.viz.ui.dialogs.procedure.ProcedureComm.
* BundlePair, java.lang.Object)
*/
@Override @Override
public void copyOut(BundlePair b, Object src) { public void copyOut(BundlePair b, Object src) {
if (src != thisDlg) { if (src != thisDlg) {
@ -438,14 +430,6 @@ public class ProcedureDlg extends CaveSWTDialog {
private void saveProcedure(boolean closeAfterSave) { private void saveProcedure(boolean closeAfterSave) {
try { try {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
LocalizationFile localizationFile = pm.getLocalizationFile(context,
PROCEDURES_DIR + File.separator + fileName);
Procedure procedure = new Procedure(); Procedure procedure = new Procedure();
BundlePair[] bp = bundles.toArray(new BundlePair[bundles.size()]); BundlePair[] bp = bundles.toArray(new BundlePair[bundles.size()]);
Bundle[] bundlesToSave = new Bundle[bp.length]; Bundle[] bundlesToSave = new Bundle[bp.length];
@ -472,17 +456,26 @@ public class ProcedureDlg extends CaveSWTDialog {
} }
procedure.setBundles(bundlesToSave); procedure.setBundles(bundlesToSave);
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
ILocalizationFile localizationFile = pm
.getLocalizationFile(context, PROCEDURES_DIR
+ IPathManager.SEPARATOR + fileName);
String procedureXML = procedure.toXML(); String procedureXML = procedure.toXML();
FileUtil.bytes2File(procedureXML.getBytes(), try (SaveableOutputStream outStream = localizationFile
localizationFile.getFile()); .openOutputStream()) {
localizationFile.save(); outStream.write(procedureXML.getBytes());
outStream.save();
}
shell.setText("Procedure - " + fileName); shell.setText("Procedure - " + fileName);
saved = true; saved = true;
saveBtn.setEnabled(false); saveBtn.setEnabled(false);
if (closeAfterSave) if (closeAfterSave) {
close(); close();
}
} catch (Exception e) { } catch (Exception e) {
final String errMsg = "Error occurred during procedure save."; final String errMsg = "Error occurred during procedure save.";
statusHandler.handle(Priority.PROBLEM, errMsg, e); statusHandler.handle(Priority.PROBLEM, errMsg, e);

View file

@ -72,7 +72,7 @@ import com.raytheon.viz.ui.panes.PaneManager;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
* The side view for "docking" maps * The side view for "docking" displays.
* *
* <pre> * <pre>
* *
@ -80,22 +80,23 @@ import com.vividsolutions.jts.geom.Coordinate;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 7/1/06 chammack Initial Creation. * Jul 01, 2006 chammack Initial Creation.
* Dec 19, 2007 njensen Support for different tab types. * Dec 19, 2007 njensen Support for different tab types.
* Jul 8, 2009 #830 bgonzale use pane manager instead of managing own panes. * Jul 08, 2009 830 bgonzale use pane manager instead of managing own panes.
* Oct 22, 2009 #3348 bsteffen limit number of frames in sidepane rather than reseting * Oct 22, 2009 334 bsteffen limit number of frames in sidepane rather than reseting
* Jul 1, 2010 #6146 bkowal Updates the legend mode so that smaller panes will * Jul 01, 2010 6146 bkowal Updates the legend mode so that smaller panes will
* now include a legend * now include a legend
* Nov 20, 2012 DR 15524 M.Porricelli Changed so interactive screens still editable when * Nov 20, 2012 DR 15524 M.Porricelli Changed so interactive screens still editable when
* swapped to side panel * swapped to side panel
* Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d * Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d
* Aug 9, 2013 DR 16427 D. Friedman Swap additional input handlers. * Aug 09, 2013 DR 16427 D. Friedman Swap additional input handlers.
* Oct 10, 2013 #2104 mschenke Switched to use MapScalesManager * Oct 10, 2013 2104 mschenke Switched to use MapScalesManager
* Jul 15, 2014 2954 njensen Updated init() for MapScalesManager change * Jul 15, 2014 2954 njensen Updated init() for MapScalesManager change
* Aug 25, 2014 3467 mapeters Removed changing of editability from swapPanes(). * Aug 25, 2014 3467 mapeters Removed changing of editability from swapPanes().
* Mar 02, 2015 4204 njensen Support for swapping part names * Mar 02, 2015 4204 njensen Support for swapping part names
* Apr 02, 2015 4204 njensen Fix 4-panel swap of renamed parts * Apr 02, 2015 4204 njensen Fix 4-panel swap of renamed parts
* Sep 18, 2015 DR 17996 D. Friedman Clear editor pane's IRenderableDisplay before swap * Sep 18, 2015 DR 17996 D. Friedman Clear editor pane's IRenderableDisplay before swap
* Oct 21, 2015 5023 njensen Removed unnecessary setPartName()
* *
* </pre> * </pre>
* *
@ -151,13 +152,6 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
} }
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
* .Composite)
*/
@Override @Override
public void createPartControl(Composite parent) { public void createPartControl(Composite parent) {
try { try {
@ -202,24 +196,12 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
int buttonDown = 0; int buttonDown = 0;
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
* int, int)
*/
@Override @Override
public boolean handleMouseDown(int x, int y, int mouseButton) { public boolean handleMouseDown(int x, int y, int mouseButton) {
buttonDown = mouseButton; buttonDown = mouseButton;
return false; return false;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
* int)
*/
@Override @Override
public boolean handleMouseUp(int x, int y, int mouseButton) { public boolean handleMouseUp(int x, int y, int mouseButton) {
if (buttonDown == 3 && buttonDown == mouseButton) { // right click if (buttonDown == 3 && buttonDown == mouseButton) { // right click
@ -231,11 +213,6 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
} }
}; };
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.IDisplayPaneContainer#getDisplayPanes()
*/
@Override @Override
public IDisplayPane[] getDisplayPanes() { public IDisplayPane[] getDisplayPanes() {
if (this.paneManager == null) { if (this.paneManager == null) {
@ -245,43 +222,21 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.IDisplayPaneContainer#getLoopProperties()
*/
@Override @Override
public LoopProperties getLoopProperties() { public LoopProperties getLoopProperties() {
return this.loopProperties; return this.loopProperties;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.IDisplayPaneContainer#setLoopProperties(com.raytheon
* .viz.core.datastructure.LoopProperties)
*/
@Override @Override
public void setLoopProperties(LoopProperties loopProperties) { public void setLoopProperties(LoopProperties loopProperties) {
this.loopProperties = loopProperties; this.loopProperties = loopProperties;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.IDisplayPaneContainer#getActiveDisplayPane()
*/
@Override @Override
public IDisplayPane getActiveDisplayPane() { public IDisplayPane getActiveDisplayPane() {
return paneManager.getActiveDisplayPane(); return paneManager.getActiveDisplayPane();
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.IDisplayPaneContainer#refresh()
*/
@Override @Override
public void refresh() { public void refresh() {
paneManager.refresh(); paneManager.refresh();
@ -425,7 +380,10 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
IRenderableDisplay display = editorPanes[i] IRenderableDisplay display = editorPanes[i]
.getRenderableDisplay(); .getRenderableDisplay();
boolean hide = editorHiddenDisplays.contains(display); boolean hide = editorHiddenDisplays.contains(display);
// TODO: See note above for the isCompatibleEditor condition. /*
* TODO: See note above for the isCompatibleEditor
* condition.
*/
if (isCompatibleEditor) { if (isCompatibleEditor) {
editorPanes[i].setRenderableDisplay(null); editorPanes[i].setRenderableDisplay(null);
} }
@ -492,11 +450,6 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
} }
} }
} }
/*
* have to set part name again here cause addPane() or
* removePane() may mess it up
*/
theEditor.setPartName(viewName);
} else { } else {
int min = Math.min(viewPaneCount, editorPaneCount); int min = Math.min(viewPaneCount, editorPaneCount);
for (int i = 0; i < min; ++i) { for (int i = 0; i < min; ++i) {
@ -626,24 +579,11 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.IDisplayPaneContainer#translateClick(double,
* double)
*/
@Override @Override
public Coordinate translateClick(double x, double y) { public Coordinate translateClick(double x, double y) {
return paneManager.translateClick(x, y); return paneManager.translateClick(x, y);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.IDisplayPaneContainer#translateInverseClick(
* com.vividsolutions.jts.geom.Coordinate)
*/
@Override @Override
public double[] translateInverseClick(Coordinate c) { public double[] translateInverseClick(Coordinate c) {
return paneManager.translateInverseClick(c); return paneManager.translateInverseClick(c);
@ -703,68 +643,34 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
paneManager.showPane(pane); paneManager.showPane(pane);
} }
/*
* (non-Javadoc)
*
* @seecom.raytheon.uf.viz.core.IDisplayPaneContainer#
* addRenderableDisplayChangedListener
* (com.raytheon.uf.viz.core.IRenderableDisplayChangedListener)
*/
@Override @Override
public void addRenderableDisplayChangedListener( public void addRenderableDisplayChangedListener(
IRenderableDisplayChangedListener displayChangedListener) { IRenderableDisplayChangedListener displayChangedListener) {
// no op
} }
/*
* (non-Javadoc)
*
* @seecom.raytheon.uf.viz.core.IDisplayPaneContainer#
* notifyRenderableDisplayChangedListeners
* (com.raytheon.uf.viz.core.IDisplayPane,
* com.raytheon.uf.viz.core.drawables.IRenderableDisplay)
*/
@Override @Override
public void notifyRenderableDisplayChangedListeners(IDisplayPane pane, public void notifyRenderableDisplayChangedListeners(IDisplayPane pane,
IRenderableDisplay display, DisplayChangeType type) { IRenderableDisplay display, DisplayChangeType type) {
// no op
} }
/*
* (non-Javadoc)
*
* @seecom.raytheon.uf.viz.core.IDisplayPaneContainer#
* removeRenderableDisplayChangedListener
* (com.raytheon.uf.viz.core.IRenderableDisplayChangedListener)
*/
@Override @Override
public void removeRenderableDisplayChangedListener( public void removeRenderableDisplayChangedListener(
IRenderableDisplayChangedListener displayChangedListener) { IRenderableDisplayChangedListener displayChangedListener) {
// no op
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.editor.IMultiPaneEditor#addSelectedPaneChangedListener
* (com.raytheon.viz.ui.editor.ISelectedPaneChangedListener)
*/
@Override @Override
public void addSelectedPaneChangedListener( public void addSelectedPaneChangedListener(
ISelectedPanesChangedListener listener) { ISelectedPanesChangedListener listener) {
// no op
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.editor.IMultiPaneEditor#removeSelectedPaneChangedListener
* (com.raytheon.viz.ui.editor.ISelectedPaneChangedListener)
*/
@Override @Override
public void removeSelectedPaneChangedListener( public void removeSelectedPaneChangedListener(
ISelectedPanesChangedListener listener) { ISelectedPanesChangedListener listener) {
// no op
} }
@Override @Override
@ -783,26 +689,11 @@ public class SideView extends ViewPart implements IMultiPaneEditor,
paneManager.unregisterMouseHandler(handler); paneManager.unregisterMouseHandler(handler);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.editor.IMultiPaneEditor#getSelectedPanes(java.lang
* .String)
*/
@Override @Override
public IDisplayPane[] getSelectedPanes(String action) { public IDisplayPane[] getSelectedPanes(String action) {
return paneManager.getSelectedPanes(action); return paneManager.getSelectedPanes(action);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.color.IBackgroundColorChangedListener#setColor(com
* .raytheon.viz.ui.color.IBackgroundColorChangedListener.BGColorMode,
* org.eclipse.swt.graphics.RGB)
*/
@Override @Override
public void setColor(BGColorMode mode, RGB newColor) { public void setColor(BGColorMode mode, RGB newColor) {
for (IDisplayPane pane : getDisplayPanes()) { for (IDisplayPane pane : getDisplayPanes()) {

View file

@ -21,14 +21,11 @@ package com.raytheon.uf.viz.d2d.ui.map.actions;
import java.util.List; import java.util.List;
import org.eclipse.ui.part.EditorPart;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay; import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay;
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource; import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource;
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource.LegendMode; import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource.LegendMode;
import com.raytheon.viz.ui.IRenameablePart;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
import com.raytheon.viz.ui.editor.IMultiPaneEditor; import com.raytheon.viz.ui.editor.IMultiPaneEditor;
@ -49,6 +46,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 19, 2009 bgonzale Initial Creation. * Aug 19, 2009 bgonzale Initial Creation.
* Apr 07, 2015 4204 njensen Keep part name if renamed * Apr 07, 2015 4204 njensen Keep part name if renamed
* Oct 21, 2015 5023 njensen Removed unnecessary part name code (undid previous change)
* *
* </pre> * </pre>
* *
@ -64,11 +62,6 @@ public class FourPanelLayoutMenuAction extends AbstractRightClickAction {
super("Four Panel Layout"); super("Four Panel Layout");
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override @Override
public void run() { public void run() {
if (getContainer() instanceof IMultiPaneEditor == false if (getContainer() instanceof IMultiPaneEditor == false
@ -79,14 +72,6 @@ public class FourPanelLayoutMenuAction extends AbstractRightClickAction {
IRenderableDisplay definiteDisplay = getContainer().getDisplayPanes()[0] IRenderableDisplay definiteDisplay = getContainer().getDisplayPanes()[0]
.getRenderableDisplay(); .getRenderableDisplay();
String partName = null;
if (editor instanceof EditorPart) {
EditorPart part = (EditorPart) editor;
if (!part.getPartName().equals(part.getEditorInput().getName())) {
partName = part.getPartName();
}
}
if (editor.getNumberofPanes() > 1) { if (editor.getNumberofPanes() > 1) {
for (IDisplayPane pane : getContainer().getDisplayPanes()) { for (IDisplayPane pane : getContainer().getDisplayPanes()) {
editor.showPane(pane); editor.showPane(pane);
@ -97,11 +82,6 @@ public class FourPanelLayoutMenuAction extends AbstractRightClickAction {
} }
} }
// keep the part name if it was customized
if (partName != null && editor instanceof IRenameablePart) {
((IRenameablePart) editor).setPartName(partName);
}
for (IDisplayPane pane : editor.getDisplayPanes()) { for (IDisplayPane pane : editor.getDisplayPanes()) {
List<D2DLegendResource> rscs = pane.getDescriptor() List<D2DLegendResource> rscs = pane.getDescriptor()
.getResourceList() .getResourceList()

View file

@ -18,15 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<pluginDataObjectFilter> <menuContributionFile>
<filterElements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="rectFilterElement"> <include installTo="menu:tools?after=tools.Da"
<!-- Exclude all southern hemisphere data. --> fileName="menus/tools/damagepath-menu.xml">
<filterElementName>Exclude SouthernHemisphere</filterElementName> </include>
<filterType>EXCLUDE</filterType> </menuContributionFile>
<upperLeftLat>-0.1</upperLeftLat>
<upperLeftLon>-180.0</upperLeftLon>
<lowerRightLat>-90.0</lowerRightLat>
<lowerRightLon>180.0</lowerRightLon>
</filterElements>
<filterName>Point.QuikScat</filterName>
</pluginDataObjectFilter>

View file

@ -1,4 +1,4 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- <!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company, This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government. pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
@ -18,15 +18,10 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription>
<!-- Time in seconds. To use in Java - multiply by 1000 --> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<parameter name="validTime" numDims="1" type="LONG" />
<parameter name="latitude" numDims="1" type="FLOAT" unit="degree_N" /> <contribute xsi:type="bundleItem" file="bundles/tools/DamagePath.xml"
<parameter name="longitude" numDims="1" type="FLOAT" unit="degree_E" /> menuText="Damage Path" id="damagePathTool" timeQuery="false" />
<parameter name="satelliteID" numDims="1" type="INT" />
<parameter name="orbitNumber" numDims="1" type="INT" /> </menuTemplate>
<parameter name="windDir" numDims="1" type="FLOAT" unit="degree" />
<parameter name="windSpd" numDims="1" type="FLOAT" unit="m/s" />
<parameter name="probRain" numDims="1" type="FLOAT" unit="%" />
<parameter name="rainIndex" numDims="1" type="INT" />
</pointDataDescription>

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.json.geo.GeoJsonMapUtil;
import com.raytheon.uf.common.json.geo.IGeoJsonService; import com.raytheon.uf.common.json.geo.IGeoJsonService;
import com.raytheon.uf.common.json.geo.SimpleGeoJsonService; import com.raytheon.uf.common.json.geo.SimpleGeoJsonService;
import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.ILocalizationFileObserver; import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
@ -89,6 +90,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Aug 05, 2015 4635 dgilling Default save location for damage path * Aug 05, 2015 4635 dgilling Default save location for damage path
* is now at SITE level. * is now at SITE level.
* Aug 18, 2015 3806 njensen Use SaveableOutputStream to save * Aug 18, 2015 3806 njensen Use SaveableOutputStream to save
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -133,7 +135,7 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
private final Job loadJob = new Job("Loading Damage Path") { private final Job loadJob = new Job("Loading Damage Path") {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
LocalizationFile prevFile = getValidDamagePathFile(); ILocalizationFile prevFile = getValidDamagePathFile();
if (prevFile != null) { if (prevFile != null) {
loadDamagePath(prevFile); loadDamagePath(prevFile);
@ -154,7 +156,7 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
private final Job saveJob = new Job("Saving Damage Path") { private final Job saveJob = new Job("Saving Damage Path") {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
LocalizationFile file = getDamagePathFile(); ILocalizationFile file = getDamagePathFile();
saveDamagePath(file); saveDamagePath(file);
return Status.OK_STATUS; return Status.OK_STATUS;
} }
@ -231,11 +233,11 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
* future release, remove this function and replace uses with * future release, remove this function and replace uses with
* getDamagePathFile. * getDamagePathFile.
*/ */
private LocalizationFile getValidDamagePathFile() { private ILocalizationFile getValidDamagePathFile() {
LocalizationContext ctx = getContext(); LocalizationContext ctx = getContext();
LocalizationFile file = PathManagerFactory.getPathManager() ILocalizationFile file = PathManagerFactory.getPathManager()
.getLocalizationFile(ctx, PATH); .getLocalizationFile(ctx, PATH);
LocalizationFile oldFile = PathManagerFactory.getPathManager() ILocalizationFile oldFile = PathManagerFactory.getPathManager()
.getLocalizationFile(ctx, OLD_PATH); .getLocalizationFile(ctx, OLD_PATH);
if (file.exists()) { if (file.exists()) {
return file; return file;
@ -249,14 +251,14 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
@Override @Override
public void fileUpdated(FileUpdatedMessage message) { public void fileUpdated(FileUpdatedMessage message) {
if (message.getFileName().equals(PATH)) { if (message.getFileName().equals(PATH)) {
LocalizationFile file = getDamagePathFile(); ILocalizationFile file = getDamagePathFile();
if (file.exists()) { if (file.exists()) {
loadDamagePath(file); loadDamagePath(file);
} }
} }
} }
protected void loadDamagePath(LocalizationFile file) { protected void loadDamagePath(ILocalizationFile file) {
try { try {
DamagePathLoader loader = new DamagePathLoader(file); DamagePathLoader loader = new DamagePathLoader(file);
Collection<Pair<Polygon, Map<String, String>>> newData = loader Collection<Pair<Polygon, Map<String, String>>> newData = loader
@ -279,11 +281,11 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.error( statusHandler.error(
"Error loading damage path file " + file.getName(), e); "Error loading damage path file " + file.getPath(), e);
} }
} }
protected void saveDamagePath(LocalizationFile file) { protected void saveDamagePath(ILocalizationFile file) {
try (SaveableOutputStream sos = file.openOutputStream()) { try (SaveableOutputStream sos = file.openOutputStream()) {
IGeoJsonService json = new SimpleGeoJsonService(); IGeoJsonService json = new SimpleGeoJsonService();
SimpleFeatureCollection featureCollection = buildFeatureCollection(); SimpleFeatureCollection featureCollection = buildFeatureCollection();
@ -291,7 +293,7 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
sos.save(); sos.save();
} catch (Throwable t) { } catch (Throwable t) {
statusHandler.error( statusHandler.error(
"Error saving damage path file " + file.getName(), t); "Error saving damage path file " + file.getPath(), t);
} }
} }

View file

@ -40,7 +40,7 @@ import com.raytheon.uf.common.json.JsonException;
import com.raytheon.uf.common.json.geo.GeoJsonMapUtil; import com.raytheon.uf.common.json.geo.GeoJsonMapUtil;
import com.raytheon.uf.common.json.geo.IGeoJsonService; import com.raytheon.uf.common.json.geo.IGeoJsonService;
import com.raytheon.uf.common.json.geo.SimpleGeoJsonService; import com.raytheon.uf.common.json.geo.SimpleGeoJsonService;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.util.Pair; import com.raytheon.uf.common.util.Pair;
import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Geometry;
@ -63,6 +63,7 @@ import com.vividsolutions.jts.geom.Polygon;
* 15.1 version of damage path tool. * 15.1 version of damage path tool.
* Jul 01, 2015 #4375 dgilling Remove isValid check to imported * Jul 01, 2015 #4375 dgilling Remove isValid check to imported
* polygons. * polygons.
* Jan 11, 2016 #5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -76,7 +77,7 @@ public final class DamagePathLoader {
private final Collection<Pair<Polygon, Map<String, String>>> damagePathData; private final Collection<Pair<Polygon, Map<String, String>>> damagePathData;
public DamagePathLoader(LocalizationFile locFile) public DamagePathLoader(ILocalizationFile locFile)
throws LocalizationException, IOException, JsonException { throws LocalizationException, IOException, JsonException {
this(locFile, null); this(locFile, null);
} }
@ -86,8 +87,9 @@ public final class DamagePathLoader {
this(null, Paths.get(filePath)); this(null, Paths.get(filePath));
} }
private DamagePathLoader(LocalizationFile locFileSource, Path realFileSource) private DamagePathLoader(ILocalizationFile locFileSource,
throws LocalizationException, IOException, JsonException { Path realFileSource) throws LocalizationException, IOException,
JsonException {
this.damagePathData = new ArrayList<>(); this.damagePathData = new ArrayList<>();
if (locFileSource != null) { if (locFileSource != null) {
@ -101,7 +103,7 @@ public final class DamagePathLoader {
return damagePathData; return damagePathData;
} }
private void loadFromLocalizationFile(final LocalizationFile locFile) private void loadFromLocalizationFile(final ILocalizationFile locFile)
throws LocalizationException, IOException, JsonException { throws LocalizationException, IOException, JsonException {
try (InputStream is = locFile.openInputStream()) { try (InputStream is = locFile.openInputStream()) {
loadFromInputStream(is); loadFromInputStream(is);

View file

@ -63,13 +63,6 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.bufrquikscat"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.dataplugin.bufrsigwx" id="com.raytheon.uf.common.dataplugin.bufrsigwx"
download-size="0" download-size="0"

View file

@ -19,8 +19,6 @@
**/ **/
package com.raytheon.uf.viz.derivparam.ui.dialogs; package com.raytheon.uf.viz.derivparam.ui.dialogs;
import java.io.File;
import com.raytheon.uf.common.derivparam.library.DerivedParameterGenerator; import com.raytheon.uf.common.derivparam.library.DerivedParameterGenerator;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
@ -28,10 +26,10 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.localization.LocalizationPerspectiveUtils; import com.raytheon.uf.viz.localization.LocalizationPerspectiveUtils;
import com.raytheon.uf.viz.localization.service.ILocalizationService; import com.raytheon.uf.viz.localization.service.ILocalizationService;
import com.raytheon.viz.ui.dialogs.CaveSWTWizard; import com.raytheon.viz.ui.dialogs.CaveSWTWizard;
@ -47,6 +45,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTWizard;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 16, 2010 mschenke Initial creation * Dec 16, 2010 mschenke Initial creation
* Sep 17, 2013 2285 mschenke Fixed serialization of DerivParamDesc * Sep 17, 2013 2285 mschenke Fixed serialization of DerivParamDesc
* Feb 12, 2016 5242 dgilling Remove calls to deprecated Localization APIs.
* *
* </pre> * </pre>
* *
@ -74,23 +73,6 @@ public class DerivedParamWizard extends CaveSWTWizard {
addPage(newFunctionPage); addPage(newFunctionPage);
} }
/*
* Max, I took this out but itwill go away with the SWT Wizard stuff.
*/
// @Override
// public void createPageControls(Composite pageContainer) {
// pageContainer.setLayout(new GridLayout(1, false));
// pageContainer.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
// false));
// super.createPageControls(pageContainer);
// }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override @Override
public boolean performFinish() { public boolean performFinish() {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
@ -102,15 +84,11 @@ public class DerivedParamWizard extends CaveSWTWizard {
String fileName = newFunctionPage.getFunctionName() + "." String fileName = newFunctionPage.getFunctionName() + "."
+ newFunctionPage.getSelectedFunctionType().getExtension(); + newFunctionPage.getSelectedFunctionType().getExtension();
String path = DerivedParameterGenerator.FUNCTIONS_DIR String path = DerivedParameterGenerator.FUNCTIONS_DIR
+ File.separator + fileName; + IPathManager.SEPARATOR + fileName;
LocalizationFile file = pm.getLocalizationFile(userCtx, path); LocalizationFile file = pm.getLocalizationFile(userCtx, path);
File f = file.getFile(); try (SaveableOutputStream outStream = file.openOutputStream()) {
if (f.exists()) { outStream.write(functionContents.getBytes());
f.delete(); outStream.save();
}
try {
FileUtil.bytes2File(functionContents.getBytes(), f);
file.save();
functionFile = file; functionFile = file;
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
@ -123,13 +101,9 @@ public class DerivedParamWizard extends CaveSWTWizard {
String path = DerivedParameterGenerator.XML_DIR String path = DerivedParameterGenerator.XML_DIR
+ IPathManager.SEPARATOR + fileName; + IPathManager.SEPARATOR + fileName;
LocalizationFile file = pm.getLocalizationFile(userCtx, path); LocalizationFile file = pm.getLocalizationFile(userCtx, path);
File f = file.getFile(); try (SaveableOutputStream outStream = file.openOutputStream()) {
if (f.exists()) { outStream.write(functionContents.getBytes());
f.delete(); outStream.save();
}
try {
FileUtil.bytes2File(definitionContents.getBytes(), f);
file.save();
definitionFile = file; definitionFile = file;
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),

View file

@ -414,6 +414,13 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="org.apache.commons.lang3"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.units" id="com.raytheon.uf.common.units"
download-size="0" download-size="0"

View file

@ -127,6 +127,7 @@ import com.vividsolutions.jts.geom.Point;
* Aug 14, 2014 #3523 mapeters Updated deprecated DrawableString.textStyle assignments. * Aug 14, 2014 #3523 mapeters Updated deprecated DrawableString.textStyle assignments.
* Aug 21, 2014 #3459 randerso Restructured Map resource class hierarchy * Aug 21, 2014 #3459 randerso Restructured Map resource class hierarchy
* Nov 18, 2014 #3549 njensen Improved performance of processRequest() * Nov 18, 2014 #3549 njensen Improved performance of processRequest()
* Nov 05, 2015 #5070 randerso Moved label font management up to AbstractMapResource
* *
* </pre> * </pre>
* *
@ -427,7 +428,8 @@ public class DataStoreResource extends
DrawableString ds = new DrawableString(label, DrawableString ds = new DrawableString(label,
null); null);
ds.font = req.getResource().font; ds.font = req.getResource().getFont(
req.getTarget());
Rectangle2D rect = req.getTarget() Rectangle2D rect = req.getTarget()
.getStringsBounds(ds); .getStringsBounds(ds);
@ -1113,8 +1115,9 @@ public class DataStoreResource extends
} }
@Override @Override
protected void paintInternal(IGraphicsTarget aTarget, protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException { PaintProperties paintProps) throws VizException {
PixelExtent screenExtent = (PixelExtent) paintProps.getView() PixelExtent screenExtent = (PixelExtent) paintProps.getView()
.getExtent(); .getExtent();
@ -1148,12 +1151,6 @@ public class DataStoreResource extends
double labelMagnification = getCapability(MagnificationCapability.class) double labelMagnification = getCapability(MagnificationCapability.class)
.getMagnification(); .getMagnification();
if (font == null) {
font = aTarget.initializeFont(aTarget.getDefaultFont()
.getFontName(), (float) (10 * labelMagnification), null);
font.setSmoothing(false);
}
String shadingField = getCapability(ShadeableCapability.class) String shadingField = getCapability(ShadeableCapability.class)
.getShadingField(); .getShadingField();
boolean isShaded = isPolygonal() && (shadingField != null); boolean isShaded = isPolygonal() && (shadingField != null);
@ -1189,7 +1186,7 @@ public class DataStoreResource extends
boolean highlightsOnly = updateHighlights && !updateLabels boolean highlightsOnly = updateHighlights && !updateLabels
&& !updateShading && !updateExtent; && !updateShading && !updateExtent;
queryJob.queueRequest(new Request(aTarget, this, boundingGeom, queryJob.queueRequest(new Request(target, this, boundingGeom,
geomField, labelField, shadingField, colorMap, geomField, labelField, shadingField, colorMap,
isProduct, highlightsOnly)); isProduct, highlightsOnly));
lastExtent = expandedExtent; lastExtent = expandedExtent;
@ -1210,12 +1207,12 @@ public class DataStoreResource extends
&& shadedShape.isDrawable()) { && shadedShape.isDrawable()) {
float opacity = getCapability(ShadeableCapability.class) float opacity = getCapability(ShadeableCapability.class)
.getOpacity(); .getOpacity();
aTarget.drawShadedShape(shadedShape, alpha * opacity); target.drawShadedShape(shadedShape, alpha * opacity);
} }
if ((outlineShape != null) && outlineShape.isDrawable() if ((outlineShape != null) && outlineShape.isDrawable()
&& getCapability(OutlineCapability.class).isOutlineOn()) { && getCapability(OutlineCapability.class).isOutlineOn()) {
aTarget.drawWireframeShape(outlineShape, target.drawWireframeShape(outlineShape,
getCapability(ColorableCapability.class).getColor(), getCapability(ColorableCapability.class).getColor(),
getCapability(OutlineCapability.class).getOutlineWidth(), getCapability(OutlineCapability.class).getOutlineWidth(),
getCapability(OutlineCapability.class).getLineStyle(), getCapability(OutlineCapability.class).getLineStyle(),
@ -1227,18 +1224,18 @@ public class DataStoreResource extends
if ((highlightShape != null) && highlightShape.isDrawable() if ((highlightShape != null) && highlightShape.isDrawable()
&& getCapability(OutlineCapability.class).isOutlineOn()) { && getCapability(OutlineCapability.class).isOutlineOn()) {
aTarget.drawWireframeShape(highlightShape, highlightColor, target.drawWireframeShape(highlightShape, highlightColor,
highlightWidth, highlightStyle); highlightWidth, highlightStyle);
} }
if ((labels != null) && isLabeled && (labelMagnification != 0)) { if ((labels != null) && isLabeled && (labelMagnification != 0)) {
drawLabels(aTarget, paintProps, worldToScreenRatio); drawLabels(target, paintProps, worldToScreenRatio);
} }
if (rubberBandExtent != null) { if (rubberBandExtent != null) {
aTarget.drawShadedRect(rubberBandExtent, RUBBER_BAND_COLOR, 0.5, target.drawShadedRect(rubberBandExtent, RUBBER_BAND_COLOR, 0.5,
null); null);
aTarget.drawRect(rubberBandExtent, RUBBER_BAND_COLOR, 2, 1.0); target.drawRect(rubberBandExtent, RUBBER_BAND_COLOR, 2, 1.0);
} }
if (dragPromptCoord != null) { if (dragPromptCoord != null) {
@ -1249,7 +1246,7 @@ public class DataStoreResource extends
ds.addTextStyle(TextStyle.BOXED, new RGB(255, 255, 255)); ds.addTextStyle(TextStyle.BOXED, new RGB(255, 255, 255));
ds.horizontalAlignment = HorizontalAlignment.LEFT; ds.horizontalAlignment = HorizontalAlignment.LEFT;
ds.verticallAlignment = VerticalAlignment.BOTTOM; ds.verticallAlignment = VerticalAlignment.BOTTOM;
aTarget.drawStrings(ds); target.drawStrings(ds);
} }
} }
@ -1279,9 +1276,8 @@ public class DataStoreResource extends
highlightShape = result.highlightShape; highlightShape = result.highlightShape;
} }
private void drawLabels(IGraphicsTarget aTarget, private void drawLabels(IGraphicsTarget target, PaintProperties paintProps,
PaintProperties paintProps, double worldToScreenRatio) double worldToScreenRatio) throws VizException {
throws VizException {
double offsetX = getCapability(LabelableCapability.class).getxOffset() double offsetX = getCapability(LabelableCapability.class).getxOffset()
* worldToScreenRatio; * worldToScreenRatio;
double offsetY = getCapability(LabelableCapability.class).getyOffset() double offsetY = getCapability(LabelableCapability.class).getyOffset()
@ -1315,7 +1311,7 @@ public class DataStoreResource extends
DrawableString string = new DrawableString(node.label, color); DrawableString string = new DrawableString(node.label, color);
string.setCoordinates(node.location[0] + offsetX, node.location[1] string.setCoordinates(node.location[0] + offsetX, node.location[1]
- offsetY); - offsetY);
string.font = font; string.font = getFont(target);
string.horizontalAlignment = HorizontalAlignment.CENTER; string.horizontalAlignment = HorizontalAlignment.CENTER;
string.verticallAlignment = VerticalAlignment.MIDDLE; string.verticallAlignment = VerticalAlignment.MIDDLE;
boolean add = true; boolean add = true;
@ -1347,7 +1343,7 @@ public class DataStoreResource extends
} }
} }
aTarget.drawStrings(strings); target.drawStrings(strings);
} }
/** /**
@ -1969,17 +1965,13 @@ public class DataStoreResource extends
@Override @Override
public void resourceChanged(ChangeType type, Object object) { public void resourceChanged(ChangeType type, Object object) {
super.resourceChanged(type, object);
if (type.equals(ChangeType.CAPABILITY)) { if (type.equals(ChangeType.CAPABILITY)) {
if (object instanceof ColorableCapability) { if (object instanceof ColorableCapability) {
if (this.timeRange != null) { if (this.timeRange != null) {
// force rebuild of shaded shape to pick up color change // force rebuild of shaded shape to pick up color change
lastExtent = null; lastExtent = null;
} }
} else if (object instanceof MagnificationCapability) {
if (font != null) {
font.dispose();
font = null;
}
} }
} }
issueRefresh(); issueRefresh();

View file

@ -71,6 +71,7 @@ import com.raytheon.viz.grid.rsc.general.D2DGridResource;
* May 5, 2014 3026 mpduff Initial creation * May 5, 2014 3026 mpduff Initial creation
* Dec 16, 2014 3026 mpduff Change location of text * Dec 16, 2014 3026 mpduff Change location of text
* Feb 13, 2015 4121 mpduff Change label caching. * Feb 13, 2015 4121 mpduff Change label caching.
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
* *
* </pre> * </pre>
* *
@ -164,7 +165,7 @@ public class HpeLabelResource extends
@Override @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
if (font == null) { if (font == null) {
font = target.initializeFont("Dialog", 11, null); font = target.initializeFont("Dialog", 9, null);
} }
font.setMagnification(getCapability(MagnificationCapability.class) font.setMagnification(getCapability(MagnificationCapability.class)
.getMagnification().floatValue()); .getMagnification().floatValue());

View file

@ -180,7 +180,7 @@ public class KmlExportDialog extends CaveSWTDialog {
protected void initializeFramesGroup(Group group) { protected void initializeFramesGroup(Group group) {
group.setLayout(new GridLayout(5, false)); group.setLayout(new GridLayout(5, false));
group.setText("Export Location"); group.setText("Export Frames");
allFramesButton = new Button(group, SWT.RADIO); allFramesButton = new Button(group, SWT.RADIO);
allFramesButton.setText("All Frames"); allFramesButton.setText("All Frames");

View file

@ -31,9 +31,11 @@ import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPathEditorInput; import org.eclipse.ui.IPathEditorInput;
import org.eclipse.ui.IPersistableElement; import org.eclipse.ui.IPersistableElement;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationUtil; import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -50,6 +52,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Nov 3, 2010 mschenke Initial creation * Nov 3, 2010 mschenke Initial creation
* Nov 27, 2013 mschenke Moved into localization.perspective project * Nov 27, 2013 mschenke Moved into localization.perspective project
* Feb 11, 2015 4108 randerso Implmented hashCode() and equals() * Feb 11, 2015 4108 randerso Implmented hashCode() and equals()
* Jan 06, 2016 4834 nabowle add refreshLocalizationFile().
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -85,10 +89,21 @@ public class LocalizationEditorInput implements IFileEditorInput,
public void setLocalizationFile(LocalizationFile localizationFile) { public void setLocalizationFile(LocalizationFile localizationFile) {
this.localizationFile = localizationFile; this.localizationFile = localizationFile;
name = LocalizationUtil.extractName(localizationFile.getName()); name = LocalizationUtil.extractName(localizationFile.getPath());
file = null; file = null;
} }
/**
* Refreshes the localizationFile reference.
*/
public void refreshLocalizationFile() {
IPathManager pathManager = PathManagerFactory.getPathManager();
LocalizationFile latestFile = pathManager.getLocalizationFile(
this.localizationFile.getContext(),
this.localizationFile.getPath());
this.localizationFile = latestFile;
}
/** /**
* @return the localizationFile * @return the localizationFile
*/ */
@ -96,55 +111,30 @@ public class LocalizationEditorInput implements IFileEditorInput,
return localizationFile; return localizationFile;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorInput#exists()
*/
@Override @Override
public boolean exists() { public boolean exists() {
return localizationFile.exists(); return localizationFile.exists();
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorInput#getImageDescriptor()
*/
@Override @Override
public ImageDescriptor getImageDescriptor() { public ImageDescriptor getImageDescriptor() {
return null; return null;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorInput#getName()
*/
@Override @Override
public String getName() { public String getName() {
return name + " - " return name + " - "
+ localizationFile.getContext().getLocalizationLevel(); + localizationFile.getContext().getLocalizationLevel();
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorInput#getPersistable()
*/
@Override @Override
public IPersistableElement getPersistable() { public IPersistableElement getPersistable() {
return this; return this;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IEditorInput#getToolTipText()
*/
@Override @Override
public String getToolTipText() { public String getToolTipText() {
String tip = localizationFile.getName(); String tip = localizationFile.getPath();
if (localizationFile.isProtected()) { if (localizationFile.isProtected()) {
tip += " (Protected @ " + localizationFile.getProtectedLevel() tip += " (Protected @ " + localizationFile.getProtectedLevel()
+ ")"; + ")";
@ -152,32 +142,17 @@ public class LocalizationEditorInput implements IFileEditorInput,
return tip; return tip;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Override @Override
public Object getAdapter(Class adapter) { public Object getAdapter(Class adapter) {
return Platform.getAdapterManager().getAdapter(this, adapter); return Platform.getAdapterManager().getAdapter(this, adapter);
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IStorageEditorInput#getStorage()
*/
@Override @Override
public IStorage getStorage() throws CoreException { public IStorage getStorage() throws CoreException {
return getFile(); return getFile();
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IFileEditorInput#getFile()
*/
@Override @Override
public IFile getFile() { public IFile getFile() {
if (file.exists() == false) { if (file.exists() == false) {
@ -192,25 +167,15 @@ public class LocalizationEditorInput implements IFileEditorInput,
return file; return file;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPathEditorInput#getPath()
*/
@Override @Override
public IPath getPath() { public IPath getPath() {
return getFile().getRawLocation(); return getFile().getRawLocation();
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPersistable#saveState(org.eclipse.ui.IMemento)
*/
@Override @Override
public void saveState(IMemento memento) { public void saveState(IMemento memento) {
LocalizationContext ctx = localizationFile.getContext(); LocalizationContext ctx = localizationFile.getContext();
memento.putString(FILE_NAME_ID, localizationFile.getName()); memento.putString(FILE_NAME_ID, localizationFile.getPath());
memento.putString(CONTEXT_NAME_ID, ctx.getContextName()); memento.putString(CONTEXT_NAME_ID, ctx.getContextName());
memento.putString(CONTEXT_TYPE_ID, ctx.getLocalizationType().name()); memento.putString(CONTEXT_TYPE_ID, ctx.getLocalizationType().name());
memento.putString(CONTEXT_LEVEL_ID, ctx.getLocalizationLevel().name()); memento.putString(CONTEXT_LEVEL_ID, ctx.getLocalizationLevel().name());
@ -218,21 +183,11 @@ public class LocalizationEditorInput implements IFileEditorInput,
.toPortableString()); .toPortableString());
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IPersistableElement#getFactoryId()
*/
@Override @Override
public String getFactoryId() { public String getFactoryId() {
return FACTORY_ID; return FACTORY_ID;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
@ -242,11 +197,6 @@ public class LocalizationEditorInput implements IFileEditorInput,
return result; return result;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {

View file

@ -30,7 +30,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 27, 2013 mschenke Methods extracted from LocalizationPerspectiveUtils * Nov 27, 2013 mschenke Methods extracted from LocalizationPerspectiveUtils
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -72,7 +73,7 @@ public class LocalizationEditorUtils {
if (reg == null) { if (reg == null) {
return new IEditorDescriptor[0]; return new IEditorDescriptor[0];
} }
return reg.getEditors(input.getLocalizationFile().getName()); return reg.getEditors(input.getLocalizationFile().getPath());
} }
/** /**
@ -87,7 +88,7 @@ public class LocalizationEditorUtils {
if (reg == null) { if (reg == null) {
return null; return null;
} }
return reg.getDefaultEditor(input.getLocalizationFile().getName()); return reg.getDefaultEditor(input.getLocalizationFile().getPath());
} }
/** /**
@ -118,7 +119,7 @@ public class LocalizationEditorUtils {
IEditorRegistry reg = getEditorRegistry(); IEditorRegistry reg = getEditorRegistry();
if (reg != null) { if (reg != null) {
IEditorDescriptor desc = reg.getDefaultEditor(input IEditorDescriptor desc = reg.getDefaultEditor(input
.getLocalizationFile().getName()); .getLocalizationFile().getPath());
String id = DEFAULT_TEXT_EDITOR; String id = DEFAULT_TEXT_EDITOR;
if (desc != null) { if (desc != null) {
id = desc.getId(); id = desc.getId();
@ -177,16 +178,16 @@ public class LocalizationEditorUtils {
* @return the open editor part or null if not being edited * @return the open editor part or null if not being edited
*/ */
public static IEditorPart getEditorForFile(IWorkbenchPage page, public static IEditorPart getEditorForFile(IWorkbenchPage page,
LocalizationFile file) { ILocalizationFile file) {
for (IEditorReference ref : page.getEditorReferences()) { for (IEditorReference ref : page.getEditorReferences()) {
IEditorPart part = ref.getEditor(false); IEditorPart part = ref.getEditor(false);
if (part != null) { if (part != null) {
IEditorInput input = part.getEditorInput(); IEditorInput input = part.getEditorInput();
if (input instanceof LocalizationEditorInput) { if (input instanceof LocalizationEditorInput) {
LocalizationFile editedFile = ((LocalizationEditorInput) input) ILocalizationFile editedFile = ((LocalizationEditorInput) input)
.getLocalizationFile(); .getLocalizationFile();
if (editedFile.getContext().equals(file.getContext()) if (editedFile.getContext().equals(file.getContext())
&& editedFile.getName().equals(file.getName())) { && editedFile.getPath().equals(file.getPath())) {
return part; return part;
} }
} }

View file

@ -43,6 +43,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType; import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.ILocalizationFileObserver; import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
@ -72,6 +73,7 @@ import com.raytheon.viz.ui.EditorUtil;
* Mar 24, 2011 mschenke Initial creation * Mar 24, 2011 mschenke Initial creation
* Aug 29, 2014 #3527 mapeters Check for active editor to not * Aug 29, 2014 #3527 mapeters Check for active editor to not
* be null before calling isDirty(). * be null before calling isDirty().
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -166,7 +168,7 @@ public class LocalizationSaveAsPopulator extends CompoundContributionItem {
LocalizationLevel newLevel) { LocalizationLevel newLevel) {
LocalizationEditorInput input = (LocalizationEditorInput) editor LocalizationEditorInput input = (LocalizationEditorInput) editor
.getEditorInput(); .getEditorInput();
LocalizationFile fileToSave = input.getLocalizationFile(); ILocalizationFile fileToSave = input.getLocalizationFile();
if (newLevel == fileToSave.getContext().getLocalizationLevel()) { if (newLevel == fileToSave.getContext().getLocalizationLevel()) {
String myContext = LocalizationManager.getContextName(newLevel); String myContext = LocalizationManager.getContextName(newLevel);
@ -183,7 +185,7 @@ public class LocalizationSaveAsPopulator extends CompoundContributionItem {
// get new level file // get new level file
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
String name = fileToSave.getName(); String name = fileToSave.getPath();
LocalizationContext newCtx = pm.getContext(fileToSave.getContext() LocalizationContext newCtx = pm.getContext(fileToSave.getContext()
.getLocalizationType(), newLevel); .getLocalizationType(), newLevel);
final LocalizationFile newFile = pm.getLocalizationFile(newCtx, name); final LocalizationFile newFile = pm.getLocalizationFile(newCtx, name);
@ -249,9 +251,9 @@ public class LocalizationSaveAsPopulator extends CompoundContributionItem {
private static void saveEditorAs(IEditorPart editor) { private static void saveEditorAs(IEditorPart editor) {
LocalizationEditorInput input = (LocalizationEditorInput) editor LocalizationEditorInput input = (LocalizationEditorInput) editor
.getEditorInput(); .getEditorInput();
LocalizationFile fileToSave = input.getLocalizationFile(); ILocalizationFile fileToSave = input.getLocalizationFile();
FileDialog fd = new FileDialog(editor.getSite().getShell(), SWT.SAVE); FileDialog fd = new FileDialog(editor.getSite().getShell(), SWT.SAVE);
fd.setFileName(LocalizationUtil.extractName(fileToSave.getName())); fd.setFileName(LocalizationUtil.extractName(fileToSave.getPath()));
fd.setOverwrite(true); fd.setOverwrite(true);
fd.setFilterPath(System.getProperty("user.home")); fd.setFilterPath(System.getProperty("user.home"));

View file

@ -87,14 +87,15 @@ import org.eclipse.ui.part.ViewPart;
import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType; import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.ILocalizationPathObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationNotificationObserver;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -142,7 +143,13 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Aug 24, 2015 4393 njensen Updates for observer changes * Aug 24, 2015 4393 njensen Updates for observer changes
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Nov 18, 2015 4834 njensen Updated to register file observing on PathManager
* Dec 03, 2015 4834 njensen Updated for ILocalizationFile changes
* Jan 06, 2016 4834 nabowle Fix single-user edit-save-edit-save.
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* Jan 15, 2016 5242 kbisanz Replaced LocalizationFile with
* ILocalizationFile where possible
* *
* </pre> * </pre>
* *
@ -151,21 +158,22 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
*/ */
public class FileTreeView extends ViewPart implements IPartListener2, public class FileTreeView extends ViewPart implements IPartListener2,
ILocalizationService, IResourceChangeListener { ILocalizationService, IResourceChangeListener,
ILocalizationPathObserver {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FileTreeView.class); .getHandler(FileTreeView.class);
private static class FileTreeFileComparator implements private static class FileTreeFileComparator implements
Comparator<LocalizationFile> { Comparator<ILocalizationFile> {
@Override @Override
public int compare(LocalizationFile o1, LocalizationFile o2) { public int compare(ILocalizationFile o1, ILocalizationFile o2) {
if (o1.isDirectory() && (o2.isDirectory() == false)) { if (o1.isDirectory() && (o2.isDirectory() == false)) {
return 1; return 1;
} else if ((o1.isDirectory() == false) && o2.isDirectory()) { } else if ((o1.isDirectory() == false) && o2.isDirectory()) {
return -1; return -1;
} else { } else {
int nameVal = o1.getName().compareTo(o2.getName()); int nameVal = o1.getPath().compareTo(o2.getPath());
if (nameVal == 0) { if (nameVal == 0) {
// exact same name, check levels // exact same name, check levels
LocalizationLevel l1 = o1.getContext() LocalizationLevel l1 = o1.getContext()
@ -206,11 +214,11 @@ public class FileTreeView extends ViewPart implements IPartListener2,
private class FileUpdateRefresher implements Runnable { private class FileUpdateRefresher implements Runnable {
private final LocalizationFile file; private final ILocalizationFile file;
private final FileChangeType type; private final FileChangeType type;
public FileUpdateRefresher(LocalizationFile file, FileChangeType type) { public FileUpdateRefresher(ILocalizationFile file, FileChangeType type) {
this.file = file; this.file = file;
this.type = type; this.type = type;
} }
@ -223,7 +231,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
for (TreeItem appItem : tree.getItems()) { for (TreeItem appItem : tree.getItems()) {
for (TreeItem rootItem : appItem.getItems()) { for (TreeItem rootItem : appItem.getItems()) {
TreeItem found = find(rootItem, file.getContext(), TreeItem found = find(rootItem, file.getContext(),
file.getName(), false); file.getPath(), false);
if (found != null) { if (found != null) {
/* /*
* File found. If updated, set the time stamp to * File found. If updated, set the time stamp to
@ -313,8 +321,9 @@ public class FileTreeView extends ViewPart implements IPartListener2,
waitCursor = display.getSystemCursor(SWT.CURSOR_WAIT); waitCursor = display.getSystemCursor(SWT.CURSOR_WAIT);
site.getPage().addPartListener(this); site.getPage().addPartListener(this);
((LocalizationNotificationObserver) PathManagerFactory.getPathManager()
.getObserver()).addGlobalFileChangeObserver(this); PathManagerFactory.getPathManager().addLocalizationPathObserver(
IPathManager.SEPARATOR, this);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
IResourceChangeEvent.POST_CHANGE); IResourceChangeEvent.POST_CHANGE);
@ -341,9 +350,8 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
getSite().getPage().removePartListener(this); getSite().getPage().removePartListener(this);
((LocalizationNotificationObserver) PathManagerFactory.getPathManager() PathManagerFactory.getPathManager()
.getObserver()).removeGlobalFileChangeObserver(this); .removeLocalizationPathObserver(this);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
} }
@ -830,8 +838,8 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
} }
final List<LocalizationFile> fileList = new ArrayList<LocalizationFile>(); final List<LocalizationFile> fileList = new ArrayList<>();
final List<LocalizationFileEntryData> fileDataList = new ArrayList<LocalizationFileEntryData>(); final List<LocalizationFileEntryData> fileDataList = new ArrayList<>();
// get list of files selected // get list of files selected
if (selected.length > 0) { if (selected.length > 0) {
// Open File(s) list // Open File(s) list
@ -871,7 +879,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
mgr.add(new CopyToAction(fileDataList.get(0), this)); mgr.add(new CopyToAction(fileDataList.get(0), this));
mgr.add(new DeleteAction(getSite().getPage(), fileList mgr.add(new DeleteAction(getSite().getPage(), fileList
.toArray(new LocalizationFile[fileList.size()]))); .toArray(new LocalizationFile[0])));
mgr.add(new Separator()); mgr.add(new Separator());
} else if ((selected.length == 1) } else if ((selected.length == 1)
@ -885,7 +893,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
.toArray(new LocalizationFile[fileList.size()]))); .toArray(new LocalizationFile[fileList.size()])));
mgr.add(new Separator()); mgr.add(new Separator());
} else { } else {
List<LocalizationFile> toDelete = new ArrayList<LocalizationFile>(); List<ILocalizationFile> toDelete = new ArrayList<>();
for (TreeItem item : selected) { for (TreeItem item : selected) {
int prevSize = toDelete.size(); int prevSize = toDelete.size();
if (item.getData() instanceof FileTreeEntryData) { if (item.getData() instanceof FileTreeEntryData) {
@ -977,17 +985,18 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
/** /**
* Builds a list of {@link LocalizationFile}s starting at the item passed in * Builds a list of {@link ILocalizationFile}s starting at the item passed
* in
* *
* @param item * @param item
* @param files * @param files
* (option) list to add entries to * (option) list to add entries to
* @return list of files * @return list of files
*/ */
private List<LocalizationFile> buildFileList(TreeItem item, private List<ILocalizationFile> buildFileList(TreeItem item,
List<LocalizationFile> files) { List<ILocalizationFile> files) {
if (files == null) { if (files == null) {
files = new ArrayList<LocalizationFile>(); files = new ArrayList<>();
} }
FileTreeEntryData data = (FileTreeEntryData) item.getData(); FileTreeEntryData data = (FileTreeEntryData) item.getData();
@ -1088,7 +1097,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
IPathManager pathManager = PathManagerFactory.getPathManager(); IPathManager pathManager = PathManagerFactory.getPathManager();
boolean success = false; boolean success = false;
List<LocalizationFile> currentList = new ArrayList<LocalizationFile>(); List<LocalizationFile> currentList = new ArrayList<>();
LocalizationFile[] files = pathManager.listFiles( LocalizationFile[] files = pathManager.listFiles(
getTreeSearchContexts(types), path, filter, false, !recursive); getTreeSearchContexts(types), path, filter, false, !recursive);
if (files == null) { if (files == null) {
@ -1099,8 +1108,8 @@ public class FileTreeView extends ViewPart implements IPartListener2,
for (LocalizationFile file : files) { for (LocalizationFile file : files) {
if (checkName if (checkName
&& (file.getName().isEmpty() || data.getPath().equals( && (file.getPath().isEmpty() || data.getPath().equals(
file.getName()))) { file.getPath()))) {
continue; continue;
} }
if (file.exists()) { if (file.exists()) {
@ -1176,11 +1185,11 @@ public class FileTreeView extends ViewPart implements IPartListener2,
FileTreeEntryData data = (FileTreeEntryData) parentItem.getData(); FileTreeEntryData data = (FileTreeEntryData) parentItem.getData();
data.setRequestedChildren(true); data.setRequestedChildren(true);
PathData pd = data.getPathData(); PathData pd = data.getPathData();
Map<String, List<LocalizationFile>> processedFiles = new HashMap<String, List<LocalizationFile>>(); Map<String, List<LocalizationFile>> processedFiles = new HashMap<>();
Set<String> processedPaths = new HashSet<String>(); Set<String> processedPaths = new HashSet<>();
// we are expanding a folder // we are expanding a folder
for (LocalizationFile file : files) { for (LocalizationFile file : files) {
String name = file.getName(); String name = file.getPath();
if (processedPaths.contains(name) == false) { if (processedPaths.contains(name) == false) {
FileTreeEntryData treeData = null; FileTreeEntryData treeData = null;
if (file.isDirectory()) { if (file.isDirectory()) {
@ -1195,7 +1204,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
if (file.isDirectory() == false) { if (file.isDirectory() == false) {
List<LocalizationFile> entryFiles = processedFiles.get(name); List<LocalizationFile> entryFiles = processedFiles.get(name);
if (entryFiles == null) { if (entryFiles == null) {
entryFiles = new ArrayList<LocalizationFile>(); entryFiles = new ArrayList<>();
processedFiles.put(name, entryFiles); processedFiles.put(name, entryFiles);
} }
entryFiles.add(file); entryFiles.add(file);
@ -1226,7 +1235,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
PathData pd = fData.getPathData(); PathData pd = fData.getPathData();
Set<LocalizationLevel> levels = new HashSet<>(); Set<LocalizationLevel> levels = new HashSet<>();
Set<LocalizationLevel> redundantLevels = new HashSet<>(); Set<LocalizationLevel> redundantLevels = new HashSet<>();
for (LocalizationFile file : files) { for (ILocalizationFile file : files) {
LocalizationLevel level = file.getContext().getLocalizationLevel(); LocalizationLevel level = file.getContext().getLocalizationLevel();
if (!levels.add(level)) { if (!levels.add(level)) {
redundantLevels.add(level); redundantLevels.add(level);
@ -1283,7 +1292,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
*/ */
private TreeItem addTreeItem(TreeItem parentItem, FileTreeEntryData treeData) { private TreeItem addTreeItem(TreeItem parentItem, FileTreeEntryData treeData) {
String name = treeData.getName(); String name = treeData.getName();
LocalizationFile file = null; ILocalizationFile file = null;
int idx = parentItem.getItemCount(); int idx = parentItem.getItemCount();
if (treeData instanceof LocalizationFileEntryData) { if (treeData instanceof LocalizationFileEntryData) {
LocalizationFileEntryData entryData = (LocalizationFileEntryData) treeData; LocalizationFileEntryData entryData = (LocalizationFileEntryData) treeData;
@ -1381,16 +1390,16 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
/** /**
* Get the image for the provided LocalizationFile. * Get the image for the provided ILocalizationFile.
* *
* @param file * @param file
* The LocalizationFile * The ILocalizationFile
* @return The image * @return The image
*/ */
private Image getImage(LocalizationFile file) { private Image getImage(ILocalizationFile file) {
String name = null; String name = null;
if (file != null) { if (file != null) {
name = file.getName(); name = file.getPath();
} }
return getImage(name); return getImage(name);
} }
@ -1422,9 +1431,9 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
} }
private TreeItem find(LocalizationFile file, boolean populateToFind, private TreeItem find(ILocalizationFile file, boolean populateToFind,
boolean nearestParent) { boolean nearestParent) {
return find(file.getName(), file.getContext(), populateToFind, return find(file.getPath(), file.getContext(), populateToFind,
nearestParent); nearestParent);
} }
@ -1569,12 +1578,19 @@ public class FileTreeView extends ViewPart implements IPartListener2,
&& (docDelta.getKind() == IResourceDelta.CHANGED) && (docDelta.getKind() == IResourceDelta.CHANGED)
&& ((docDelta.getFlags() & IResourceDelta.CONTENT) == IResourceDelta.CONTENT)) { && ((docDelta.getFlags() & IResourceDelta.CONTENT) == IResourceDelta.CONTENT)) {
try { try {
LocalizationFile file = input.getLocalizationFile(); ILocalizationFile file = input
if (file.getContext().getLocalizationLevel() .getLocalizationFile();
.isSystemLevel() == false) { /*
input.getLocalizationFile().save(); * TODO can't easily replace the deprecated save()
* call because if we use openOutputStream() it will
* overwrite the file contents
*/
if (!file.getContext().getLocalizationLevel()
.isSystemLevel()
&& input.getLocalizationFile().save()) {
input.refreshLocalizationFile();
} }
} catch (LocalizationOpFailedException e) { } catch (LocalizationException e) {
statusHandler.handle( statusHandler.handle(
Priority.PROBLEM, Priority.PROBLEM,
"Error saving file: " "Error saving file: "
@ -1604,13 +1620,13 @@ public class FileTreeView extends ViewPart implements IPartListener2,
IPathManager pathManager = PathManagerFactory.getPathManager(); IPathManager pathManager = PathManagerFactory.getPathManager();
FileChangeType type = message.getChangeType(); FileChangeType type = message.getChangeType();
LocalizationFile file = pathManager.getLocalizationFile(context, ILocalizationFile file = pathManager.getLocalizationFile(context,
filePath); filePath);
if (file != null) { if (file != null) {
if (((file.exists() == false) && ((type == FileChangeType.ADDED) || (type == FileChangeType.UPDATED))) if (((file.exists() == false) && ((type == FileChangeType.ADDED) || (type == FileChangeType.UPDATED)))
|| (file.exists() && (type == FileChangeType.DELETED))) { || (file.exists() && (type == FileChangeType.DELETED))) {
System.out.println("Got weird state in update for " + file System.err.println("Got weird state in update for " + file
+ ": exists=" + file.exists() + ", changeType=" + ": exists=" + file.exists() + ", changeType="
+ message.getChangeType()); + message.getChangeType());
} }
@ -1784,4 +1800,30 @@ public class FileTreeView extends ViewPart implements IPartListener2,
public boolean isShown(LocalizationLevel level) { public boolean isShown(LocalizationLevel level) {
return showSet.contains(level); return showSet.contains(level);
} }
@Override
public void fileChanged(ILocalizationFile file) {
/*
* TODO rewrite this whole method to not use fileUpdated() and correctly
* refresh/update nodes as necessary
*/
FileChangeType t = null;
if (ILocalizationFile.NON_EXISTENT_CHECKSUM.equals(file.getCheckSum())) {
t = FileChangeType.DELETED;
} else {
/*
* TODO We don't have the previous checksum available here so we
* can't easily identify this change as an add vs update. We need to
* handle this cleanly somehow.
*
* Temporary fix: Go with ADDED
*/
t = FileChangeType.ADDED;
}
FileUpdatedMessage fum = new FileUpdatedMessage(file.getContext(),
file.getPath(), t, file.getTimeStamp().getTime(),
file.getCheckSum());
fileUpdated(fum);
}
} }

View file

@ -20,12 +20,9 @@
package com.raytheon.uf.viz.localization.perspective.view; package com.raytheon.uf.viz.localization.perspective.view;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerDropAdapter; import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DND;
@ -35,23 +32,14 @@ import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.TreeItem;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.localization.msgs.ListResponseEntry;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.localization.filetreeview.FileTreeEntryData; import com.raytheon.uf.viz.localization.filetreeview.FileTreeEntryData;
import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData; import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData;
import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileGroupData; import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileGroupData;
@ -69,7 +57,8 @@ import com.raytheon.uf.viz.localization.perspective.view.actions.ImportFileActio
* Jul 1, 2011 mschenke Initial creation * Jul 1, 2011 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 11, 2016 5242 kbisanz Deleted unused dropLocalizationFile(...)
* *
* </pre> * </pre>
* *
@ -120,7 +109,7 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
if (toDelete != null) { if (toDelete != null) {
try { try {
toDelete.delete(); toDelete.delete();
} catch (LocalizationOpFailedException e) { } catch (LocalizationException e) {
UFStatus.getHandler().handle(Priority.PROBLEM, UFStatus.getHandler().handle(Priority.PROBLEM,
"Error deleting old file", e); "Error deleting old file", e);
} }
@ -191,64 +180,6 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
return false; return false;
} }
private boolean dropLocalizationFile(FileTreeEntryData data,
ListResponseEntry toMoveData) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile toMove = pm.getLocalizationFile(
toMoveData.getContext(), toMoveData.getFileName());
String fileName = LocalizationUtil.extractName(toMove.getName());
String newName = data.getPath() + File.separator + fileName;
LocalizationType type = toMove.getContext().getLocalizationType();
if (!data.getPathData().getTypes().contains(type)) {
type = data.getPathData().getTypes().get(0);
}
final LocalizationFile moveTo = pm.getLocalizationFile(pm.getContext(
type, toMoveData.getContext().getLocalizationLevel()), newName);
boolean move = true;
if (moveTo.exists()) {
move = MessageDialog.openQuestion(view.getSite().getShell(),
"Override File", "A file with the name '" + fileName
+ "' already exists in the '" + data.getName()
+ "' folder. Do you want to override it?");
}
if (move) {
final Runnable select = new Runnable() {
@Override
public void run() {
view.selectFile(moveTo);
}
};
// Make sure we select the file after the drop
if (moveTo.exists() == false) {
final ILocalizationFileObserver[] observers = new ILocalizationFileObserver[1];
ILocalizationFileObserver observer = new ILocalizationFileObserver() {
@Override
public void fileUpdated(FileUpdatedMessage message) {
if (message.getChangeType() != FileChangeType.DELETED) {
view.fileUpdated(message);
VizApp.runAsync(select);
}
moveTo.removeFileUpdatedObserver(observers[0]);
}
};
observers[0] = observer;
moveTo.addFileUpdatedObserver(observer);
} else {
VizApp.runAsync(select);
}
try (InputStream is = toMove.openInputStream();
SaveableOutputStream os = moveTo.openOutputStream()) {
FileUtil.copy(is, os);
os.save();
return true;
} catch (IOException | LocalizationException e) {
UFStatus.getHandler().handle(Priority.PROBLEM,
"Error copying file contents", e);
}
}
return false;
}
private boolean dropFile(List<LocalizationType> types, String dirPath, private boolean dropFile(List<LocalizationType> types, String dirPath,
File[] toCopyFiles) { File[] toCopyFiles) {
boolean oneGood = false; boolean oneGood = false;

View file

@ -65,21 +65,11 @@ public abstract class AbstractToAction extends Action implements IMenuCreator {
return this; return this;
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override @Override
public void run() { public void run() {
} }
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IMenuCreator#dispose()
*/
@Override @Override
public void dispose() { public void dispose() {
if (menu != null) { if (menu != null) {
@ -87,13 +77,6 @@ public abstract class AbstractToAction extends Action implements IMenuCreator {
} }
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets
* .Menu)
*/
@Override @Override
public Menu getMenu(Menu parent) { public Menu getMenu(Menu parent) {
if (menu != null) { if (menu != null) {

View file

@ -35,7 +35,6 @@ import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream; import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -57,6 +56,8 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Nov 3, 2010 mschenke Initial creation * Nov 3, 2010 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -84,14 +85,6 @@ public class CopyToAction extends AbstractToAction {
this(data.getFile(), data.getPathData(), service); this(data.getFile(), data.getPathData(), service);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.localization.perspective.view.actions.AbstractToAction
* #isLevelEnabled(com.raytheon.uf.common.localization.LocalizationContext.
* LocalizationLevel)
*/
@Override @Override
protected boolean isLevelEnabled(LocalizationLevel level) { protected boolean isLevelEnabled(LocalizationLevel level) {
boolean enabled = super.isLevelEnabled(level); boolean enabled = super.isLevelEnabled(level);
@ -102,21 +95,12 @@ public class CopyToAction extends AbstractToAction {
return enabled; return enabled;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.localization.filetreeview.actions.AbstractToAction
* #run
* (com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
* )
*/
@Override @Override
protected void run(LocalizationLevel level) { protected void run(LocalizationLevel level) {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
ILocalizationFile newFile = pm.getLocalizationFile( ILocalizationFile newFile = pm.getLocalizationFile(
pm.getContext(file.getContext().getLocalizationType(), level), pm.getContext(file.getContext().getLocalizationType(), level),
file.getName()); file.getPath());
removeAlternateTypeFiles(level); removeAlternateTypeFiles(level);
copyFile(newFile); copyFile(newFile);
} }
@ -133,12 +117,12 @@ public class CopyToAction extends AbstractToAction {
for (LocalizationType type : pathData.getTypes()) { for (LocalizationType type : pathData.getTypes()) {
if (type != file.getContext().getLocalizationType()) { if (type != file.getContext().getLocalizationType()) {
LocalizationFile altFile = pm.getLocalizationFile( ILocalizationFile altFile = pm.getLocalizationFile(
pm.getContext(type, level), file.getName()); pm.getContext(type, level), file.getPath());
if (altFile.exists()) { if (altFile.exists()) {
try { try {
altFile.delete(); altFile.delete();
} catch (LocalizationOpFailedException e) { } catch (LocalizationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Unable to delete existing " + type.name() "Unable to delete existing " + type.name()
+ " " + level + " file.", e); + " " + level + " file.", e);

View file

@ -25,13 +25,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorReference; import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException; import org.eclipse.ui.PartInitException;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -42,6 +43,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.dialogs.SWTMessageBox;
/** /**
* Deletes the selected localization file * Deletes the selected localization file
@ -55,6 +58,10 @@ import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInp
* Nov 3, 2010 mschenke Initial creation * Nov 3, 2010 mschenke Initial creation
* Feb 18, 2015 4132 mapeters Fixed issue with deleting overrides. * Feb 18, 2015 4132 mapeters Fixed issue with deleting overrides.
* Jun 29, 2015 946 rferrel Do not allow delete of a protected level file. * Jun 29, 2015 946 rferrel Do not allow delete of a protected level file.
* Nov 13, 2015 4946 mapeters Use SWTMessageBox instead of MessageDialog.
* Jan 15, 2016 5242 kbisanz Replaced LocalizationFile with
* ILocalizationFile where possible
* Jan 27, 2016 5054 randerso Cleaned up SWTMessageBox
* *
* </pre> * </pre>
* *
@ -92,28 +99,50 @@ public class DeleteAction extends Action {
@Override @Override
public void run() { public void run() {
String listOfFiles = ""; StringBuilder listOfFiles = new StringBuilder();
for (int i = 0; i < toDelete.length; ++i) { for (int i = 0; i < toDelete.length; ++i) {
listOfFiles += LocalizationUtil.extractName(toDelete[i].getName()) listOfFiles.append(LocalizationUtil.extractName(toDelete[i]
+ "\n"; .getPath()));
listOfFiles.append("\n");
} }
Shell shell = page.getWorkbenchWindow().getShell(); Shell shell = page.getWorkbenchWindow().getShell();
if (prompt) { if (prompt) {
boolean choice = MessageDialog.openConfirm( StringBuilder msg = new StringBuilder();
shell, msg.append("Are you sure you want to delete ");
"Delete Confirmation", if (toDelete.length > 1) {
listOfFiles msg.append("these " + toDelete.length + " items");
+ String.format( } else {
"\n\nAre you sure you want to delete %s?", msg.append("this file");
toDelete.length > 1 ? "these items" }
: "this file")); msg.append("?\n\n").append(listOfFiles);
if (!choice) {
return; SWTMessageBox messageDialog = new SWTMessageBox(shell,
"Delete Confirmation", msg.toString(), SWT.OK | SWT.CANCEL
| SWT.ICON_QUESTION);
messageDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof Integer) {
if ((int) returnValue == SWT.OK) {
deleteFiles();
} }
} }
List<IEditorReference> toClose = new ArrayList<IEditorReference>(); }
});
messageDialog.open();
}
}
/**
* Delete the selected files and all associated file extension variations.
*/
private void deleteFiles() {
List<IEditorReference> toClose = new ArrayList<>();
// check for open editors and close them // check for open editors and close them
for (IEditorReference ref : page.getEditorReferences()) { for (IEditorReference ref : page.getEditorReferences()) {
IEditorInput input = null; IEditorInput input = null;
@ -125,10 +154,11 @@ public class DeleteAction extends Action {
+ "file was open (in order to close it)", e); + "file was open (in order to close it)", e);
} }
if (input instanceof LocalizationEditorInput) { if (input instanceof LocalizationEditorInput) {
LocalizationFile editorFile = ((LocalizationEditorInput) input) ILocalizationFile editorFile = ((LocalizationEditorInput) input)
.getLocalizationFile(); .getLocalizationFile();
for (LocalizationFile file : toDelete) { String editorFilePath = editorFile.getPath();
if ((editorFile.compareTo(file) == 0) for (ILocalizationFile file : toDelete) {
if ((editorFilePath.equals(file.getPath()))
&& editorFile.getContext() && editorFile.getContext()
.equals(file.getContext())) { .equals(file.getContext())) {
toClose.add(ref); toClose.add(ref);
@ -144,7 +174,7 @@ public class DeleteAction extends Action {
false); false);
} }
for (LocalizationFile file : toDelete) { for (ILocalizationFile file : toDelete) {
try { try {
deleteFile(file); deleteFile(file);
} catch (Exception e) { } catch (Exception e) {
@ -161,10 +191,10 @@ public class DeleteAction extends Action {
* The file to delete * The file to delete
* @throws Exception * @throws Exception
*/ */
private void deleteFile(LocalizationFile file) throws Exception { private void deleteFile(ILocalizationFile file) throws Exception {
if (file.isDirectory() == false) { if (file.isDirectory() == false) {
// Check for file extension // Check for file extension
String name = LocalizationUtil.extractName(file.getName()); String name = LocalizationUtil.extractName(file.getPath());
String[] parts = name.split("[.]"); String[] parts = name.split("[.]");
if (parts.length > 1) { if (parts.length > 1) {
@ -174,11 +204,11 @@ public class DeleteAction extends Action {
if (associated != null) { if (associated != null) {
String[] extensions = associated.split(","); String[] extensions = associated.split(",");
String path = file.getName().substring(0, String path = file.getPath().substring(0,
file.getName().lastIndexOf(name)); file.getPath().lastIndexOf(name));
String prefix = ""; String prefix = "";
for (int i = 0; i < parts.length - 1; ++i) { for (int i = 0; i < (parts.length - 1); ++i) {
if (i > 0) { if (i > 0) {
prefix += "."; prefix += ".";
} }
@ -193,7 +223,7 @@ public class DeleteAction extends Action {
for (String extension : extensions) { for (String extension : extensions) {
String deletePath = path + "." + extension; String deletePath = path + "." + extension;
LocalizationFile result = pathManager ILocalizationFile result = pathManager
.getLocalizationFile(ctx, deletePath); .getLocalizationFile(ctx, deletePath);
if (result != null) { if (result != null) {
result.delete(); result.delete();

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
* Jun 11, 2015 4541 skorolev Added NULL test for lf. * Jun 11, 2015 4541 skorolev Added NULL test for lf.
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* Dec 03, 2015 4834 njensen Updated for ILocalizationFile changes
* *
* </pre> * </pre>
* *
@ -88,8 +89,7 @@ public class ImportFileAction extends Action {
} }
public ImportFileAction(List<LocalizationType> contextTypes, public ImportFileAction(List<LocalizationType> contextTypes,
String directoryPath, String directoryPath, String[] filter) {
String[] filter) {
this(contextTypes, directoryPath); this(contextTypes, directoryPath);
if (filter != null) { if (filter != null) {
this.fileExtensionFilterArr = new String[filter.length]; this.fileExtensionFilterArr = new String[filter.length];
@ -182,7 +182,7 @@ public class ImportFileAction extends Action {
ILocalizationFile file = existing.get(0); ILocalizationFile file = existing.get(0);
if (MessageDialog.openConfirm(VizWorkbenchManager.getInstance() if (MessageDialog.openConfirm(VizWorkbenchManager.getInstance()
.getCurrentWindow().getShell(), "Confirm Overwrite", .getCurrentWindow().getShell(), "Confirm Overwrite",
String.format(FORMAT_STRING, file.getName(), file String.format(FORMAT_STRING, file.getPath(), file
.getContext().getLocalizationLevel()))) { .getContext().getLocalizationLevel()))) {
existing.clear(); existing.clear();
} }
@ -288,7 +288,7 @@ public class ImportFileAction extends Action {
private void updateText() { private void updateText() {
ILocalizationFile file = existingFiles.get(curIdx); ILocalizationFile file = existingFiles.get(curIdx);
messageLabel.setText(String.format(FORMAT_STRING, file.getName(), messageLabel.setText(String.format(FORMAT_STRING, file.getPath(),
file.getContext().getLocalizationLevel())); file.getContext().getLocalizationLevel()));
} }

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Mar 25, 2011 mschenke Initial creation * Mar 25, 2011 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* *
* </pre> * </pre>
@ -80,14 +81,6 @@ public class MoveFileAction extends CopyToAction {
setEnabled(delete.isEnabled()); setEnabled(delete.isEnabled());
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.localization.perspective.view.actions.AbstractToAction
* #isLevelEnabled(com.raytheon.uf.common.localization.LocalizationContext.
* LocalizationLevel)
*/
@Override @Override
protected boolean isLevelEnabled(LocalizationLevel level) { protected boolean isLevelEnabled(LocalizationLevel level) {
boolean enabled = super.isLevelEnabled(level); boolean enabled = super.isLevelEnabled(level);
@ -105,7 +98,7 @@ public class MoveFileAction extends CopyToAction {
page.getWorkbenchWindow().getShell(), page.getWorkbenchWindow().getShell(),
"Move Confirmation", "Move Confirmation",
"Are you sure you want to move " "Are you sure you want to move "
+ LocalizationUtil.extractName(file.getName()) + LocalizationUtil.extractName(file.getPath())
+ " to " + " to "
+ level + level
+ " replacing any existing file and deleting this file?"); + " replacing any existing file and deleting this file?");
@ -113,7 +106,7 @@ public class MoveFileAction extends CopyToAction {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
final LocalizationFile newFile = pm.getLocalizationFile( final LocalizationFile newFile = pm.getLocalizationFile(
pm.getContext(file.getContext().getLocalizationType(), pm.getContext(file.getContext().getLocalizationType(),
level), file.getName()); level), file.getPath());
removeAlternateTypeFiles(level); removeAlternateTypeFiles(level);
// Make sure we select the file after the drop // Make sure we select the file after the drop
final ILocalizationFileObserver[] observers = new ILocalizationFileObserver[1]; final ILocalizationFileObserver[] observers = new ILocalizationFileObserver[1];
@ -121,7 +114,7 @@ public class MoveFileAction extends CopyToAction {
@Override @Override
public void fileUpdated(FileUpdatedMessage message) { public void fileUpdated(FileUpdatedMessage message) {
if (message.getContext().equals(newFile.getContext()) if (message.getContext().equals(newFile.getContext())
&& message.getFileName().equals(newFile.getName()) && message.getFileName().equals(newFile.getPath())
&& message.getChangeType() != FileChangeType.DELETED) { && message.getChangeType() != FileChangeType.DELETED) {
service.fileUpdated(message); service.fileUpdated(message);
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.localization.perspective.view.actions;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -43,6 +44,8 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Dec 3, 2010 6305 mpduff Initial creation * Dec 3, 2010 6305 mpduff Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* Jan 15, 2016 5242 kbisanz Replaced LocalizationFile with
* ILocalizationFile where possible
* *
* *
* </pre> * </pre>
@ -81,12 +84,12 @@ public class PasteFileAction extends CopyToAction {
List<LocalizationType> types = dataToCopyTo.getPathData().getTypes(); List<LocalizationType> types = dataToCopyTo.getPathData().getTypes();
LocalizationType type = file.getContext().getLocalizationType(); LocalizationType type = file.getContext().getLocalizationType();
if(!types.contains(type)){ if (!types.contains(type)) {
type = types.get(0); type = types.get(0);
} }
LocalizationContext ctx = pm.getContext(type, level); LocalizationContext ctx = pm.getContext(type, level);
LocalizationFile newFile = pm.getLocalizationFile(ctx, ILocalizationFile newFile = pm.getLocalizationFile(ctx,
dataToCopyTo.getPath()); dataToCopyTo.getPath());
removeAlternateTypeFiles(level); removeAlternateTypeFiles(level);
copyFile(newFile); copyFile(newFile);

View file

@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType; import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.ILocalizationFileObserver; import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -57,6 +58,7 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
* Apr 27, 2011 mschenke Initial creation * Apr 27, 2011 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix * Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types. * files for multiple Localization Types.
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* *
* </pre> * </pre>
@ -107,13 +109,13 @@ public class RenameAction extends Action {
} }
} }
private LocalizationFile file; private ILocalizationFile file;
private ILocalizationService service; private ILocalizationService service;
private boolean deleteOld; private boolean deleteOld;
public RenameAction(LocalizationFile file, ILocalizationService service, public RenameAction(ILocalizationFile file, ILocalizationService service,
boolean deleteOld) { boolean deleteOld) {
super("Rename...", IAction.AS_PUSH_BUTTON); super("Rename...", IAction.AS_PUSH_BUTTON);
// Only set not enabled if we are deleting the old file and level is a // Only set not enabled if we are deleting the old file and level is a
@ -125,13 +127,13 @@ public class RenameAction extends Action {
this.deleteOld = deleteOld; this.deleteOld = deleteOld;
} }
public RenameAction(LocalizationFile file, ILocalizationService service) { public RenameAction(ILocalizationFile file, ILocalizationService service) {
this(file, service, true); this(file, service, true);
} }
@Override @Override
public void run() { public void run() {
String path = file.getName(); String path = file.getPath();
String[] pathParts = LocalizationUtil.splitUnique(path); String[] pathParts = LocalizationUtil.splitUnique(path);
final String name = pathParts[pathParts.length - 1]; final String name = pathParts[pathParts.length - 1];
Shell parent = VizWorkbenchManager.getInstance().getCurrentWindow() Shell parent = VizWorkbenchManager.getInstance().getCurrentWindow()

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Ffmp Plug-in Bundle-Name: Ffmp Plug-in
Bundle-SymbolicName: com.raytheon.uf.viz.monitor.ffmp;singleton:=true Bundle-SymbolicName: com.raytheon.uf.viz.monitor.ffmp;singleton:=true
Bundle-Version: 1.14.0.qualifier Bundle-Version: 1.15.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.monitor.ffmp.Activator Bundle-Activator: com.raytheon.uf.viz.monitor.ffmp.Activator
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,
@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.ui;bundle-version="1.10.13", com.raytheon.viz.ui;bundle-version="1.10.13",
com.raytheon.uf.viz.monitor;bundle-version="1.11.1", com.raytheon.uf.viz.monitor;bundle-version="1.11.1",
com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.11.9", com.raytheon.uf.common.dataplugin.ffmp;bundle-version="1.11.9",
org.apache.commons.lang;bundle-version="2.3.0",
com.raytheon.uf.viz.d2d.core;bundle-version="1.11.15", com.raytheon.uf.viz.d2d.core;bundle-version="1.11.15",
com.raytheon.uf.viz.localization, com.raytheon.uf.viz.localization,
com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization,

View file

@ -19,15 +19,13 @@
**/ **/
package com.raytheon.uf.viz.monitor.ffmp; package com.raytheon.uf.viz.monitor.ffmp;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Set; import java.util.Set;
import com.raytheon.uf.common.monitor.data.MonitorConfigConstants.ffmpTable;
import com.raytheon.uf.common.monitor.data.MonitorConfigConstants.tableFields;
import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.ffmpTable;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.tableFields;
/** /**
* FFMPMonitorConfiguration object stores configuration data specific to FFMP. * FFMPMonitorConfiguration object stores configuration data specific to FFMP.
@ -38,6 +36,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.tableFields;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 29 June, 2009 2521 dhladky Initial creation * 29 June, 2009 2521 dhladky Initial creation
* Jan 04, 2016 5115 skorolev Corrected imports.
* *
* </pre> * </pre>
* *
@ -56,64 +55,17 @@ public class FFMPMonitorConfiguration {
* Constructor * Constructor
*/ */
public FFMPMonitorConfiguration() { public FFMPMonitorConfiguration() {
// reload(getStore());
}
/** }
* Save the configuration object to a file.
*
* @throws IOException
*/
// public void save() throws IOException {
// HierarchicalPreferenceStore store = getStore();
//
// // Save SCAN Stuff here
// store.setValue(MonitorConfigConstants.SCAN_PLUGIN_NAME, pluginName);
//
// // cell table
// String[] tempTableAttributes = new String[ffmpTableAttributes.length];
//
// for (int i = 0; i < tempTableAttributes.length; i++) {
// tempTableAttributes[i] = Boolean.toString(ffmpTableAttributes[i]);
// }
//
// store.setValue(MonitorConfigConstants.SCAN_TVS_TABLE_ATTRIB,
// tempTableAttributes);
//
// store.save();
// }
/** /**
* @return HierarchicalPreferenceStore * @return HierarchicalPreferenceStore
*/ */
private HierarchicalPreferenceStore getStore() { private HierarchicalPreferenceStore getStore() {
return (HierarchicalPreferenceStore) Activator.getDefault().getPreferenceStore(); return (HierarchicalPreferenceStore) Activator.getDefault()
.getPreferenceStore();
} }
/**
* Load the internal data structures from the HierarchicalPreferenceStore.
*
* @param store
* HierarchicalPreferenceStore
*/
// private void reload(HierarchicalPreferenceStore store) {
// // Load SCAN Stuff here
// // pluginName
// this.pluginName = store
// .getStringArray(MonitorConfigConstants.SCAN_PLUGIN_NAME);
//
// // cell table
// String[] tempTableAttributes = store
// .getStringArray(MonitorConfigConstants.SCAN_CELL_TABLE_ATTRIB);
//
// ffmpTableAttributes = new boolean[tempTableAttributes.length];
// for (int i = 0; i < tempTableAttributes.length; i++) {
// this.ffmpTableAttributes[i] = Boolean
// .valueOf(tempTableAttributes[i]);
// }
//
// }
/** /**
* Retrieve one set of values for all attributes on a given table. * Retrieve one set of values for all attributes on a given table.
* *
@ -134,7 +86,6 @@ public class FFMPMonitorConfiguration {
map.put(table.toString(), value); map.put(table.toString(), value);
} }
return map; return map;
} }
@ -151,15 +102,13 @@ public class FFMPMonitorConfiguration {
HashMap<String, String> map = new HashMap<String, String>(); HashMap<String, String> map = new HashMap<String, String>();
for (tableFields field : tableFields.values()) { for (tableFields field : tableFields.values()) {
map.put(field.toString(), store map.put(field.toString(),
.getString(attribute.toString(field))); store.getString(attribute.toString(field)));
} }
return map; return map;
} }
/** /**
* Retrieve the threshold data for one of the SCAN tables. Only returns * Retrieve the threshold data for one of the SCAN tables. Only returns
* those attributes that have thresholds other than the default "999" value. * those attributes that have thresholds other than the default "999" value.
@ -203,7 +152,6 @@ public class FFMPMonitorConfiguration {
getStore().setValue(attribute.toString(field), value); getStore().setValue(attribute.toString(field), value);
} }
/** /**
* @return String[] pluginName * @return String[] pluginName
*/ */

View file

@ -39,6 +39,22 @@ import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
/**
* FFTI Slider Canvas
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 05, 2015 #5070 randerso Changed to use system font name (not AWT)
*
* </pre>
*
* @author randerso
* @version 1.0
*/
public class FFTISliderCanvas { public class FFTISliderCanvas {
private Composite parentComp; private Composite parentComp;
@ -160,7 +176,8 @@ public class FFTISliderCanvas {
display = this.parentComp.getDisplay(); display = this.parentComp.getDisplay();
this.attribVal = accumAttrib; this.attribVal = accumAttrib;
setValuesNoRedraw(attribVal.getMin(), attribVal.getMax(), attribVal.getInc(), attribVal.getRedThreshold(), setValuesNoRedraw(attribVal.getMin(), attribVal.getMax(),
attribVal.getInc(), attribVal.getRedThreshold(),
attribVal.getYellowThreshold()); attribVal.getYellowThreshold());
init(); init();
@ -182,7 +199,7 @@ public class FFTISliderCanvas {
upperLblRect = new Rectangle(0, 0, 0, 0); upperLblRect = new Rectangle(0, 0, 0, 0);
lowerLblRect = new Rectangle(0, 0, 0, 0); lowerLblRect = new Rectangle(0, 0, 0, 0);
labelFont = new Font(display, "Monospaced", 10, SWT.BOLD); labelFont = new Font(display, "Monospace", 10, SWT.BOLD);
mousePt = new Point(0, 0); mousePt = new Point(0, 0);
upperRegion = new Region(display); upperRegion = new Region(display);
lowerRegion = new Region(display); lowerRegion = new Region(display);
@ -201,6 +218,7 @@ public class FFTISliderCanvas {
canvas.setLayoutData(gd); canvas.setLayoutData(gd);
canvas.addPaintListener(new PaintListener() { canvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) { public void paintControl(PaintEvent e) {
drawCanvas(e.gc); drawCanvas(e.gc);
} }
@ -209,12 +227,14 @@ public class FFTISliderCanvas {
canvas.addMouseListener(new MouseAdapter() { canvas.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseDown(MouseEvent e) { public void mouseDown(MouseEvent e) {
if (upperRegion.contains(e.x, e.y) == true || upperLblRect.contains(e.x, e.y) == true) { if (upperRegion.contains(e.x, e.y) == true
|| upperLblRect.contains(e.x, e.y) == true) {
mousePt.x = e.x; mousePt.x = e.x;
mousePt.y = e.y; mousePt.y = e.y;
mouseDown = true; mouseDown = true;
moveUpper = true; moveUpper = true;
} else if (lowerRegion.contains(e.x, e.y) == true || lowerLblRect.contains(e.x, e.y) == true) { } else if (lowerRegion.contains(e.x, e.y) == true
|| lowerLblRect.contains(e.x, e.y) == true) {
mousePt.x = e.x; mousePt.x = e.x;
mousePt.y = e.y; mousePt.y = e.y;
mouseDown = true; mouseDown = true;
@ -259,10 +279,12 @@ public class FFTISliderCanvas {
gc.fillRectangle(barXCoord, barYCoord, barWidth, barHeight); gc.fillRectangle(barXCoord, barYCoord, barWidth, barHeight);
gc.setBackground(yellowColor); gc.setBackground(yellowColor);
gc.fillRectangle(lowerArrowXCoord, barYCoord, barWidth + 25 - lowerArrowXCoord, barHeight); gc.fillRectangle(lowerArrowXCoord, barYCoord, barWidth + 25
- lowerArrowXCoord, barHeight);
gc.setBackground(redColor); gc.setBackground(redColor);
gc.fillRectangle(upperArrowXCoord, barYCoord, barWidth + 25 - upperArrowXCoord, barHeight); gc.fillRectangle(upperArrowXCoord, barYCoord, barWidth + 25
- upperArrowXCoord, barHeight);
gc.setForeground(blackColor); gc.setForeground(blackColor);
gc.drawRectangle(barXCoord, barYCoord, barWidth, barHeight); gc.drawRectangle(barXCoord, barYCoord, barWidth, barHeight);
@ -276,7 +298,8 @@ public class FFTISliderCanvas {
private void updateUpperArrow(GC gc) { private void updateUpperArrow(GC gc) {
upperRegion.subtract(upperPtArray); upperRegion.subtract(upperPtArray);
upperPtArray = new int[] { upperArrowXCoord, barBottomYCoord - barHeight - 3, upperArrowXCoord + 4, upperPtArray = new int[] { upperArrowXCoord,
barBottomYCoord - barHeight - 3, upperArrowXCoord + 4,
barBottomYCoord, upperArrowXCoord - 4, barBottomYCoord }; barBottomYCoord, upperArrowXCoord - 4, barBottomYCoord };
upperRegion.add(upperPtArray); upperRegion.add(upperPtArray);
@ -301,7 +324,8 @@ public class FFTISliderCanvas {
private void updateLowerArrow(GC gc) { private void updateLowerArrow(GC gc) {
lowerRegion.subtract(lowerPtArray); lowerRegion.subtract(lowerPtArray);
lowerPtArray = new int[] { lowerArrowXCoord, barBottomYCoord - barHeight - 3, lowerArrowXCoord + 4, lowerPtArray = new int[] { lowerArrowXCoord,
barBottomYCoord - barHeight - 3, lowerArrowXCoord + 4,
barBottomYCoord, lowerArrowXCoord - 4, barBottomYCoord }; barBottomYCoord, lowerArrowXCoord - 4, barBottomYCoord };
lowerRegion.add(lowerPtArray); lowerRegion.add(lowerPtArray);
@ -314,7 +338,8 @@ public class FFTISliderCanvas {
private void updateLowerLabel(GC gc) { private void updateLowerLabel(GC gc) {
gc.setForeground(yellowColor); gc.setForeground(yellowColor);
lowerStr = calcDisplayString(lowerDisplayVal); lowerStr = calcDisplayString(lowerDisplayVal);
int lblXCoord = (int) (lowerArrowXCoord - ((double) textWidth * (double) lowerStr.length() / 2)); int lblXCoord = (int) (lowerArrowXCoord - ((double) textWidth
* (double) lowerStr.length() / 2));
gc.drawString(lowerStr, lblXCoord, lowerLblYCoord, true); gc.drawString(lowerStr, lblXCoord, lowerLblYCoord, true);
lowerLblRect.x = lblXCoord; lowerLblRect.x = lblXCoord;
lowerLblRect.y = lowerLblYCoord; lowerLblRect.y = lowerLblYCoord;
@ -379,17 +404,18 @@ public class FFTISliderCanvas {
double xCoordAsValue = (xCoord - barXCoord) * incPerPixel + minValue; double xCoordAsValue = (xCoord - barXCoord) * incPerPixel + minValue;
if (xCoordAsValue >= this.maxValue) //no rounding for max value if (xCoordAsValue >= this.maxValue) {
return this.maxValue; return this.maxValue;
}
if (incValue == .25) { if (incValue == .25) {
return (Math.round(xCoordAsValue * 4.00)) / 4.00; return (Math.round(xCoordAsValue * 4.00)) / 4.00;
} else if (incValue == .05) { } else if (incValue == .05) {
return (double) (Math.round(xCoordAsValue * 20.0) / 20.0); return Math.round(xCoordAsValue * 20.0) / 20.0;
} else if (incValue == .10) { } else if (incValue == .10) {
return (Math.round(xCoordAsValue * 10.00)) / 10.00; return (Math.round(xCoordAsValue * 10.00)) / 10.00;
} else { } else {
return (double) Math.round(xCoordAsValue); return Math.round(xCoordAsValue);
} }
} }
@ -402,12 +428,14 @@ public class FFTISliderCanvas {
} }
private int calcValueToBarXCoord(double val) { private int calcValueToBarXCoord(double val) {
int result = (int) Math.round((val - minValue) / incPerPixel + barXCoord); int result = (int) Math.round((val - minValue) / incPerPixel
+ barXCoord);
return result; return result;
} }
private void setValuesNoRedraw(double min, double max, double inc, double startingUpperVal, double startingLowerVal) { private void setValuesNoRedraw(double min, double max, double inc,
double startingUpperVal, double startingLowerVal) {
if (max < min) { if (max < min) {
return; return;
} }
@ -417,7 +445,7 @@ public class FFTISliderCanvas {
this.rangeValue = max - min; this.rangeValue = max - min;
this.incValue = inc; this.incValue = inc;
incPerPixel = this.rangeValue / (double) barWidth; incPerPixel = this.rangeValue / barWidth;
if (inc < 1.00) { if (inc < 1.00) {
displayAtInt = false; displayAtInt = false;
@ -436,11 +464,12 @@ public class FFTISliderCanvas {
public void setValues(FFTIAttribute attribVal) { public void setValues(FFTIAttribute attribVal) {
this.attribVal = attribVal; this.attribVal = attribVal;
setValues(attribVal.getMin(), attribVal.getMax(), attribVal.getInc(), attribVal.getRedThreshold(), setValues(attribVal.getMin(), attribVal.getMax(), attribVal.getInc(),
attribVal.getYellowThreshold()); attribVal.getRedThreshold(), attribVal.getYellowThreshold());
} }
public void setValues(double min, double max, double inc, double startingUpperVal, double startingLowerVal) { public void setValues(double min, double max, double inc,
double startingUpperVal, double startingLowerVal) {
setValuesNoRedraw(min, max, inc, startingUpperVal, startingLowerVal); setValuesNoRedraw(min, max, inc, startingUpperVal, startingLowerVal);
canvas.redraw(); canvas.redraw();
} }
@ -456,12 +485,15 @@ public class FFTISliderCanvas {
startingUpperVal = maxValue; startingUpperVal = maxValue;
startingLowerVal = maxValue; startingLowerVal = maxValue;
setValues(this.minValue, this.maxValue, this.incValue, startingUpperVal, startingLowerVal); setValues(this.minValue, this.maxValue, this.incValue,
startingUpperVal, startingLowerVal);
} else if (upperDisplayVal > maxValue) { } else if (upperDisplayVal > maxValue) {
startingUpperVal = maxValue; startingUpperVal = maxValue;
setValues(this.minValue, this.maxValue, this.incValue, startingUpperVal, getLowerValue()); setValues(this.minValue, this.maxValue, this.incValue,
startingUpperVal, getLowerValue());
} else { } else {
setValues(this.minValue, this.maxValue, this.incValue, getUpperValue(), getLowerValue()); setValues(this.minValue, this.maxValue, this.incValue,
getUpperValue(), getLowerValue());
} }
} }

View file

@ -45,6 +45,7 @@ import org.eclipse.swt.widgets.Display;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* ???????????? lvenable Initial creation * ???????????? lvenable Initial creation
* Oct 10, 2013 #2464 lvenable Fix font memory leak. * Oct 10, 2013 #2464 lvenable Fix font memory leak.
* Nov 05, 2015 #5070 randerso Changed to use system font name (not AWT)
* *
* </pre> * </pre>
* *
@ -124,7 +125,7 @@ public class ToggleCanvas {
} }
private void init() { private void init() {
labelFont = new Font(display, "Monospaced", 10, SWT.BOLD); labelFont = new Font(display, "Monospace", 10, SWT.BOLD);
parentComp.addDisposeListener(new DisposeListener() { parentComp.addDisposeListener(new DisposeListener() {
@Override @Override
@ -145,6 +146,7 @@ public class ToggleCanvas {
canvas.setLayoutData(gd); canvas.setLayoutData(gd);
canvas.addPaintListener(new PaintListener() { canvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) { public void paintControl(PaintEvent e) {
drawCanvas(e.gc); drawCanvas(e.gc);
} }

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs; package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import java.io.File; import java.io.File;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.HashMap; import java.util.HashMap;
@ -32,9 +33,11 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.xml.FFMPRunXML; import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
@ -61,6 +64,9 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
* Apr 12, 2013 1902 mpduff Speed up cell coloring. * Apr 12, 2013 1902 mpduff Speed up cell coloring.
* Apr 15, 2013 1904 mpduff Don't allow this class to be nulled out * Apr 15, 2013 1904 mpduff Don't allow this class to be nulled out
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP. * Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* and replace printStackTrace with
* statusHandler.error()
* *
* </pre> * </pre>
* *
@ -192,16 +198,16 @@ public class FFMPConfig {
readDefaultFFMPConfigBasin(); readDefaultFFMPConfigBasin();
} }
private void readNewFFMPConfigBasin(LocalizationFile xmlFileName) { private void readNewFFMPConfigBasin(ILocalizationFile xmlFileName) {
ffmpCfgBasin = null; ffmpCfgBasin = null;
try { try (InputStream strm = xmlFileName.openInputStream()) {
ffmpCfgBasin = JAXB.unmarshal(xmlFileName.getFile(), ffmpCfgBasin = JAXB.unmarshal(strm, FFMPConfigBasinXML.class);
FFMPConfigBasinXML.class);
createThresholdManager(); createThresholdManager();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); statusHandler.error("Error reading FFMP Basin config "
+ xmlFileName.getPath(), e);
} }
} }
@ -220,26 +226,26 @@ public class FFMPConfig {
return; return;
} }
System.out.println("Path Config FFMP: " + file.getAbsolutePath()); ffmpCfgBasin = JAXB.unmarshal(file, FFMPConfigBasinXML.class);
ffmpCfgBasin = JAXB.unmarshal(file,
FFMPConfigBasinXML.class);
createThresholdManager(); createThresholdManager();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); statusHandler.error("Error reading default FFMP Basin config "
+ DEFAULT_CONFIG_XML, e);
} }
} }
public void saveFFMPBasinConfig(LocalizationFile xmlFileName) { public void saveFFMPBasinConfig(ILocalizationFile xmlFileName) {
try { try (SaveableOutputStream strm = xmlFileName.openOutputStream()) {
JAXB.marshal(ffmpCfgBasin, xmlFileName.getFile()); JAXB.marshal(ffmpCfgBasin, strm);
xmlFileName.save(); strm.save();
createThresholdManager(); createThresholdManager();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); statusHandler.error(
"Error saving FFMP Basin config " + xmlFileName.getPath(),
e);
} }
} }

View file

@ -39,11 +39,11 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; 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.PathManagerFactory;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -57,8 +57,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Initial creation * Initial creation
* Dec 6, 2012 1353 rferrel Make dialog non-blocking. * Dec 06, 2012 1353 rferrel Make dialog non-blocking.
* Apr 01, 2013 1830 mpduff Don't allow base files. * Apr 01, 2013 1830 mpduff Don't allow base files.
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* *
* </pre> * </pre>
* *
@ -87,9 +88,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
private List cfgFileList; private List cfgFileList;
private LocalizationFile[] locFiles; private TreeMap<String, ILocalizationFile> locFileMap;
private TreeMap<String, LocalizationFile> locFileMap;
private Text newFileNameTF; private Text newFileNameTF;
@ -122,7 +121,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
locFileMap = new TreeMap<String, LocalizationFile>(); locFileMap = new TreeMap<>();
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL); controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
createListControl(); createListControl();
@ -278,7 +277,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
LocalizationContext context = pm.getContext( LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, level); LocalizationType.CAVE_STATIC, level);
String newFileName = "ffmp/guiConfig/" + fileName; String newFileName = "ffmp/guiConfig/" + fileName;
LocalizationFile selectedFile = pm.getLocalizationFile(context, ILocalizationFile selectedFile = pm.getLocalizationFile(context,
newFileName); newFileName);
FFMPConfig.getInstance().saveFFMPBasinConfig(selectedFile); FFMPConfig.getInstance().saveFFMPBasinConfig(selectedFile);
@ -318,12 +317,12 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
String[] extensions = new String[] { ".xml" }; String[] extensions = new String[] { ".xml" };
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
ArrayList<LocalizationContext> contextList = new ArrayList<LocalizationContext>(); java.util.List<LocalizationContext> contextList = new ArrayList<>();
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC, contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.SITE)); LocalizationLevel.SITE));
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC, contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.USER)); LocalizationLevel.USER));
locFiles = pm.listFiles(contextList ILocalizationFile[] locFiles = pm.listFiles(contextList
.toArray(new LocalizationContext[contextList.size()]), .toArray(new LocalizationContext[contextList.size()]),
"ffmp/guiConfig", extensions, false, true); "ffmp/guiConfig", extensions, false, true);
@ -333,7 +332,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
for (int i = 0; i < locFiles.length; i++) { for (int i = 0; i < locFiles.length; i++) {
locFileMap.put(locFiles[i].getContext().getLocalizationLevel() locFileMap.put(locFiles[i].getContext().getLocalizationLevel()
+ ":" + locFiles[i].getName(), locFiles[i]); + ":" + locFiles[i].getPath(), locFiles[i]);
} }
for (String str : locFileMap.keySet()) { for (String str : locFileMap.keySet()) {

View file

@ -27,11 +27,13 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.colormap.Color; import com.raytheon.uf.common.colormap.Color;
import com.raytheon.uf.common.colormap.ColorMap; import com.raytheon.uf.common.colormap.ColorMap;
import com.raytheon.uf.common.colormap.ColorMapException;
import com.raytheon.uf.common.colormap.ColorMapLoader;
import com.raytheon.uf.common.colormap.IColorMap; import com.raytheon.uf.common.colormap.IColorMap;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
@ -40,7 +42,6 @@ import com.raytheon.uf.common.style.StyleManager;
import com.raytheon.uf.common.style.StyleRule; import com.raytheon.uf.common.style.StyleRule;
import com.raytheon.uf.common.style.StyleRuleset; import com.raytheon.uf.common.style.StyleRuleset;
import com.raytheon.uf.common.style.image.ImagePreferences; import com.raytheon.uf.common.style.image.ImagePreferences;
import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
/** /**
@ -56,8 +57,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
* 05/21/12 DR 14833 G. Zhang Error handling for invalid cmap * 05/21/12 DR 14833 G. Zhang Error handling for invalid cmap
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP. * Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* Jun 10, 2013 2075 njensen Improved init time * Jun 10, 2013 2075 njensen Improved init time
* Sep 5, 2013 2051 mnash Moved style rule instantiation so that we don't get NPEs * Sep 05, 2013 2051 mnash Moved style rule instantiation so that we don't get NPEs
* Sep 28, 2015 4756 dhladky Multiple guidance style rules for FFMP. * Sep 28, 2015 4756 dhladky Multiple guidance style rules for FFMP.
* Dec 10, 2015 4834 njensen Use non-deprecated ColorMapLoader
*
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -130,9 +133,9 @@ public class FFMPColorUtils {
try { try {
cxml = ColorMapLoader.loadColorMap(colormapfile); cxml = ColorMapLoader.loadColorMap(colormapfile);
} catch (VizException e) { } catch (ColorMapException e) {
statusHandler.error("Error loading ColorMap file: field: " + field statusHandler.error("Error loading ColorMap file: field: "
+ " time: " + time + " ffgName: " + ffgName + field + " time: " + time + " ffgName: " + ffgName
+ " TableLoad: " + tableLoad, e); + " TableLoad: " + tableLoad, e);
} }
@ -344,9 +347,9 @@ public class FFMPColorUtils {
private List<String> getQpeColorMapFiles() { private List<String> getQpeColorMapFiles() {
List<String> colormaps = new ArrayList<String>(); List<String> colormaps = new ArrayList<String>();
LocalizationFile[] files = ColorMapLoader.listColorMapFiles("ffmp"); ILocalizationFile[] files = ColorMapLoader.listColorMapFiles("ffmp");
for (LocalizationFile file : files) { for (ILocalizationFile file : files) {
String fn = file.getName(); String fn = file.getPath();
if (fn.indexOf("qpe") > 0) { if (fn.indexOf("qpe") > 0) {
colormaps.add(fn); colormaps.add(fn);
} }
@ -395,9 +398,6 @@ public class FFMPColorUtils {
if (DEFAULT_PARAMNAME.equalsIgnoreCase(pn) if (DEFAULT_PARAMNAME.equalsIgnoreCase(pn)
&& DEFAULT_COLORMAP.equalsIgnoreCase(cm)) { && DEFAULT_COLORMAP.equalsIgnoreCase(cm)) {
sr = srl; sr = srl;
System.out
.println("FFMPColorUtils.getDefaultColorMap(): StyleRule pn-cm value: "
+ pn + "-" + cm);
break; break;
} }
@ -410,8 +410,8 @@ public class FFMPColorUtils {
// load the colormap // load the colormap
try { try {
cxml = ColorMapLoader.loadColorMap(colormapfile); cxml = ColorMapLoader.loadColorMap(colormapfile);
} catch (VizException e) { } catch (ColorMapException e) {
e.printStackTrace(); statusHandler.error("Error loading colormap " + colormapfile, e);
} }
return cxml; return cxml;

View file

@ -202,6 +202,8 @@ import com.vividsolutions.jts.geom.Point;
* Feb 13, 2015 4121 mpduff Change label caching. * Feb 13, 2015 4121 mpduff Change label caching.
* Sep 28, 2015 4756 dhladky Multiple guidance sources. * Sep 28, 2015 4756 dhladky Multiple guidance sources.
* Oct 26, 2015 5056 dhladky Simplified Guidance Interpolation. * Oct 26, 2015 5056 dhladky Simplified Guidance Interpolation.
* Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
*
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -1254,7 +1256,7 @@ public class FFMPResource extends
public void run() { public void run() {
if (font == null) { if (font == null) {
font = target.initializeFont("Dialog", 11, null); font = target.initializeFont("Dialog", 9, null);
} }
font.setMagnification(getCapability( font.setMagnification(getCapability(
@ -1263,7 +1265,7 @@ public class FFMPResource extends
if (xfont == null) { if (xfont == null) {
IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD }; IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD };
xfont = target.initializeFont("Monospace", 12, styles); xfont = target.initializeFont("Monospace", 10, styles);
} }
xfont.setMagnification(getCapability( xfont.setMagnification(getCapability(
@ -3190,7 +3192,8 @@ public class FFMPResource extends
ITimer timer = TimeUtil.getTimer(); ITimer timer = TimeUtil.getTimer();
timer.start(); timer.start();
FfmpTableConfig tableConfig = FfmpTableConfig.getInstance(); FfmpTableConfig tableConfig = FfmpTableConfig.getInstance();
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey()).getFfgGraphType(); String ffgGraphType = tableConfig.getTableConfigData(getSiteKey())
.getFfgGraphType();
Long basinPfaf = null; Long basinPfaf = null;
Long dataId = null; Long dataId = null;
FFMPVirtualGageBasinMetaData fvgbmd = null; FFMPVirtualGageBasinMetaData fvgbmd = null;
@ -3246,8 +3249,9 @@ public class FFMPResource extends
for (Date date : rateBasin.getValues().keySet()) { for (Date date : rateBasin.getValues().keySet()) {
if (date.before(minUriTime) || date.before(barrierTime) if (date.before(minUriTime) || date.before(barrierTime)
|| date.after(mostRecentRefTime)) || date.after(mostRecentRefTime)) {
continue;// DR 16148 continue;// DR 16148
}
double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime, double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime,
date); date);
@ -3275,8 +3279,9 @@ public class FFMPResource extends
for (Date date : qpeBasin.getValues().keySet()) { for (Date date : qpeBasin.getValues().keySet()) {
if (date.before(minUriTime) || date.before(barrierTime) if (date.before(minUriTime) || date.before(barrierTime)
|| date.after(mostRecentRefTime)) || date.after(mostRecentRefTime)) {
continue;// DR 16148 continue;// DR 16148
}
double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime, double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime,
date); date);
@ -3337,8 +3342,8 @@ public class FFMPResource extends
try { try {
guidBasin = (FFMPGuidanceBasin) monitor.getGraphGuidanceBasin( guidBasin = (FFMPGuidanceBasin) monitor.getGraphGuidanceBasin(
getProduct(), ffgGraphType, getSiteKey(), getDataKey(), null, getProduct(), ffgGraphType, getSiteKey(), getDataKey(),
oldestRefTime, FFMPRecord.ALL, basinPfaf); null, oldestRefTime, FFMPRecord.ALL, basinPfaf);
ArrayList<Double> guidTimes = new ArrayList<Double>(); ArrayList<Double> guidTimes = new ArrayList<Double>();
for (SourceXML ffgSource : getProduct().getGuidanceSourcesByType( for (SourceXML ffgSource : getProduct().getGuidanceSourcesByType(
ffgGraphType)) { ffgGraphType)) {
@ -3359,8 +3364,10 @@ public class FFMPResource extends
fgd.setGuidanceTimes(guidTimes); fgd.setGuidanceTimes(guidTimes);
guid = true; guid = true;
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler
"FFMPMonitor: getGraphData(): missing GUIDANCE dataset.", e); .handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing GUIDANCE dataset.",
e);
} }
if (fvgbmd != null) { if (fvgbmd != null) {
@ -3388,7 +3395,8 @@ public class FFMPResource extends
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing VIRTUAL dataset.", e); "FFMPMonitor: getGraphData(): missing VIRTUAL dataset.",
e);
} }
} }

View file

@ -26,6 +26,7 @@ import java.util.Map;
import com.raytheon.uf.common.dataplugin.fog.FogRecord; import com.raytheon.uf.common.dataplugin.fog.FogRecord;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT; import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.MonitorConfigConstants;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig; import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
@ -35,7 +36,6 @@ import com.raytheon.uf.viz.monitor.data.TableCellData;
import com.raytheon.uf.viz.monitor.data.TableData; import com.raytheon.uf.viz.monitor.data.TableData;
import com.raytheon.uf.viz.monitor.data.TableRowData; import com.raytheon.uf.viz.monitor.data.TableRowData;
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr; import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
/** /**
* Generate Data for Fog Dialogs * Generate Data for Fog Dialogs
@ -49,6 +49,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* 12/07/09 dhladky Initial Creation. * 12/07/09 dhladky Initial Creation.
* Oct.29, 2012 1297 skorolev Changed HashMap to Map * Oct.29, 2012 1297 skorolev Changed HashMap to Map
* Oct.31, 2012 1297 skorolev Clean code * Oct.31, 2012 1297 skorolev Clean code
* Dec 26, 2015 5114 skorolev Corrected imports.
* *
* </pre> * </pre>
* *
@ -58,9 +59,9 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
public class FogDataGenerator { public class FogDataGenerator {
private CommonTableConfig ctc; private final CommonTableConfig ctc;
private FogThresholdMgr ftm; private final FogThresholdMgr ftm;
/** /**
* Generates Fog data * Generates Fog data

View file

@ -38,8 +38,8 @@ import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.jms.notification.NotificationMessage; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -89,6 +89,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed. * Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed.
* Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage. * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* Dec 17, 2015 3873 dhladky Abstracted handling of dialogTime and Zone dialog events. * Dec 17, 2015 3873 dhladky Abstracted handling of dialogTime and Zone dialog events.
* Jan 04, 2016 5115 skorolev Corrected imports and replaced Mon.Name with App.Name.
* *
* *
* </pre> * </pre>
@ -143,7 +144,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/ */
private FogMonitor() { private FogMonitor() {
pluginPatterns.add(fssPattern); pluginPatterns.add(fssPattern);
fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog); fogConfig = FSSObsMonitorConfigurationManager.getInstance(AppName.FOG);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
createDataStructures(); createDataStructures();

View file

@ -22,10 +22,10 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.MonitorConfigConstants.FogDisplay;
import com.raytheon.uf.common.monitor.data.MonitorConfigConstants.FogMonitor;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogDisplay;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
/** /**
* This class manages the FOG thresholds for display and monitor. * This class manages the FOG thresholds for display and monitor.
@ -41,6 +41,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
* May 20, 2014 3086 skorolev Cleaned code. * May 20, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr. * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* Dec 26, 2015 5114 skorolev Corrected imports.
* *
* </pre> * </pre>
* *

Some files were not shown because too many files have changed in this diff Show more