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 37980 Details for
Bug 37525
[open type] Moving a package does not update the class index.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch against org.eclipse.jdt.ui (2006/04/05 00:10:00)
37525.txt (text/plain), 7.15 KB, created by
Jerome Lanneluc
on 2006-04-07 05:20:11 EDT
(
hide
)
Description:
Patch against org.eclipse.jdt.ui (2006/04/05 00:10:00)
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2006-04-07 05:20:11 EDT
Size:
7.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: core extension/org/eclipse/jdt/internal/corext/util/TypeInfoFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfoFactory.java,v >retrieving revision 1.10 >diff -u -r1.10 TypeInfoFactory.java >--- core extension/org/eclipse/jdt/internal/corext/util/TypeInfoFactory.java 17 Jun 2005 15:51:52 -0000 1.10 >+++ core extension/org/eclipse/jdt/internal/corext/util/TypeInfoFactory.java 7 Apr 2006 09:11:52 -0000 >@@ -13,13 +13,15 @@ > import java.util.Arrays; > import java.util.Comparator; > >+import org.eclipse.core.runtime.Path; >+ > import org.eclipse.core.resources.ResourcesPlugin; > >+import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IJavaModel; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.JavaModelException; >-import org.eclipse.jdt.core.search.IJavaSearchScope; > > > public class TypeInfoFactory { >@@ -39,12 +41,56 @@ > } > > public TypeInfo create(char[] packageName, char[] typeName, char[][] enclosingName, int modifiers, String path) { >+ int index= path.length(); >+ int jarSeparator = -1; >+ int packageLength= packageName.length; >+ int packageEnd= -1; >+ loop: while (index-- > 0) { >+ char c= path.charAt(index); >+ switch (c) { >+ case TypeInfo.JAR_SEPARATOR: >+ jarSeparator= index; >+ break loop; >+ case TypeInfo.SEPARATOR : >+ if (packageEnd == -1) { >+ packageEnd= index; >+ break; >+ } else if (packageEnd-index <= packageLength && packageName[packageLength-(packageEnd-index)] != TypeInfo.PACKAGE_PART_SEPARATOR) { >+ packageName= null; >+ while (index-- > 0) { >+ if (path.charAt(index) == TypeInfo.JAR_SEPARATOR) { >+ jarSeparator= index; >+ break; >+ } >+ } >+ break loop; >+ } >+ break; >+ default: >+ if (packageEnd == -1) >+ break; >+ if (packageEnd-index <= packageLength && packageName[packageLength-(packageEnd-index)] != c) { >+ packageName= null; >+ while (index-- > 0) { >+ if (path.charAt(index) == TypeInfo.JAR_SEPARATOR) { >+ jarSeparator= index; >+ break; >+ } >+ } >+ break loop; >+ } >+ break; >+ } >+ } >+ if (packageName == null) >+ packageName= packageNameFromPath(path, index, packageEnd); >+ if (TypeFilter.isFiltered(packageName, typeName)) >+ return null; > String pn= getPackageName(packageName); > String tn= new String(typeName); > TypeInfo result= null; >- int index= path.indexOf(IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR); >- if (index != -1) { >- result= createJarFileEntryTypeInfo(pn, tn, enclosingName, modifiers, path, getJarFileEntryTypeInfo(fLast), index); >+ if (jarSeparator != -1) { >+ result= createJarFileEntryTypeInfo(pn, tn, enclosingName, modifiers, path, getJarFileEntryTypeInfo(fLast), jarSeparator); > } else { > String project= getProject(path); > if (project != null) { >@@ -59,6 +105,14 @@ > return result; > } > >+ private char[] packageNameFromPath(String path, int jarSeparator, int packageEnd) { >+ if (jarSeparator == -1) { >+ IJavaElement openable= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path))); >+ return openable.getParent().getElementName().toCharArray(); >+ } >+ return path.substring(jarSeparator, packageEnd).replace(TypeInfo.SEPARATOR, TypeInfo.PACKAGE_PART_SEPARATOR).toCharArray(); >+ } >+ > private static JarFileEntryTypeInfo getJarFileEntryTypeInfo(TypeInfo info) { > if (info == null || info.getElementType() != TypeInfo.JAR_FILE_ENTRY_TYPE_INFO) > return null; >@@ -71,19 +125,19 @@ > return (IFileTypeInfo)info; > } > >- private TypeInfo createJarFileEntryTypeInfo(String packageName, String typeName, char[][] enclosingName, int modifiers, String path, JarFileEntryTypeInfo last, int index) { >- String jar= path.substring(0, index); >- String rest= path.substring(index + 1); >- index= rest.lastIndexOf(TypeInfo.SEPARATOR); >- if (index != -1) { >- rest= rest.substring(index + 1); >+ private TypeInfo createJarFileEntryTypeInfo(String packageName, String typeName, char[][] enclosingName, int modifiers, String path, JarFileEntryTypeInfo last, int jarSeparator) { >+ String jar= path.substring(0, jarSeparator); >+ String rest= path.substring(jarSeparator + 1); >+ jarSeparator= rest.lastIndexOf(TypeInfo.SEPARATOR); >+ if (jarSeparator != -1) { >+ rest= rest.substring(jarSeparator + 1); > } > String file= null; > String extension= null; >- index= rest.lastIndexOf(TypeInfo.EXTENSION_SEPARATOR); >- if (index != -1) { >- file= rest.substring(0, index); >- extension= rest.substring(index + 1); >+ jarSeparator= rest.lastIndexOf(TypeInfo.EXTENSION_SEPARATOR); >+ if (jarSeparator != -1) { >+ file= rest.substring(0, jarSeparator); >+ extension= rest.substring(jarSeparator + 1); > } else { > return null; > } >Index: core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java,v >retrieving revision 1.18 >diff -u -r1.18 TypeInfo.java >--- core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java 24 Nov 2005 16:00:52 -0000 1.18 >+++ core extension/org/eclipse/jdt/internal/corext/util/TypeInfo.java 7 Apr 2006 09:11:52 -0000 >@@ -57,6 +57,7 @@ > static final char SEPARATOR= '/'; > static final char EXTENSION_SEPARATOR= '.'; > static final char PACKAGE_PART_SEPARATOR='.'; >+ static final char JAR_SEPARATOR= '|'; //IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR.charAt(0); > > static final String EMPTY_STRING= ""; //$NON-NLS-1$ > >Index: ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java,v >retrieving revision 1.38 >diff -u -r1.38 TypeInfoViewer.java >--- ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java 3 Apr 2006 15:31:40 -0000 1.38 >+++ ui/org/eclipse/jdt/internal/ui/dialogs/TypeInfoViewer.java 7 Apr 2006 09:11:52 -0000 >@@ -69,7 +69,6 @@ > import org.eclipse.jdt.internal.corext.Assert; > import org.eclipse.jdt.internal.corext.util.Messages; > import org.eclipse.jdt.internal.corext.util.Strings; >-import org.eclipse.jdt.internal.corext.util.TypeFilter; > import org.eclipse.jdt.internal.corext.util.TypeInfo; > import org.eclipse.jdt.internal.corext.util.TypeInfoFactory; > import org.eclipse.jdt.internal.corext.util.TypeInfoFilter; >@@ -126,9 +125,9 @@ > public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { > if (fStop) > return; >- if (TypeFilter.isFiltered(packageName, simpleTypeName)) >- return; > TypeInfo type= fFactory.create(packageName, simpleTypeName, enclosingTypeNames, modifiers, path); >+ if (type == null) >+ return; > if (fHistory.contains(type)) > return; > if (fFilter.matchesFilterExtension(type))
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 37525
: 37980