Merge "Omaha #3685 Fix spell checker to use mixed case. Fix bug in importShapefile" into omaha_14.4.1

Former-commit-id: ca7c91e795 [formerly ee12f5dc65] [formerly ca7c91e795 [formerly ee12f5dc65] [formerly 30d031989e [formerly e076201872a69829228a6e78d632287839acf3d8]]]
Former-commit-id: 30d031989e
Former-commit-id: 93301efdcb [formerly d20a38f031]
Former-commit-id: d5537d06a1
This commit is contained in:
Ron Anderson 2014-10-28 15:15:26 -05:00 committed by Gerrit Code Review
commit 2f3ef2ec36
2 changed files with 19 additions and 11 deletions

View file

@ -66,7 +66,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;
/**
@ -79,6 +78,7 @@ import com.raytheon.uf.viz.spellchecker.jobs.SpellCheckJob;
* 18 APR 2008 ### lvenable Initial creation
* 01Mar2010 4765 MW Fegan Moved from GFE plug-in.
* 09/24/2014 #16693 lshi filter out swear words in spelling check
* 10/23/2014 #3685 randerso Changes to support mixed case
*
* </pre>
*
@ -89,7 +89,8 @@ 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");
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");
@ -331,6 +332,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;
@ -345,15 +347,16 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
misspelledLbl.setText(badWord);
ICompletionProposal[] proposals = problem.getProposals();
if (proposals != null && proposals.length > 0) {
if ((proposals != null) && (proposals.length > 0)) {
for (ICompletionProposal proposal : proposals) {
String pdString = proposal.getDisplayString();
Matcher pdMatch = CHANGE_TO.matcher(pdString);
if (pdMatch.matches()) {
String replString = pdMatch.group(1).toUpperCase();
String replString = pdMatch.group(1);
// proposals may include case changes, which get lost
//if (replString != badWord) {
if (!swearWords.contains(replString) && !replString.equals(badWord)) {
// if (replString != badWord) {
if (!swearWords.contains(replString)
&& !replString.equals(badWord)) {
suggestionList.add(replString);
}
}
@ -370,7 +373,7 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
StyleRange styleRange = styledText.getStyleRangeAtOffset(problem
.getOffset());
if (styleRange == null || styleRange.isUnstyled()
if ((styleRange == null) || styleRange.isUnstyled()
|| styleRange.similarTo(REDSTYLE)) {
if (ignoreAll.contains(badWord)) {
scanForErrors();
@ -407,6 +410,7 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
* org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector#beginCollecting
* ()
*/
@Override
public void beginCollecting() {
// nothing at present
}
@ -531,7 +535,7 @@ public class SpellCheckDlg extends Dialog implements ISpellingProblemCollector {
probStart = matcher.start(2);
// Only replace unstyled (unlocked) instances
styleRange = styledText.getStyleRangeAtOffset(probStart);
if (styleRange == null || styleRange.isUnstyled()) {
if ((styleRange == null) || styleRange.isUnstyled()) {
repList.addFirst(Integer.valueOf(probStart));
}
found = matcher.find();
@ -582,7 +586,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.
@ -658,6 +663,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);

View file

@ -23,6 +23,8 @@
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/25/2014 #2664 randerso Added support for importing non-WGS84 shape files
# 10/23/2014 #3685 randerso Fixed bug where .prj was not recognized when shape file
# was in the current directory (no directory specified)
#
##
@ -46,7 +48,7 @@ if [ $# -lt 3 ] ; then
exit -1
fi
SHP_PATH=${1}
SHP_PATH=`readlink -f ${1}`
SHP_DIR="${SHP_PATH%/*}" # shape file dir
SHP_NAME="${SHP_PATH##*/}" # shape file name with extension
SHP_BASE="${SHP_NAME%.*}" # shape file name without extension