diff options
author | jonas | 2014-09-18 08:53:31 +0000 |
---|---|---|
committer | jonas | 2014-09-18 08:53:31 +0000 |
commit | 9faed05343e0d9e34e768c5eb6a8dfe0f8a81b58 (patch) | |
tree | c70e0bef14dc5b9ebb8624913bccf029df8eed64 | |
parent | a384d55f247690d57d582cb8a7f54770a9f8da65 (diff) | |
download | org.eclipse.e4.tools-9faed05343e0d9e34e768c5eb6a8dfe0f8a81b58.tar.gz org.eclipse.e4.tools-9faed05343e0d9e34e768c5eb6a8dfe0f8a81b58.tar.xz org.eclipse.e4.tools-9faed05343e0d9e34e768c5eb6a8dfe0f8a81b58.zip |
Bug 444340 - Externalize Strings - Applied Formatter in preparation to externalize all Strings
8 files changed, 442 insertions, 423 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java index 90f011a0..22a8d2bd 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java @@ -28,9 +28,7 @@ public class ObservableColumnLabelProvider<M> extends CellLabelProvider { @Override public void handleMapChange(MapChangeEvent event) { Set<?> affectedElements = event.diff.getChangedKeys(); - LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent( - ObservableColumnLabelProvider.this, affectedElements - .toArray()); + LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent(ObservableColumnLabelProvider.this, affectedElements.toArray()); fireLabelProviderChanged(newEvent); } }; @@ -52,9 +50,7 @@ public class ObservableColumnLabelProvider<M> extends CellLabelProvider { * @param attributeMaps */ protected ObservableColumnLabelProvider(IObservableMap[] attributeMaps) { - System.arraycopy(attributeMaps, 0, - this.attributeMaps = new IObservableMap[attributeMaps.length], - 0, attributeMaps.length); + System.arraycopy(attributeMaps, 0, this.attributeMaps = new IObservableMap[attributeMaps.length], 0, attributeMaps.length); for (int i = 0; i < attributeMaps.length; i++) { attributeMaps[i].addMapChangeListener(mapChangeListener); } @@ -85,7 +81,7 @@ public class ObservableColumnLabelProvider<M> extends CellLabelProvider { Object value = attributeMaps[0].get(element); return value == null ? "" : value.toString(); //$NON-NLS-1$ } - + public Font getFont(M element) { return null; } @@ -98,7 +94,6 @@ public class ObservableColumnLabelProvider<M> extends CellLabelProvider { return null; } - public Image getImage(M element) { return null; } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java index cfd87687..e66e52dc 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java @@ -16,436 +16,474 @@ import java.util.Vector; * A string pattern matcher, suppporting "*" and "?" wildcards. */ public class StringMatcher { - protected String fPattern; - - protected int fLength; // pattern length - - protected boolean fIgnoreWildCards; - - protected boolean fIgnoreCase; - - protected boolean fHasLeadingStar; - - protected boolean fHasTrailingStar; - - protected String fSegments[]; //the given pattern is split into * separated segments - - /* boundary value beyond which we don't need to search in the text */ - protected int fBound = 0; - - protected static final char fSingleWildCard = '\u0000'; - - public static class Position { - int start; //inclusive - - int end; //exclusive - - public Position(int start, int end) { - this.start = start; - this.end = end; - } - - public int getStart() { - return start; - } - - public int getEnd() { - return end; - } - } - - /** - * StringMatcher constructor takes in a String object that is a simple - * pattern which may contain '*' for 0 and many characters and - * '?' for exactly one character. - * - * Literal '*' and '?' characters must be escaped in the pattern - * e.g., "\*" means literal "*", etc. - * - * Escaping any other character (including the escape character itself), - * just results in that character in the pattern. - * e.g., "\a" means "a" and "\\" means "\" - * - * If invoking the StringMatcher with string literals in Java, don't forget - * escape characters are represented by "\\". - * - * @param pattern the pattern to match text against - * @param ignoreCase if true, case is ignored - * @param ignoreWildCards if true, wild cards and their escape sequences are ignored - * (everything is taken literally). - */ - public StringMatcher(String pattern, boolean ignoreCase, - boolean ignoreWildCards) { - if (pattern == null) { + protected String fPattern; + + protected int fLength; // pattern length + + protected boolean fIgnoreWildCards; + + protected boolean fIgnoreCase; + + protected boolean fHasLeadingStar; + + protected boolean fHasTrailingStar; + + protected String fSegments[]; // the given pattern is split into * separated + // segments + + /* boundary value beyond which we don't need to search in the text */ + protected int fBound = 0; + + protected static final char fSingleWildCard = '\u0000'; + + public static class Position { + int start; // inclusive + + int end; // exclusive + + public Position(int start, int end) { + this.start = start; + this.end = end; + } + + public int getStart() { + return start; + } + + public int getEnd() { + return end; + } + } + + /** + * StringMatcher constructor takes in a String object that is a simple + * pattern which may contain '*' for 0 and many characters and '?' for + * exactly one character. + * + * Literal '*' and '?' characters must be escaped in the pattern e.g., + * "\*" means literal "*", etc. + * + * Escaping any other character (including the escape character itself), + * just results in that character in the pattern. e.g., "\a" means "a" and + * "\\" means "\" + * + * If invoking the StringMatcher with string literals in Java, don't forget + * escape characters are represented by "\\". + * + * @param pattern + * the pattern to match text against + * @param ignoreCase + * if true, case is ignored + * @param ignoreWildCards + * if true, wild cards and their escape sequences are ignored + * (everything is taken literally). + */ + public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) { + if (pattern == null) { throw new IllegalArgumentException(); } - fIgnoreCase = ignoreCase; - fIgnoreWildCards = ignoreWildCards; - fPattern = pattern; - fLength = pattern.length(); - - if (fIgnoreWildCards) { - parseNoWildCards(); - } else { - parseWildCards(); - } - } - - /** - * Find the first occurrence of the pattern between <code>start</code)(inclusive) - * and <code>end</code>(exclusive). - * @param text the String object to search in - * @param start the starting index of the search range, inclusive - * @param end the ending index of the search range, exclusive - * @return an <code>StringMatcher.Position</code> object that keeps the starting - * (inclusive) and ending positions (exclusive) of the first occurrence of the - * pattern in the specified range of the text; return null if not found or subtext - * is empty (start==end). A pair of zeros is returned if pattern is empty string - * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc" - * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned - */ - public StringMatcher.Position find(String text, int start, int end) { - if (text == null) { + fIgnoreCase = ignoreCase; + fIgnoreWildCards = ignoreWildCards; + fPattern = pattern; + fLength = pattern.length(); + + if (fIgnoreWildCards) { + parseNoWildCards(); + } else { + parseWildCards(); + } + } + + /** + * Find the first occurrence of the pattern between <code>start</code + * )(inclusive) and <code>end</code>(exclusive). + * + * @param text + * the String object to search in + * @param start + * the starting index of the search range, inclusive + * @param end + * the ending index of the search range, exclusive + * @return an <code>StringMatcher.Position</code> object that keeps the + * starting (inclusive) and ending positions (exclusive) of the + * first occurrence of the pattern in the specified range of the + * text; return null if not found or subtext is empty (start==end). + * A pair of zeros is returned if pattern is empty string Note that + * for pattern like "*abc*" with leading and trailing stars, + * position of "abc" is returned. For a pattern like"*??*" in text + * "abcdf", (1,3) is returned + */ + public StringMatcher.Position find(String text, int start, int end) { + if (text == null) { throw new IllegalArgumentException(); } - int tlen = text.length(); - if (start < 0) { + int tlen = text.length(); + if (start < 0) { start = 0; } - if (end > tlen) { + if (end > tlen) { end = tlen; } - if (end < 0 || start >= end) { + if (end < 0 || start >= end) { return null; } - if (fLength == 0) { + if (fLength == 0) { return new Position(start, start); } - if (fIgnoreWildCards) { - int x = posIn(text, start, end); - if (x < 0) { + if (fIgnoreWildCards) { + int x = posIn(text, start, end); + if (x < 0) { return null; } - return new Position(x, x + fLength); - } + return new Position(x, x + fLength); + } - int segCount = fSegments.length; - if (segCount == 0) { + int segCount = fSegments.length; + if (segCount == 0) { return new Position(start, end); } - int curPos = start; - int matchStart = -1; - int i; - for (i = 0; i < segCount && curPos < end; ++i) { - String current = fSegments[i]; - int nextMatch = regExpPosIn(text, curPos, end, current); - if (nextMatch < 0) { + int curPos = start; + int matchStart = -1; + int i; + for (i = 0; i < segCount && curPos < end; ++i) { + String current = fSegments[i]; + int nextMatch = regExpPosIn(text, curPos, end, current); + if (nextMatch < 0) { return null; } - if (i == 0) { + if (i == 0) { matchStart = nextMatch; } - curPos = nextMatch + current.length(); - } - if (i < segCount) { + curPos = nextMatch + current.length(); + } + if (i < segCount) { return null; } - return new Position(matchStart, curPos); - } - - /** - * match the given <code>text</code> with the pattern - * @return true if matched otherwise false - * @param text a String object - */ - public boolean match(String text) { - if(text == null) { + return new Position(matchStart, curPos); + } + + /** + * match the given <code>text</code> with the pattern + * + * @return true if matched otherwise false + * @param text + * a String object + */ + public boolean match(String text) { + if (text == null) { return false; } - return match(text, 0, text.length()); - } - - /** - * Given the starting (inclusive) and the ending (exclusive) positions in the - * <code>text</code>, determine if the given substring matches with aPattern - * @return true if the specified portion of the text matches the pattern - * @param text a String object that contains the substring to match - * @param start marks the starting position (inclusive) of the substring - * @param end marks the ending index (exclusive) of the substring - */ - public boolean match(String text, int start, int end) { - if (null == text) { + return match(text, 0, text.length()); + } + + /** + * Given the starting (inclusive) and the ending (exclusive) positions in + * the <code>text</code>, determine if the given substring matches with + * aPattern + * + * @return true if the specified portion of the text matches the pattern + * @param text + * a String object that contains the substring to match + * @param start + * marks the starting position (inclusive) of the substring + * @param end + * marks the ending index (exclusive) of the substring + */ + public boolean match(String text, int start, int end) { + if (null == text) { throw new IllegalArgumentException(); } - if (start > end) { + if (start > end) { return false; } - if (fIgnoreWildCards) { - return (end - start == fLength) - && fPattern.regionMatches(fIgnoreCase, 0, text, start, - fLength); + if (fIgnoreWildCards) { + return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength); } - int segCount = fSegments.length; - if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { + int segCount = fSegments.length; + if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { return true; } - if (start == end) { + if (start == end) { return fLength == 0; } - if (fLength == 0) { + if (fLength == 0) { return start == end; } - int tlen = text.length(); - if (start < 0) { + int tlen = text.length(); + if (start < 0) { start = 0; } - if (end > tlen) { + if (end > tlen) { end = tlen; } - int tCurPos = start; - int bound = end - fBound; - if (bound < 0) { + int tCurPos = start; + int bound = end - fBound; + if (bound < 0) { return false; } - int i = 0; - String current = fSegments[i]; - int segLength = current.length(); - - /* process first segment */ - if (!fHasLeadingStar) { - if (!regExpRegionMatches(text, start, current, 0, segLength)) { - return false; - } else { - ++i; - tCurPos = tCurPos + segLength; - } - } - if ((fSegments.length == 1) && (!fHasLeadingStar) - && (!fHasTrailingStar)) { - // only one segment to match, no wildcards specified - return tCurPos == end; - } - /* process middle segments */ - while (i < segCount) { - current = fSegments[i]; - int currentMatch; - int k = current.indexOf(fSingleWildCard); - if (k < 0) { - currentMatch = textPosIn(text, tCurPos, end, current); - if (currentMatch < 0) { + int i = 0; + String current = fSegments[i]; + int segLength = current.length(); + + /* process first segment */ + if (!fHasLeadingStar) { + if (!regExpRegionMatches(text, start, current, 0, segLength)) { + return false; + } else { + ++i; + tCurPos = tCurPos + segLength; + } + } + if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) { + // only one segment to match, no wildcards specified + return tCurPos == end; + } + /* process middle segments */ + while (i < segCount) { + current = fSegments[i]; + int currentMatch; + int k = current.indexOf(fSingleWildCard); + if (k < 0) { + currentMatch = textPosIn(text, tCurPos, end, current); + if (currentMatch < 0) { return false; } - } else { - currentMatch = regExpPosIn(text, tCurPos, end, current); - if (currentMatch < 0) { + } else { + currentMatch = regExpPosIn(text, tCurPos, end, current); + if (currentMatch < 0) { return false; } - } - tCurPos = currentMatch + current.length(); - i++; - } - - /* process final segment */ - if (!fHasTrailingStar && tCurPos != end) { - int clen = current.length(); - return regExpRegionMatches(text, end - clen, current, 0, clen); - } - return i == segCount; - } - - /** - * This method parses the given pattern into segments seperated by wildcard '*' characters. - * Since wildcards are not being used in this case, the pattern consists of a single segment. - */ - private void parseNoWildCards() { - fSegments = new String[1]; - fSegments[0] = fPattern; - fBound = fLength; - } - - /** - * Parses the given pattern into segments seperated by wildcard '*' characters. - * @param p, a String object that is a simple regular expression with '*' and/or '?' - */ - private void parseWildCards() { - if (fPattern.startsWith("*")) { //$NON-NLS-1$ + } + tCurPos = currentMatch + current.length(); + i++; + } + + /* process final segment */ + if (!fHasTrailingStar && tCurPos != end) { + int clen = current.length(); + return regExpRegionMatches(text, end - clen, current, 0, clen); + } + return i == segCount; + } + + /** + * This method parses the given pattern into segments seperated by wildcard + * '*' characters. Since wildcards are not being used in this case, the + * pattern consists of a single segment. + */ + private void parseNoWildCards() { + fSegments = new String[1]; + fSegments[0] = fPattern; + fBound = fLength; + } + + /** + * Parses the given pattern into segments seperated by wildcard '*' + * characters. + * + * @param p + * , a String object that is a simple regular expression with '*' + * and/or '?' + */ + private void parseWildCards() { + if (fPattern.startsWith("*")) { //$NON-NLS-1$ fHasLeadingStar = true; } - if (fPattern.endsWith("*")) {//$NON-NLS-1$ - /* make sure it's not an escaped wildcard */ - if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') { - fHasTrailingStar = true; - } - } - - Vector<String> temp = new Vector<String>(); - - int pos = 0; - StringBuffer buf = new StringBuffer(); - while (pos < fLength) { - char c = fPattern.charAt(pos++); - switch (c) { - case '\\': - if (pos >= fLength) { - buf.append(c); - } else { - char next = fPattern.charAt(pos++); - /* if it's an escape sequence */ - if (next == '*' || next == '?' || next == '\\') { - buf.append(next); - } else { - /* not an escape sequence, just insert literally */ - buf.append(c); - buf.append(next); - } - } - break; - case '*': - if (buf.length() > 0) { - /* new segment */ - temp.addElement(buf.toString()); - fBound += buf.length(); - buf.setLength(0); - } - break; - case '?': - /* append special character representing single match wildcard */ - buf.append(fSingleWildCard); - break; - default: - buf.append(c); - } - } - - /* add last buffer to segment list */ - if (buf.length() > 0) { - temp.addElement(buf.toString()); - fBound += buf.length(); - } - - fSegments = new String[temp.size()]; - temp.copyInto(fSegments); - } - - /** - * @param text a string which contains no wildcard - * @param start the starting index in the text for search, inclusive - * @param end the stopping point of search, exclusive - * @return the starting index in the text of the pattern , or -1 if not found - */ - protected int posIn(String text, int start, int end) {//no wild card in pattern - int max = end - fLength; - - if (!fIgnoreCase) { - int i = text.indexOf(fPattern, start); - if (i == -1 || i > max) { + if (fPattern.endsWith("*")) {//$NON-NLS-1$ + /* make sure it's not an escaped wildcard */ + if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') { + fHasTrailingStar = true; + } + } + + Vector<String> temp = new Vector<String>(); + + int pos = 0; + StringBuffer buf = new StringBuffer(); + while (pos < fLength) { + char c = fPattern.charAt(pos++); + switch (c) { + case '\\': + if (pos >= fLength) { + buf.append(c); + } else { + char next = fPattern.charAt(pos++); + /* if it's an escape sequence */ + if (next == '*' || next == '?' || next == '\\') { + buf.append(next); + } else { + /* not an escape sequence, just insert literally */ + buf.append(c); + buf.append(next); + } + } + break; + case '*': + if (buf.length() > 0) { + /* new segment */ + temp.addElement(buf.toString()); + fBound += buf.length(); + buf.setLength(0); + } + break; + case '?': + /* append special character representing single match wildcard */ + buf.append(fSingleWildCard); + break; + default: + buf.append(c); + } + } + + /* add last buffer to segment list */ + if (buf.length() > 0) { + temp.addElement(buf.toString()); + fBound += buf.length(); + } + + fSegments = new String[temp.size()]; + temp.copyInto(fSegments); + } + + /** + * @param text + * a string which contains no wildcard + * @param start + * the starting index in the text for search, inclusive + * @param end + * the stopping point of search, exclusive + * @return the starting index in the text of the pattern , or -1 if not + * found + */ + protected int posIn(String text, int start, int end) {// no wild card in + // pattern + int max = end - fLength; + + if (!fIgnoreCase) { + int i = text.indexOf(fPattern, start); + if (i == -1 || i > max) { return -1; } - return i; - } + return i; + } - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, fPattern, 0, fLength)) { + for (int i = start; i <= max; ++i) { + if (text.regionMatches(true, i, fPattern, 0, fLength)) { return i; } - } - - return -1; - } - - /** - * @param text a simple regular expression that may only contain '?'(s) - * @param start the starting index in the text for search, inclusive - * @param end the stopping point of search, exclusive - * @param p a simple regular expression that may contains '?' - * @return the starting index in the text of the pattern , or -1 if not found - */ - protected int regExpPosIn(String text, int start, int end, String p) { - int plen = p.length(); - - int max = end - plen; - for (int i = start; i <= max; ++i) { - if (regExpRegionMatches(text, i, p, 0, plen)) { + } + + return -1; + } + + /** + * @param text + * a simple regular expression that may only contain '?'(s) + * @param start + * the starting index in the text for search, inclusive + * @param end + * the stopping point of search, exclusive + * @param p + * a simple regular expression that may contains '?' + * @return the starting index in the text of the pattern , or -1 if not + * found + */ + protected int regExpPosIn(String text, int start, int end, String p) { + int plen = p.length(); + + int max = end - plen; + for (int i = start; i <= max; ++i) { + if (regExpRegionMatches(text, i, p, 0, plen)) { return i; } - } - return -1; - } - - /** - * - * @return boolean - * @param text a String to match - * @param start int that indicates the starting index of match, inclusive - * @param end</code> int that indicates the ending index of match, exclusive - * @param p String, String, a simple regular expression that may contain '?' - * @param ignoreCase boolean indicating wether code>p</code> is case sensitive - */ - protected boolean regExpRegionMatches(String text, int tStart, String p, - int pStart, int plen) { - while (plen-- > 0) { - char tchar = text.charAt(tStart++); - char pchar = p.charAt(pStart++); - - /* process wild cards */ - if (!fIgnoreWildCards) { - /* skip single wild cards */ - if (pchar == fSingleWildCard) { - continue; - } - } - if (pchar == tchar) { + } + return -1; + } + + /** + * + * @return boolean + * @param text + * a String to match + * @param start + * int that indicates the starting index of match, inclusive + * @param end + * </code> int that indicates the ending index of match, + * exclusive + * @param p + * String, String, a simple regular expression that may contain + * '?' + * @param ignoreCase + * boolean indicating wether code>p</code> is case sensitive + */ + protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) { + while (plen-- > 0) { + char tchar = text.charAt(tStart++); + char pchar = p.charAt(pStart++); + + /* process wild cards */ + if (!fIgnoreWildCards) { + /* skip single wild cards */ + if (pchar == fSingleWildCard) { + continue; + } + } + if (pchar == tchar) { continue; } - if (fIgnoreCase) { - if (Character.toUpperCase(tchar) == Character - .toUpperCase(pchar)) { + if (fIgnoreCase) { + if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar)) { continue; } - // comparing after converting to upper case doesn't handle all cases; - // also compare after converting to lower case - if (Character.toLowerCase(tchar) == Character - .toLowerCase(pchar)) { + // comparing after converting to upper case doesn't handle all + // cases; + // also compare after converting to lower case + if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar)) { continue; } - } - return false; - } - return true; - } - - /** - * @param text the string to match - * @param start the starting index in the text for search, inclusive - * @param end the stopping point of search, exclusive - * @param p a pattern string that has no wildcard - * @return the starting index in the text of the pattern , or -1 if not found - */ - protected int textPosIn(String text, int start, int end, String p) { - - int plen = p.length(); - int max = end - plen; - - if (!fIgnoreCase) { - int i = text.indexOf(p, start); - if (i == -1 || i > max) { + } + return false; + } + return true; + } + + /** + * @param text + * the string to match + * @param start + * the starting index in the text for search, inclusive + * @param end + * the stopping point of search, exclusive + * @param p + * a pattern string that has no wildcard + * @return the starting index in the text of the pattern , or -1 if not + * found + */ + protected int textPosIn(String text, int start, int end, String p) { + + int plen = p.length(); + int max = end - plen; + + if (!fIgnoreCase) { + int i = text.indexOf(p, start); + if (i == -1 || i > max) { return -1; } - return i; - } + return i; + } - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, p, 0, plen)) { + for (int i = start; i <= max; ++i) { + if (text.regionMatches(true, i, p, 0, plen)) { return i; } - } + } - return -1; - } + return -1; + } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java index f4e134c4..3db082a5 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java @@ -103,7 +103,7 @@ public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy { /* * (non-Javadoc) - * + * * @see * org.eclipse.core.databinding.UpdateValueStrategy#doSet(org.eclipse.core * .databinding.observable.value.IObservableValue, java.lang.Object) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java index abce02f9..0583f215 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java @@ -8,7 +8,7 @@ * Contributors: * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation * Steven Spungin <steven@spungin.tv> - Bug 424730 -******************************************************************************/ + ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import org.eclipse.core.resources.IProject; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java index 50e129ae..63f69573 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/EMFDocumentResourceMediator.java @@ -104,7 +104,8 @@ public class EMFDocumentResourceMediator { /** * @param object - * @return The region for the start tag of the EObject, or null if not found. + * @return The region for the start tag of the EObject, or null if not + * found. */ public IRegion findStartTag(EObject object) { if (object == null) { @@ -116,7 +117,8 @@ public class EMFDocumentResourceMediator { FindReplaceDocumentAdapter find = new FindReplaceDocumentAdapter(document); IRegion region; try { - //TODO This will not work if the element has '<' or '>' in an attribute value + // TODO This will not work if the element has '<' or '>' in an + // attribute value region = find.find(0, "<.*?" + xmiId + ".*?>", true, true, false, true); //$NON-NLS-1$ //$NON-NLS-2$ return region; } catch (BadLocationException e) { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java index b3726387..a331cbf7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/NonRuleBasedDamagerRepairer.java @@ -23,14 +23,16 @@ import org.eclipse.jface.text.presentation.IPresentationDamager; import org.eclipse.jface.text.presentation.IPresentationRepairer; import org.eclipse.swt.custom.StyleRange; -public class NonRuleBasedDamagerRepairer - implements IPresentationDamager, IPresentationRepairer { +public class NonRuleBasedDamagerRepairer implements IPresentationDamager, IPresentationRepairer { /** The document this object works on */ protected IDocument fDocument; - /** The default text attribute if non is returned as data by the current token */ + /** + * The default text attribute if non is returned as data by the current + * token + */ protected TextAttribute fDefaultTextAttribute; - + /** * Constructor for NonRuleBasedDamagerRepairer. */ @@ -50,11 +52,14 @@ public class NonRuleBasedDamagerRepairer /** * Returns the end offset of the line that contains the specified offset or - * if the offset is inside a line delimiter, the end offset of the next line. + * if the offset is inside a line delimiter, the end offset of the next + * line. * - * @param offset the offset whose line end offset must be computed + * @param offset + * the offset whose line end offset must be computed * @return the line end offset for the given offset - * @exception BadLocationException if offset is invalid in the current document + * @exception BadLocationException + * if offset is invalid in the current document */ protected int endOfLineOf(int offset) throws BadLocationException { @@ -72,37 +77,26 @@ public class NonRuleBasedDamagerRepairer } /** - * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean) + * @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, + * boolean) */ @Override - public IRegion getDamageRegion( - ITypedRegion partition, - DocumentEvent event, - boolean documentPartitioningChanged) { + public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged) { if (!documentPartitioningChanged) { try { - IRegion info = - fDocument.getLineInformationOfOffset(event.getOffset()); + IRegion info = fDocument.getLineInformationOfOffset(event.getOffset()); int start = Math.max(partition.getOffset(), info.getOffset()); - int end = - event.getOffset() - + (event.getText() == null - ? event.getLength() - : event.getText().length()); + int end = event.getOffset() + (event.getText() == null ? event.getLength() : event.getText().length()); - if (info.getOffset() <= end - && end <= info.getOffset() + info.getLength()) { + if (info.getOffset() <= end && end <= info.getOffset() + info.getLength()) { // optimize the case of the same line end = info.getOffset() + info.getLength(); } else end = endOfLineOf(end); - end = - Math.min( - partition.getOffset() + partition.getLength(), - end); + end = Math.min(partition.getOffset() + partition.getLength(), end); return new Region(start, end - start); } catch (BadLocationException x) { @@ -113,39 +107,28 @@ public class NonRuleBasedDamagerRepairer } /** - * @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion) + * @see IPresentationRepairer#createPresentation(TextPresentation, + * ITypedRegion) */ @Override - public void createPresentation( - TextPresentation presentation, - ITypedRegion region) { - addRange( - presentation, - region.getOffset(), - region.getLength(), - fDefaultTextAttribute); + public void createPresentation(TextPresentation presentation, ITypedRegion region) { + addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextAttribute); } /** * Adds style information to the given text presentation. * - * @param presentation the text presentation to be extended - * @param offset the offset of the range to be styled - * @param length the length of the range to be styled - * @param attr the attribute describing the style of the range to be styled + * @param presentation + * the text presentation to be extended + * @param offset + * the offset of the range to be styled + * @param length + * the length of the range to be styled + * @param attr + * the attribute describing the style of the range to be styled */ - protected void addRange( - TextPresentation presentation, - int offset, - int length, - TextAttribute attr) { + protected void addRange(TextPresentation presentation, int offset, int length, TextAttribute attr) { if (attr != null) - presentation.addStyleRange( - new StyleRange( - offset, - length, - attr.getForeground(), - attr.getBackground(), - attr.getStyle())); + presentation.addStyleRange(new StyleRange(offset, length, attr.getForeground(), attr.getBackground(), attr.getStyle())); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java index 5aae8843..6f05a9b6 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/XMLDoubleClickStrategy.java @@ -31,6 +31,7 @@ public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy { selectWord(pos); } } + protected boolean selectComment(int caretPos) { IDocument doc = fText.getDocument(); int startPos, endPos; @@ -79,6 +80,7 @@ public class XMLDoubleClickStrategy implements ITextDoubleClickStrategy { return false; } + protected boolean selectWord(int caretPos) { IDocument doc = fText.getDocument(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java index 09dc6fa9..2ba95e84 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/imp/RegistryStruct.java @@ -7,8 +7,7 @@ public class RegistryStruct { String extensionPointName; String mappingName; - public RegistryStruct(String bundle, String extensionPoint, - String extensionPointName, String mappingName) { + public RegistryStruct(String bundle, String extensionPoint, String extensionPointName, String mappingName) { super(); this.bundle = bundle; this.extensionPoint = extensionPoint; |