Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 147936 Details for
Bug 203792
[Preferences] preference pages filter should support multiple keywords
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
203792.txt (text/plain), 5.49 KB, created by
Dina Sayed
on 2009-09-23 17:36:09 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Dina Sayed
Created:
2009-09-23 17:36:09 EDT
Size:
5.49 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java,v >retrieving revision 1.14 >diff -u -r1.14 StringMatcher.java >--- Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java 21 Jul 2006 17:48:17 -0000 1.14 >+++ Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java 23 Sep 2009 21:26:00 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,13 +7,14 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Dina Sayed, dsayed@eg.ibm.com, IBM - bug 203792 > *******************************************************************************/ > package org.eclipse.ui.internal.misc; > > import java.util.Vector; > > /** >- * A string pattern matcher, suppporting "*" and "?" wildcards. >+ * A string pattern matcher, supporting "*" and "?" wildcards. > */ > public class StringMatcher { > protected String fPattern; >@@ -213,38 +214,48 @@ > 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(); >+ boolean isPatternExist = false; >+ try { >+ if (isPatternWordsExistInText(text)) { >+ isPatternExist = true; >+ } >+ } catch (Exception e) { >+ e.printStackTrace(); >+ } >+ /* process first segment */ >+ if (!fHasLeadingStar) { >+ if (!regExpRegionMatches(text, start, current, 0, segLength)) { >+ if (!isPatternWordsExistInText(text)) > 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) { >+ if (!isPatternExist) >+ return false; > } >- } else { >- currentMatch = regExpPosIn(text, tCurPos, end, current); >- if (currentMatch < 0) { >- return false; >+ } else { >+ currentMatch = regExpPosIn(text, tCurPos, end, current); >+ if (currentMatch < 0) { >+ if (!isPatternExist) >+ return false; > } > } > tCurPos = currentMatch + current.length(); >@@ -414,11 +425,61 @@ > .toLowerCase(pchar)) { > continue; > } >- } >- return false; >- } >- return true; >- } >+ } >+ >+ return false; >+ } >+ return true; >+ } >+ >+ >+ /** >+ * @param text >+ * the string to match with the pattern >+ * @return boolean >+ */ >+ protected boolean isPatternWordsExistInText(String text) { >+ String textToSearch = text; >+ String thePattern = fPattern; >+ boolean foundpattern = false; >+ >+ if (fIgnoreCase) { >+ textToSearch = text.toLowerCase(); >+ thePattern = thePattern.toLowerCase(); >+ } >+ if (thePattern.endsWith("*")) { //$NON-NLS-1$ >+ thePattern = thePattern.substring(0, thePattern.length() - 1); >+ } >+ String[] pattrenSplitted = thePattern.split(" "); //$NON-NLS-1$ >+ String[] textSplitted = textToSearch.split(" "); //$NON-NLS-1$ >+ foundpattern = true; >+ for (int j = 0; j < pattrenSplitted.length && foundpattern; j++) { >+ >+ foundpattern = false; >+ if (pattrenSplitted[j].length() == 1 >+ && pattrenSplitted[j].equals("*")) { //$NON-NLS-1$ >+ foundpattern = true; >+ continue; >+ } >+ for (int i = 0; i < textSplitted.length; i++) { >+ >+ if (textSplitted[i].equals(pattrenSplitted[j])) { >+ foundpattern = true; >+ break; >+ } >+ if (j == pattrenSplitted.length - 1) { >+ if (textSplitted[i].startsWith(pattrenSplitted[j])) >+ foundpattern = true; >+ } >+ } >+ >+ } >+ >+ if (foundpattern) { >+ return true; >+ } >+ return false; >+ } > > /** > * @param text the string to match
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203792
: 147936 |
148630