summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhubner2009-03-16 11:27:33 (EDT)
committer dhubner2009-03-16 11:27:33 (EDT)
commitc0128a3f4f3ac8a38d4cbb88f70095590431854a (patch)
treead321b2738b3c908090928e70cac955b6c6860bb
parente7bbbb24981d16a20b9b47ab998c7fe8e2f3195d (diff)
downloadorg.eclipse.mwe-c0128a3f4f3ac8a38d4cbb88f70095590431854a.zip
org.eclipse.mwe-c0128a3f4f3ac8a38d4cbb88f70095590431854a.tar.gz
org.eclipse.mwe-c0128a3f4f3ac8a38d4cbb88f70095590431854a.tar.bz2
[268810] Bad performance on initialization due to unnecessary operations - Patch
-rw-r--r--plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java26
1 files changed, 5 insertions, 21 deletions
diff --git a/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java b/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java
index d9ab559..bf1226e 100644
--- a/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java
+++ b/plugins/org.eclipse.emf.mwe.ui.editor/src/org/eclipse/emf/mwe/ui/internal/editor/utils/TypeUtils.java
@@ -53,7 +53,7 @@ import org.eclipse.jdt.core.search.TypeNameMatchRequestor;
/**
* @author Patrick Schoenbach - Initial API and implementation
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
*/
public final class TypeUtils {
@@ -78,28 +78,12 @@ public final class TypeUtils {
private static class TypeNameCollector extends TypeNameMatchRequestor {
- IProject project;
-
- Set<String> classNames = new HashSet<String>();
-
- public TypeNameCollector(final IProject project) {
- this.project = project;
- }
+ Set<String> classNames = new HashSet<String>(1000);
@Override
public void acceptTypeNameMatch(final TypeNameMatch match) {
- final String className = match.getFullyQualifiedName();
- IType type = findType(project, className);
- if (type != null) {
- try {
- int modifier = type.getFlags();
- if (Flags.isPublic(modifier) && !Flags.isAbstract(modifier)) {
- classNames.add(className);
- }
- }
- catch (JavaModelException e) {
- // do nothing
- }
+ if (Flags.isPublic(match.getModifiers()) && !Flags.isAbstract(match.getModifiers())) {
+ classNames.add(match.getFullyQualifiedName());
}
}
@@ -192,7 +176,7 @@ public final class TypeUtils {
final IJavaProject jp = JavaCore.create(project);
final SearchEngine searchEngine = new SearchEngine();
final IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { jp }, true);
- final TypeNameCollector collector = new TypeNameCollector(project);
+ final TypeNameCollector collector = new TypeNameCollector();
searchEngine.searchAllTypeNames(null, SearchPattern.R_EXACT_MATCH, null, SearchPattern.R_EXACT_MATCH,
IJavaSearchConstants.CLASS, scope, collector, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);