aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2014-03-24 05:38:08 (EDT)
committerAnton Leherbauer2014-03-31 03:21:25 (EDT)
commit2ff406374e7eb37894efe389c33e2ae7e241147b (patch)
treef1b15afd6c323834fca1a1ec65cc93591cef28b2
parentcc78bed0b3783ebc9b9101783fbf2cea0ebc83ff (diff)
downloadeclipse.platform.ui-2ff406374e7eb37894efe389c33e2ae7e241147b.zip
eclipse.platform.ui-2ff406374e7eb37894efe389c33e2ae7e241147b.tar.gz
eclipse.platform.ui-2ff406374e7eb37894efe389c33e2ae7e241147b.tar.bz2
Bug 415099 - Open Resource: Terminating with "<" or " " (space) does notrefs/changes/07/23807/3
work for extensions Change-Id: I4edac3e431f2e84e67687ba0da42bc79a4e9de6f Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
-rw-r--r--bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java
index d40dee2..103980a 100644
--- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java
+++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* James Blackburn (Broadcom Corp.) Bug 86973 Allow path pattern matching
+ * Anton Leherbauer (Wind River Systems, Inc.) - Bug 415099 Terminating with "<" or " " (space) does not work for extensions
*******************************************************************************/
package org.eclipse.ui.dialogs;
@@ -944,6 +945,7 @@ public class FilteredResourcesSelectionDialog extends
this(container, showDerived, typeMask);
String stringPattern = getPattern();
+ int matchRule = getMatchRule();
String filenamePattern;
int sep = stringPattern.lastIndexOf(IPath.SEPARATOR);
@@ -968,20 +970,35 @@ public class FilteredResourcesSelectionDialog extends
this.containerPattern= new SearchPattern(SearchPattern.RULE_EXACT_MATCH | SearchPattern.RULE_PREFIX_MATCH | SearchPattern.RULE_PATTERN_MATCH);
this.containerPattern.setPattern(containerPattern);
}
+ boolean isPrefixPattern = matchRule == SearchPattern.RULE_PREFIX_MATCH
+ || (matchRule == SearchPattern.RULE_PATTERN_MATCH && filenamePattern.endsWith("*")); //$NON-NLS-1$
+ if (!isPrefixPattern)
+ // Add '<' again as it was removed by SearchPattern
+ filenamePattern += '<';
+ else if (filenamePattern.endsWith("*") && !filenamePattern.equals("**")) //$NON-NLS-1$ //$NON-NLS-2$
+ // Remove added '*' as the filename pattern might be a camel case pattern
+ filenamePattern = filenamePattern.substring(0, filenamePattern.length() - 1);
patternMatcher.setPattern(filenamePattern);
-
+ // Update filenamePattern and matchRule as they might have changed
+ filenamePattern = getPattern();
+ matchRule = getMatchRule();
} else {
filenamePattern= stringPattern;
}
int lastPatternDot = filenamePattern.lastIndexOf('.');
if (lastPatternDot != -1) {
- char last = filenamePattern.charAt(filenamePattern.length() - 1);
- if (last != ' ' && last != '<' && getMatchRule() != SearchPattern.RULE_EXACT_MATCH) {
+ if (matchRule != SearchPattern.RULE_EXACT_MATCH) {
namePattern = new SearchPattern();
namePattern.setPattern(filenamePattern.substring(0, lastPatternDot));
+ String extensionPatternStr = filenamePattern.substring(lastPatternDot + 1);
+ // Add a '<' except this is a camel case pattern or a prefix pattern
+ if (matchRule != SearchPattern.RULE_CAMELCASE_MATCH
+ && matchRule != SearchPattern.RULE_PREFIX_MATCH
+ && !extensionPatternStr.endsWith("*")) //$NON-NLS-1$
+ extensionPatternStr += '<';
extensionPattern = new SearchPattern();
- extensionPattern.setPattern(filenamePattern.substring(lastPatternDot + 1));
+ extensionPattern.setPattern(extensionPatternStr);
}
}