-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move TextMatcher from Platform UI to Equinox Common #720
Conversation
Prerequisite to eclipse-platform/eclipse.platform.ui#2567 |
@tjwatson any concerns here? |
I'm really not sure if this is the right place. Equinox common contains code related to the runtime (in the broadest sense). |
|
The API signature does not reference
It seems in the spirit of https://bugs.eclipse.org/bugs/show_bug.cgi?id=508611 so I don't have an issue with the functionality existing in this package of Equinox common. But TextMatcher vs. StringMatcher have arbitrary names that are confusing to one that has never used either of these classes. It seems overkill to add a new slightly differently named class just to add the following public APIs, one which is a static method that could go anywhere: /**
* Determines whether the given {@code text} matches the pattern.
*
* @param text String to match; must not be {@code null}
* @return {@code true} if the whole {@code text} matches the pattern;
* {@code false} otherwise
* @throws IllegalArgumentException if {@code text == null}
*/
public boolean match(String text)
/**
* Determines whether the given sub-string of {@code text} from {@code start}
* (inclusive) to {@code end} (exclusive) matches the pattern.
*
* @param text String to match in; must not be {@code null}
* @param start start index (inclusive) within {@code text} of the sub-string to
* match
* @param end end index (exclusive) within {@code text} of the sub-string to
* match
* @return {@code true} if the given slice of {@code text} matches the pattern;
* {@code false} otherwise
* @throws IllegalArgumentException if {@code text == null}
*/
public boolean match(String text, int start, int end)
/**
* Splits a given text into words.
*
* @param text to split
* @return the words of the text
*/
public static String[] getWords(String text) { I think it would be better to enhance |
f678abb
to
8ff10ad
Compare
bundles/org.eclipse.equinox.common/src/org/eclipse/core/text/StringMatcher.java
Outdated
Show resolved
Hide resolved
8ff10ad
to
f14e97a
Compare
That makes sense. Luckily, the TextMatcher effectively extends the StringMatcher, so it was fairly easy to add this new functionality. |
89f7d99
to
4874832
Compare
bundles/org.eclipse.equinox.common/src/org/eclipse/core/text/StringMatcher.java
Outdated
Show resolved
Hide resolved
decd4ed
to
66d35bb
Compare
The TextMatcher class is used in the UI component, despite not depending on any UI classes. By moving it to Equinox, it can be used anywhere in the Eclipse Platform.
@tjwatson any more concerns or can we merge this? |
The TextMatcher class is used in the UI component, despite not depending on any UI classes. By moving it to Equinox, it can be used anywhere in the Eclipse Platform.