public static FlexibleProjectContainer getInstalledWebAppLibrariesContainer(IProject project){ IClasspathContainer container = getInstalledContainer(project, J2EEComponentClasspathUpdater.WEB_APP_LIBS_PATH); FlexibleProjectContainer webAppLibrariesContainer = null; if (null != container && container instanceof FlexibleProjectContainer) { webAppLibrariesContainer = (FlexibleProjectContainer) container; } return webAppLibrariesContainer; }
/** * Returns the existing classpath container if it is already on the classpath. This will not * create a new container. * * @param jproj * @param classpathContainerID * @return */ public IClasspathEntry getExistingContainer(IJavaProject jproj, IPath classpathContainerPath) { return J2EEComponentClasspathContainerUtils.getInstalledContainerEntry(jproj, classpathContainerPath); }
if(J2EEComponentClasspathContainerUtils.getDefaultUseEARLibraries()){ final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID); addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer));
private void processModules(Object[] projects) { for (int i = 0; i < projects.length; i++) { IProject project = (IProject) projects[i]; // this block is for Web app Libraries if (J2EEProjectUtilities.isDynamicWebProject(project)) { IClasspathContainer webAppLibrariesContainer = J2EEComponentClasspathContainerUtils.getInstalledWebAppLibrariesContainer(project); // If the container is present, refresh it if (webAppLibrariesContainer != null) { ((FlexibleProjectContainer) webAppLibrariesContainer).refresh(); } } // ******************** The following is for EAR Libraries IClasspathContainer earLibrariesContainer = J2EEComponentClasspathContainerUtils.getInstalledEARLibrariesContainer(project); // If the container is present, refresh it if (earLibrariesContainer != null) { ((J2EEComponentClasspathContainer) earLibrariesContainer).refresh(forceUpdateOnNextRun); } } // [202820] updateDependencyGraph = true; }
public IClasspathEntry[] getClasspathEntries() { if(!isUpdating){ if(this != J2EEComponentClasspathContainerUtils.getInstalledEARLibrariesContainer(javaProject.getProject())){ try { isUpdating = true; update(); } finally{ isUpdating = false; } } } return entries; }
private void removeOldWebContainerIfNecessary(IProject webProj) { IJavaProject jproj = JemProjectUtilities.getJavaProject(webProj); final IClasspathEntry[] current; try { current = jproj.getRawClasspath(); List updatedList = new ArrayList(); boolean useDefaultWebAppLibraries = J2EEComponentClasspathContainerUtils.getDefaultUseWebAppLibraries(); for (int i = 0; i < current.length; i++) { IClasspathEntry entry = current[i]; // the web container is added to the classpath if: // 1. they don't have an entry for WEB_LIB_CONTAINER AND // 2. they have an entry for WEB_LIB_PATH BUT // they do not have the preference checked to use the Web App classpath container if ((entry.getPath().toString().indexOf(WEB_LIB_CONTAINER) == -1) && ((entry.getPath().toString().indexOf(WEB_LIB_PATH) == -1) || !useDefaultWebAppLibraries)) updatedList.add(entry); } IClasspathEntry[] updated = (IClasspathEntry[])updatedList.toArray(new IClasspathEntry[updatedList.size()]); jproj.setRawClasspath(updated, null); jproj.save(null, true); } catch (JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
boolean useJDTToControlExport = J2EEComponentClasspathContainerUtils.getDefaultUseEARLibrariesJDTExport(); if(useJDTToControlExport){
if(J2EEComponentClasspathContainerUtils.getDefaultUseEARLibraries()){ final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID); addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer));
if(J2EEComponentClasspathContainerUtils.getDefaultUseEARLibraries()){ final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID); addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer));
public static J2EEComponentClasspathContainer getInstalledEARLibrariesContainer(IProject project) { IClasspathContainer container = getInstalledContainer(project, J2EEComponentClasspathContainer.CONTAINER_PATH); J2EEComponentClasspathContainer earLibrariesContainer = null; if (null != container && container instanceof J2EEComponentClasspathContainer) { earLibrariesContainer = (J2EEComponentClasspathContainer) container; } return earLibrariesContainer; }
public static IClasspathContainer getInstalledContainer(IProject project, IPath containerPath) { IJavaProject jproj = JavaCore.create(project); IClasspathEntry entry = getInstalledContainerEntry(jproj, containerPath); IClasspathContainer container = null; if (entry != null) { try { container = JavaCore.getClasspathContainer(containerPath, jproj); } catch (JavaModelException e) { J2EEPlugin.getDefault().getLogger().logError(e); } } return container; }
if(J2EEComponentClasspathContainerUtils.getDefaultUseEARLibraries()){ final IPath earLibContainer = new Path(J2EEComponentClasspathContainer.CONTAINER_ID); addToClasspath(jproj, JavaCore.newContainerEntry(earLibContainer));