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 139486 Details for
Bug 280683
IJavaProjectLite API
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
javaProjectLite.txt (text/plain), 8.99 KB, created by
Jason Sholl
on 2009-06-17 17:33:39 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Jason Sholl
Created:
2009-06-17 17:33:39 EDT
Size:
8.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.j2ee >Index: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaProjectLite.java >=================================================================== >RCS file: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaProjectLite.java >diff -N j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaProjectLite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaProjectLite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+package org.eclipse.jst.j2ee.internal.javalite; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.IJavaProject; >+ >+/** >+ * @see IJavaProjectLite >+ */ >+public final class JavaProjectLite implements IJavaProjectLite { >+ final IJavaProject javaProject; >+ >+ JavaProjectLite(IJavaProject javaProject) { >+ this.javaProject = javaProject; >+ } >+ >+ /** >+ * @see IJavaProjectLite#readRawClasspath() >+ */ >+ public final IClasspathEntry[] readRawClasspath() { >+ return javaProject.readRawClasspath(); >+ } >+ >+ /** >+ * @see IJavaProjectLite#readOutputLocation() >+ */ >+ public final IPath readOutputLocation() { >+ return javaProject.readOutputLocation(); >+ } >+ >+ /** >+ * @see IJavaProjectLite#getProject() >+ */ >+ public final IProject getProject() { >+ return javaProject.getProject(); >+ } >+ >+ /** >+ * @see IJavaProjectLite#isOpen() >+ */ >+ public final boolean isOpen() { >+ return javaProject.isOpen(); >+ } >+ >+ /** >+ * @see IJavaProjectLite#hasBuildState() >+ */ >+ public final boolean hasBuildState(){ >+ return javaProject.hasBuildState(); >+ } >+} >Index: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaCoreLite.java >=================================================================== >RCS file: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaCoreLite.java >diff -N j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaCoreLite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaCoreLite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+package org.eclipse.jst.j2ee.internal.javalite; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.JavaCore; >+ >+public final class JavaCoreLite { >+ >+ public static final IJavaProjectLite create(IProject project) { >+ IJavaProject javaProject = JavaCore.create(project); >+ if (javaProject != null) { >+ return new JavaProjectLite(javaProject); >+ } >+ return null; >+ } >+} >Index: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/IJavaProjectLite.java >=================================================================== >RCS file: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/IJavaProjectLite.java >diff -N j2eecreation/org/eclipse/jst/j2ee/internal/javalite/IJavaProjectLite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2eecreation/org/eclipse/jst/j2ee/internal/javalite/IJavaProjectLite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+package org.eclipse.jst.j2ee.internal.javalite; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.IJavaModel; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.JavaCore; >+ >+/** >+ * <p> >+ * Represents a scaled down version of an {@link IJavaProject}. This subset of >+ * methods is guaranteed to not force a load of the underlying >+ * {@link IJavaModel}. This enables safe access to a limited set of >+ * {@link IJavaProject} API for multi-threaded clients to call during times of >+ * extreme concurrency, e.g. workbench startup. >+ * </p> >+ * <p> >+ * An instance of one of these handles can be created via >+ * <code>JavaCoreLite.create(project)</code>. >+ * </p> >+ * >+ * @see JavaCore#create(org.eclipse.core.resources.IProject) >+ * @see IJavaProject >+ * @see IClasspathEntry >+ */ >+public interface IJavaProjectLite { >+ /** >+ * @see IJavaProject#readRawClasspath() >+ * >+ * @return >+ */ >+ IClasspathEntry[] readRawClasspath(); >+ >+ /** >+ * @see IJavaProject#readOutputLocation() >+ * >+ * @return >+ */ >+ IPath readOutputLocation(); >+ >+ /** >+ * @see IJavaProject#getProject() >+ * >+ * @return >+ */ >+ IProject getProject(); >+ >+ /** >+ * @see IJavaProject#isOpen() >+ * @return >+ */ >+ boolean isOpen(); >+ >+ /** >+ * @see IJavaProject#hasBuildState() >+ * @return >+ */ >+ public boolean hasBuildState(); >+} >Index: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaLiteUtilities.java >=================================================================== >RCS file: j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaLiteUtilities.java >diff -N j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaLiteUtilities.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ j2eecreation/org/eclipse/jst/j2ee/internal/javalite/JavaLiteUtilities.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,98 @@ >+package org.eclipse.jst.j2ee.internal.javalite; >+ >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.List; >+ >+import org.eclipse.core.resources.IContainer; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.wst.common.componentcore.ComponentCore; >+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; >+import org.eclipse.wst.common.componentcore.resources.IVirtualResource; >+ >+public final class JavaLiteUtilities { >+ >+ public final static List<IContainer> getAllJavaSourceContainers(final IJavaProjectLite javaProject) { >+ IClasspathEntry[] entries = javaProject.readRawClasspath(); >+ List<IContainer> sourceContainers = new ArrayList<IContainer>(); >+ for (IClasspathEntry entry : entries) { >+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { >+ IContainer container = javaProject.getProject().getFolder(entry.getPath()); >+ sourceContainers.add(container); >+ } >+ } >+ return sourceContainers; >+ } >+ >+ public final static List<IContainer> getJavaSourceContainers(final IVirtualComponent component) { >+ if (!component.isBinary()) { >+ IJavaProjectLite javaProject = JavaCoreLite.create(component.getProject()); >+ if (javaProject != null) { >+ List<IContainer> allSourceContainers = getAllJavaSourceContainers(javaProject); >+ List<IContainer> componentSourceContainers = new ArrayList<IContainer>(); >+ for (IContainer sourceContainer : allSourceContainers) { >+ IVirtualResource[] virtualResources = ComponentCore.createResources(sourceContainer); >+ for (IVirtualResource virtualResource : virtualResources) { >+ if (virtualResource.getComponent().equals(component)) { >+ componentSourceContainers.add(sourceContainer); >+ break; >+ } >+ } >+ } >+ } >+ } >+ return Collections.EMPTY_LIST; >+ } >+ >+ public final static List<IContainer> getOutputContainers(final IVirtualComponent component, int kind) { >+ if (!component.isBinary()) { >+ IJavaProjectLite javaProject = JavaCoreLite.create(component.getProject()); >+ if (javaProject != null) { >+ IClasspathEntry[] entries; >+ entries = javaProject.readRawClasspath(); >+ List<IContainer> componentOutputContainers = new ArrayList<IContainer>(); >+ for (IClasspathEntry entry : entries) { >+ IContainer container = null; >+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE >+ && (kind & IClasspathEntry.CPE_SOURCE) == IClasspathEntry.CPE_SOURCE) { >+ container = javaProject.getProject().getFolder(entry.getPath()); >+ } else if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY >+ && (kind & IClasspathEntry.CPE_LIBRARY) == IClasspathEntry.CPE_LIBRARY) { >+ container = javaProject.getProject().getFolder(entry.getPath()); >+ if (!container.exists()) { >+ container = null; >+ } >+ } >+ if (container != null) { >+ IVirtualResource[] virtualResources = ComponentCore.createResources(container); >+ for (IVirtualResource virtualResource : virtualResources) { >+ if (virtualResource.getComponent().equals(component)) { >+ IPath outputPath = entry.getOutputLocation(); >+ IContainer outputContainer = null; >+ if (outputPath == null) { >+ if (javaProject.readOutputLocation().segmentCount() == 1) { >+ outputContainer = javaProject.getProject(); >+ } else { >+ outputContainer = javaProject.getProject().getFolder( >+ javaProject.readOutputLocation().removeFirstSegments(1)); >+ } >+ } else { >+ outputContainer = javaProject.getProject().getFolder( >+ outputPath.removeFirstSegments(1)); >+ } >+ if (!componentOutputContainers.contains(outputContainer)) { >+ componentOutputContainers.add(outputContainer); >+ } >+ break; >+ } >+ } >+ } >+ } >+ return componentOutputContainers; >+ } >+ } >+ return Collections.EMPTY_LIST; >+ } >+ >+}
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 280683
: 139486