Merge tag 'OB_14.3.3-2' into master_14.4.1

14.3.3-2

Conflicts:
	cave/com.raytheon.uf.viz.spellchecker/META-INF/MANIFEST.MF
	cave/com.raytheon.uf.viz.spellchecker/src/com/raytheon/uf/viz/spellchecker/dialogs/SpellCheckDlg.java

Former-commit-id: f5fad51061f568aea4ea581a099ef8353758add6
This commit is contained in:
Fay.Liang 2015-04-06 15:40:31 -04:00
commit c8962caee7
7 changed files with 164 additions and 31 deletions

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Spellchecker Plug-in
Bundle-SymbolicName: com.raytheon.uf.viz.spellchecker
Bundle-SymbolicName: com.raytheon.uf.viz.spellchecker;singleton:=true
Bundle-Version: 1.14.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.spellchecker.Activator
Bundle-Vendor: RAYTHEON
@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.core;bundle-version="1.11.26",
com.google.guava;bundle-version="11.0.2",
org.eclipse.jdt.ui
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.jdt.internal.ui.text.spelling,
org.eclipse.jdt.ui,

View file

@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/
localization/,\
plugin.xml

View file

@ -0,0 +1,56 @@
# This file defines words that we do not allow the spellchecker to display as
# spelling suggestions.
#
# Overrides to this file are not incremental so if you want this base list
# included in your override, you must copy this word list to the override file.
#
ASSHOLE'S
ASSHOLES
ASSHOLE
BITCH
BITCH'S
BITCHES
LEPROSY
GAYEST
SHIT
PISS
PISSED
PISSER
PISSES
PISSING
TITS
FUCK
CUNT
BLOWJOB
BEATOFF
BUTTHEAD
DICKHEAD
BUTTMUNCH
WHACKOFF
DICKFACE
PUSSYWHIPPED
TWAT
LACKANOOKIE
JACKOFF
GODDAMN
PECKERHEAD
PECKERFACE
DORK
DOOKIE
BALLBUSTER
GETLAID
PECKERWOOD
TIT
FART
BAZONGAS
SCHMUCK
PRICKHEAD
PRICKFACE
PUSSYFACE
ASSWIPE
ASSLICK
COCKHEAD
COCKFACE
COCKSUCKER
PERVERT

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<?eclipse version="3.8"?>
<plugin>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="TextWS"
extensionFilter=".txt"
localizationType="CAVE_STATIC"
name="Spell Checker"
recursive="false"
value="spellchecker">
</path>
</extension>
</plugin>

View file

@ -19,9 +19,12 @@
**/
package com.raytheon.uf.viz.spellchecker.dialogs;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedList;
@ -80,6 +83,7 @@ import com.raytheon.uf.viz.spellchecker.jobs.SpellCheckJob;
* 09/24/2014 #16693 lshi filter out swear words in spelling check
* 10/23/2014 #3685 randerso Changes to support mixed case
* 10/30/2014 #16693 lshi Add more swear words to the filter
* 03/30/2015 #4344 dgilling Make bad word filter configurable.
*
* </pre>
*
@ -88,15 +92,17 @@ import com.raytheon.uf.viz.spellchecker.jobs.SpellCheckJob;
*
*/
public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
private static java.util.List<String> swearWords = Arrays.asList("ASSHOLE", "ASSHOLE'S", "ASSHOLES",
"BITCH", "BITCH'S", "BITCHES", "LEPROSY", "GAYEST",
"SHIT", "PISS", "PISSED","PISSER","PISSES","PISSING","TITS");
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SpellCheckDlg.class);
private static final Pattern DIGITS = Pattern.compile("\\d");
private static final String SUGGESTION_BLACKLIST_PATH = FileUtil.join(
"spellchecker", "inappropriateWords.txt");
private static final Pattern COMMENT = Pattern.compile("^#");
/**
* The event handler for the check word button. It doubles as the problem
* collector for its internal SpellCheckJob.
@ -282,6 +288,8 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
private boolean singleLettersToRestore;
private Collection<String> suggestionsBlacklist;
/**
* Constructor.
*
@ -326,6 +334,59 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
spellCheckJob = new SpellCheckJob("spellCheck");
spellCheckJob.setText(styledText.getText());
spellCheckJob.setCollector(this);
suggestionsBlacklist = getSuggestionsBlacklist();
}
private Collection<String> getSuggestionsBlacklist() {
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationFile blacklistFile = pathMgr.getStaticLocalizationFile(
LocalizationType.CAVE_STATIC, SUGGESTION_BLACKLIST_PATH);
try {
return readBlacklistFile(blacklistFile);
} catch (IOException | LocalizationException e) {
if (blacklistFile.getContext().getLocalizationLevel() != LocalizationLevel.BASE) {
statusHandler.handle(Priority.WARN,
"Unable to read spell checker blacklist override file: "
+ blacklistFile
+ ". Falling back to BASE file.", e);
} else {
statusHandler.error(
"Unable to read spell checker blacklist file: "
+ blacklistFile + ".", e);
return Collections.emptySet();
}
}
blacklistFile = pathMgr.getLocalizationFile(pathMgr.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE),
SUGGESTION_BLACKLIST_PATH);
try {
return readBlacklistFile(blacklistFile);
} catch (IOException | LocalizationException e) {
statusHandler.error("Unable to read spell checker blacklist file: "
+ blacklistFile + ".", e);
return Collections.emptySet();
}
}
private Collection<String> readBlacklistFile(
final LocalizationFile blacklistFile) throws IOException,
LocalizationException {
Collection<String> retVal = new HashSet<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
blacklistFile.openInputStream()))) {
String line = null;
while ((line = reader.readLine()) != null) {
line = line.trim();
if ((!COMMENT.matcher(line).find()) && (!line.isEmpty())) {
retVal.add(line);
}
}
}
return retVal;
}
/*
@ -356,10 +417,8 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
Matcher pdMatch = CHANGE_TO.matcher(pdString);
if (pdMatch.matches()) {
String replString = pdMatch.group(1);
// proposals may include case changes, which get lost
// if (replString != badWord) {
if (!swearWords.contains(replString)
&& !replString.equals(badWord)) {
if (!suggestionsBlacklist
.contains(replString.toUpperCase())) {
suggestionList.add(replString);
}
}

View file

@ -126,24 +126,4 @@ Config["MaxPointsInColumn"]=10
# default state of elevation effects when the dialog starts up.
#
Config["ElevationDefault"]="On"
#
#==============================================================================
#
# The following empty code is here to fool the ifpServer into
# thinking it's a tool. This is so that the configuration will
# appear right next to the primary tool.
#
# DO NOT CHANGE THE LINES BELOW
#
ToolType = "numeric"
WeatherElementEdited = "None"
from numpy import *
HideTool = 1
import SmartScript
class Tool (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self):
return

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.edex.plugin.redbook.ingest.xml.RedbookMenusXML;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 30, 2015 4030 mpduff Initial creation
* Mar 19, 2015 4310 mpduff Some values must be trimmed.
*
* </pre>
*
@ -177,7 +178,9 @@ public class NdmMenuConverter {
subEntry.setKey(WMO);
for (String subPart : subParts) {
subPart = subPart.trim();
for (String key : dataKeyMap.keySet()) {
key = key.trim();
if (key.startsWith(subPart)) {
subValue.append(dataKeyMap.get(key))
.append(",");