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 42606 Details for
Bug 143684
Creating of static imports is unavailable..
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
patch_143684.txt (text/plain), 4.00 KB, created by
Olivier Thomann
on 2006-05-25 13:23:07 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2006-05-25 13:23:07 EDT
Size:
4.00 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/CompilationUnit.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java,v >retrieving revision 1.230 >diff -u -r1.230 CompilationUnit.java >--- model/org/eclipse/jdt/internal/core/CompilationUnit.java 27 Apr 2006 10:07:34 -0000 1.230 >+++ model/org/eclipse/jdt/internal/core/CompilationUnit.java 25 May 2006 17:23:58 -0000 >@@ -372,8 +372,7 @@ > * @since 3.0 > */ > public IImportDeclaration createImport(String importName, IJavaElement sibling, int flags, IProgressMonitor monitor) throws JavaModelException { >- // TODO (jerome) - consult flags to create static imports >- CreateImportOperation op = new CreateImportOperation(importName, this); >+ CreateImportOperation op = new CreateImportOperation(importName, this, flags); > if (sibling != null) { > op.createBefore(sibling); > } >Index: model/org/eclipse/jdt/internal/core/CreateImportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateImportOperation.java,v >retrieving revision 1.28 >diff -u -r1.28 CreateImportOperation.java >--- model/org/eclipse/jdt/internal/core/CreateImportOperation.java 8 Apr 2005 20:30:28 -0000 1.28 >+++ model/org/eclipse/jdt/internal/core/CreateImportOperation.java 25 May 2006 17:23:58 -0000 >@@ -13,6 +13,7 @@ > import java.util.Iterator; > > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.jdt.core.Flags; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IImportDeclaration; > import org.eclipse.jdt.core.IJavaElement; >@@ -56,6 +57,8 @@ > * The name of the import to be created. > */ > protected String importName; >+ protected int flags; >+ > /** > * When executed, this operation will add an import to the given compilation unit. > */ >@@ -63,16 +66,27 @@ > super(parentElement); > this.importName = importName; > } >+public CreateImportOperation(String importName, ICompilationUnit parentElement, int flags) { >+ super(parentElement); >+ this.importName = importName; >+ this.flags = flags; >+} > protected StructuralPropertyDescriptor getChildPropertyDescriptor(ASTNode parent) { > return CompilationUnit.IMPORTS_PROPERTY; > } > protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException { > // ensure no duplicate > Iterator imports = this.cuAST.imports().iterator(); >+ boolean onDemand = this.importName.endsWith(".*"); //$NON-NLS-1$ >+ String importActualName = this.importName; >+ if (onDemand) { >+ importActualName = this.importName.substring(0, this.importName.length() - 2); >+ } > while (imports.hasNext()) { > ImportDeclaration importDeclaration = (ImportDeclaration) imports.next(); >- if (this.importName.equals(importDeclaration.getName().getFullyQualifiedName())) { >- //no new import was generated >+ if (importActualName.equals(importDeclaration.getName().getFullyQualifiedName()) >+ && (onDemand == importDeclaration.isOnDemand()) >+ && (Flags.isStatic(this.flags) == importDeclaration.isStatic())) { > this.creationOccurred = false; > return null; > } >@@ -80,9 +94,9 @@ > > AST ast = this.cuAST.getAST(); > ImportDeclaration importDeclaration = ast.newImportDeclaration(); >+ importDeclaration.setStatic(Flags.isStatic(this.flags)); > // split import name into individual fragments, checking for on demand imports >- boolean onDemand = this.importName.endsWith("*"); //$NON-NLS-1$ >- char[][] charFragments = CharOperation.splitOn('.', this.importName.toCharArray(), 0, onDemand ? this.importName.length()-2 : this.importName.length()); >+ char[][] charFragments = CharOperation.splitOn('.', importActualName.toCharArray(), 0, importActualName.length()); > int length = charFragments.length; > String[] strFragments = new String[length]; > for (int i = 0; i < length; i++) {
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 143684
:
42606
|
42607
|
44909