Merge branch 'omaha_14.3.3' of ssh://www.awips2omaha.com:29418/AWIPS2_baseline into master_14.3.3
Former-commit-id: 39be5eb857ab247a1116a145aee274d25e993368
This commit is contained in:
commit
368369872b
6 changed files with 169 additions and 19 deletions
|
@ -1,7 +0,0 @@
|
|||
#Tue Mar 02 13:31:58 CST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,14 +1,14 @@
|
|||
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.12.1174.qualifier
|
||||
Bundle-Activator: com.raytheon.uf.viz.spellchecker.Activator
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.viz.core;bundle-version="1.11.26"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: org.eclipse.jdt.ui,
|
||||
org.eclipse.jface.text,
|
||||
|
|
|
@ -2,4 +2,5 @@ source.. = src/
|
|||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
localization/
|
||||
localization/,\
|
||||
plugin.xml
|
||||
|
|
|
@ -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
|
34
cave/com.raytheon.uf.viz.spellchecker/plugin.xml
Normal file
34
cave/com.raytheon.uf.viz.spellchecker/plugin.xml
Normal 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>
|
|
@ -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;
|
||||
|
@ -66,7 +69,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.spellchecker.Activator;
|
||||
import com.raytheon.uf.viz.spellchecker.jobs.SpellCheckJob;
|
||||
|
||||
/**
|
||||
|
@ -80,6 +82,7 @@ import com.raytheon.uf.viz.spellchecker.jobs.SpellCheckJob;
|
|||
* 01Mar2010 4765 MW Fegan Moved from GFE plug-in.
|
||||
* 09/24/2014 #16693 lshi filter out swear words in spelling check
|
||||
* 10/30/2014 #16693 lshi Add more swear words to the filter
|
||||
* 03/30/2015 #4344 dgilling Make bad word filter configurable.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -88,14 +91,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 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.
|
||||
|
@ -281,6 +287,8 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
|
|||
|
||||
private boolean singleLettersToRestore;
|
||||
|
||||
private Collection<String> suggestionsBlacklist;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -325,6 +333,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -334,6 +395,7 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
|
|||
* org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector#accept(org
|
||||
* .eclipse.ui.texteditor.spelling.SpellingProblem)
|
||||
*/
|
||||
@Override
|
||||
public void accept(SpellingProblem problem) {
|
||||
if (shell.isDisposed()) {
|
||||
return;
|
||||
|
@ -355,8 +417,9 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
|
|||
if (pdMatch.matches()) {
|
||||
String replString = pdMatch.group(1).toUpperCase();
|
||||
// proposals may include case changes, which get lost
|
||||
//if (replString != badWord) {
|
||||
if (!swearWords.contains(replString) && !replString.equals(badWord)) {
|
||||
if (!suggestionsBlacklist
|
||||
.contains(replString.toUpperCase())
|
||||
&& !replString.equals(badWord)) {
|
||||
suggestionList.add(replString);
|
||||
}
|
||||
}
|
||||
|
@ -410,6 +473,7 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
|
|||
* org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector#beginCollecting
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public void beginCollecting() {
|
||||
// nothing at present
|
||||
}
|
||||
|
@ -585,7 +649,8 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
|
|||
try {
|
||||
userDLFile.save();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Error saving user dictionary", e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error saving user dictionary", e);
|
||||
}
|
||||
// The spell check job might have a backlog of errors
|
||||
// for this word, which no longer apply.
|
||||
|
@ -661,6 +726,7 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
|
|||
* org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector#endCollecting
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public void endCollecting() {
|
||||
MessageDialog.openInformation(shell, "", "Done checking document");
|
||||
styledText.setSelectionRange(0, 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue