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 164723 Details for
Bug 308960
Resource Exception While getting a Working Copy for CompilationUnit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
code fragment
createCompilationUnit_fragment.txt (text/plain), 2.55 KB, created by
Nick Sandonato
on 2010-04-13 10:28:49 EDT
(
hide
)
Description:
code fragment
Filename:
MIME Type:
Creator:
Nick Sandonato
Created:
2010-04-13 10:28:49 EDT
Size:
2.55 KB
patch
obsolete
>private ICompilationUnit createCompilationUnit() throws JavaModelException { > > IPackageFragment packageFragment = null; > IJavaElement je = getJavaProject(); > > if (je == null || !je.exists()) > return null; > > switch (je.getElementType()) { > case IJavaElement.PACKAGE_FRAGMENT : > je = je.getParent(); > // fall through > > case IJavaElement.PACKAGE_FRAGMENT_ROOT : > IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) je; > packageFragment = packageFragmentRoot.getPackageFragment(IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH); > break; > > case IJavaElement.JAVA_PROJECT : > IJavaProject jProject = (IJavaProject) je; > > if (!jProject.exists()) { > if(DEBUG) { > System.out.println("** Abort create working copy: cannot create working copy: JSP is not in a Java project"); //$NON-NLS-1$ > } > return null; > } > > packageFragmentRoot = null; > IPackageFragmentRoot[] packageFragmentRoots = jProject.getPackageFragmentRoots(); > int i = 0; > while (i < packageFragmentRoots.length) { > if (!packageFragmentRoots[i].isArchive() && !packageFragmentRoots[i].isExternal()) { > packageFragmentRoot = packageFragmentRoots[i]; > break; > } > i++; > } > if (packageFragmentRoot == null) { > if(DEBUG) { > System.out.println("** Abort create working copy: cannot create working copy: JSP is not in a Java project with source package fragment root"); //$NON-NLS-1$ > } > return null; > } > packageFragment = packageFragmentRoot.getPackageFragment(IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH); > break; > > default : > return null; > } > > ICompilationUnit cu = packageFragment.getCompilationUnit(getClassname() + ".java").getWorkingCopy(getWorkingCopyOwner(), getProgressMonitor()); //$NON-NLS-1$ > setContents(cu); > > if(DEBUG) { > System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); //$NON-NLS-1$ > System.out.println("(+) JSPTranslation ["+ this + "] finished creating CompilationUnit: " + cu); //$NON-NLS-1$ //$NON-NLS-2$ > System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); //$NON-NLS-1$ > } > > return cu; > } > > private void setContents(ICompilationUnit cu) { > if (cu == null) > return; > > synchronized (cu) { > IBuffer buffer; > try { > > buffer = cu.getBuffer(); > } > catch (JavaModelException e) { > e.printStackTrace(); > buffer = null; > } > > if (buffer != null) > buffer.setContents(getJavaText()); > } > }
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 Raw
Actions:
View
Attachments on
bug 308960
:
164722
| 164723