use of org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainer in project liferay-ide by liferay.
the class SDKProjectBuilder method updateClasspath.
protected IStatus updateClasspath(IProject project) throws CoreException {
FlexibleProjectContainer container = J2EEComponentClasspathContainerUtils.getInstalledWebAppLibrariesContainer(project);
if (container == null) {
return Status.OK_STATUS;
}
container.refresh();
container = J2EEComponentClasspathContainerUtils.getInstalledWebAppLibrariesContainer(project);
IClasspathEntry[] webappEntries = container.getClasspathEntries();
for (IClasspathEntry entry2 : webappEntries) {
String segment = entry2.getPath().lastSegment();
if (segment.equals(getProject().getName() + "-service.jar")) {
IFolder folder = getProject().getFolder(ISDKConstants.DEFAULT_DOCROOT_FOLDER + "/WEB-INF/service");
((ClasspathEntry) entry2).sourceAttachmentPath = folder.getFullPath();
break;
}
}
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer("org.eclipse.jst.j2ee.internal.web.container");
IJavaProject javaProject = JavaCore.create(project);
initializer.requestClasspathContainerUpdate(container.getPath(), javaProject, container);
return Status.OK_STATUS;
}
use of org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainer in project liferay-ide by liferay.
the class PluginPackageResourceListener method updateWebClasspathContainer.
protected void updateWebClasspathContainer(IVirtualComponent rootComponent, List<IVirtualReference> addRefs) throws CoreException {
IProject project = rootComponent.getProject();
IJavaProject javaProject = JavaCore.create(project);
FlexibleProjectContainer container = J2EEComponentClasspathContainerUtils.getInstalledWebAppLibrariesContainer(project);
if (container == null) {
return;
}
container.refresh();
// need to regrab this to get newest container
container = J2EEComponentClasspathContainerUtils.getInstalledWebAppLibrariesContainer(project);
if (container == null) {
return;
}
IClasspathEntry[] webappEntries = container.getClasspathEntries();
for (IClasspathEntry entry : webappEntries) {
String archiveName = entry.getPath().lastSegment();
for (IVirtualReference ref : addRefs) {
if (ref.getArchiveName().equals(archiveName)) {
IFile referencedFile = (IFile) ref.getReferencedComponent().getAdapter(IFile.class);
IProject referencedFileProject = referencedFile.getProject();
// IDE-110 IDE-648
IFolder folder = referencedFileProject.getFolder(ISDKConstants.DEFAULT_DOCROOT_FOLDER + "/WEB-INF/service");
((ClasspathEntry) entry).sourceAttachmentPath = folder.getFullPath();
}
}
}
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer("org.eclipse.jst.j2ee.internal.web.container");
initializer.requestClasspathContainerUpdate(container.getPath(), javaProject, container);
}
Aggregations