Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 12-18
Link Here
|
12 |
package org.eclipse.jdt.core.dom.rewrite; |
12 |
package org.eclipse.jdt.core.dom.rewrite; |
13 |
|
13 |
|
14 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
|
|
15 |
import java.util.HashMap; |
15 |
import java.util.List; |
16 |
import java.util.List; |
|
|
17 |
import java.util.Map; |
16 |
|
18 |
|
17 |
import org.eclipse.core.runtime.CoreException; |
19 |
import org.eclipse.core.runtime.CoreException; |
18 |
import org.eclipse.core.runtime.IProgressMonitor; |
20 |
import org.eclipse.core.runtime.IProgressMonitor; |
Lines 122-127
Link Here
|
122 |
|
124 |
|
123 |
private final boolean restoreExistingImports; |
125 |
private final boolean restoreExistingImports; |
124 |
private final List existingImports; |
126 |
private final List existingImports; |
|
|
127 |
private final Map importsKindMap; |
125 |
|
128 |
|
126 |
private String[] importOrder; |
129 |
private String[] importOrder; |
127 |
private int importOnDemandThreshold; |
130 |
private int importOnDemandThreshold; |
Lines 232-237
Link Here
|
232 |
this.importOrder= CharOperation.NO_STRINGS; |
235 |
this.importOrder= CharOperation.NO_STRINGS; |
233 |
this.importOnDemandThreshold= 99; |
236 |
this.importOnDemandThreshold= 99; |
234 |
this.staticImportOnDemandThreshold= 99; |
237 |
this.staticImportOnDemandThreshold= 99; |
|
|
238 |
|
239 |
this.importsKindMap = new HashMap(); |
235 |
} |
240 |
} |
236 |
|
241 |
|
237 |
|
242 |
|
Lines 307-313
Link Here
|
307 |
this.filterImplicitImports= filterImplicitImports; |
312 |
this.filterImplicitImports= filterImplicitImports; |
308 |
} |
313 |
} |
309 |
|
314 |
|
310 |
private static int compareImport(char prefix, String qualifier, String name, String curr) { |
315 |
private int compareImport(char prefix, String qualifier, String name, String curr) { |
311 |
if (curr.charAt(0) != prefix || !curr.endsWith(name)) { |
316 |
if (curr.charAt(0) != prefix || !curr.endsWith(name)) { |
312 |
return ImportRewriteContext.RES_NAME_UNKNOWN; |
317 |
return ImportRewriteContext.RES_NAME_UNKNOWN; |
313 |
} |
318 |
} |
Lines 345-351
Link Here
|
345 |
int res= compareImport(prefix, qualifier, name, curr); |
350 |
int res= compareImport(prefix, qualifier, name, curr); |
346 |
if (res != ImportRewriteContext.RES_NAME_UNKNOWN) { |
351 |
if (res != ImportRewriteContext.RES_NAME_UNKNOWN) { |
347 |
if (!allowAmbiguity || res == ImportRewriteContext.RES_NAME_FOUND) { |
352 |
if (!allowAmbiguity || res == ImportRewriteContext.RES_NAME_FOUND) { |
348 |
return res; |
353 |
if (prefix != 's' |
|
|
354 |
|| (this.importsKindMap.get(curr.substring(1)).equals(this.importsKindMap.get(qualifier + "." + name)))) { |
355 |
return res; |
356 |
} |
349 |
} |
357 |
} |
350 |
} |
358 |
} |
351 |
} |
359 |
} |
Lines 839-844
Link Here
|
839 |
context= this.defaultContext; |
847 |
context= this.defaultContext; |
840 |
} |
848 |
} |
841 |
int kind= isField ? ImportRewriteContext.KIND_STATIC_FIELD : ImportRewriteContext.KIND_STATIC_METHOD; |
849 |
int kind= isField ? ImportRewriteContext.KIND_STATIC_FIELD : ImportRewriteContext.KIND_STATIC_METHOD; |
|
|
850 |
this.importsKindMap.put(declaringTypeName + "." + simpleName, new Integer(kind)); |
842 |
int res= context.findInContext(declaringTypeName, simpleName, kind); |
851 |
int res= context.findInContext(declaringTypeName, simpleName, kind); |
843 |
if (res == ImportRewriteContext.RES_NAME_CONFLICT) { |
852 |
if (res == ImportRewriteContext.RES_NAME_CONFLICT) { |
844 |
return declaringTypeName + '.' + simpleName; |
853 |
return declaringTypeName + '.' + simpleName; |