use of org.eclipse.jdt.core.IClasspathAttribute in project liferay-ide by liferay.
the class LiferayTomcatRuntimeClasspathProvider method getUpdatedJavadocEntries.
private IClasspathEntry[] getUpdatedJavadocEntries(IClasspathEntry[] entries, ILiferayTomcatRuntime liferayTomcatRuntime) {
List<IClasspathEntry> updatedEntries = new ArrayList<IClasspathEntry>();
String javadocURL = liferayTomcatRuntime.getJavadocURL();
if (javadocURL != null) {
for (IClasspathEntry existingEntry : entries) {
IPath path = existingEntry.getPath();
IClasspathEntry newEntry = null;
for (String javadocJar : JARS) {
if (path.lastSegment().equalsIgnoreCase(javadocJar)) {
IClasspathAttribute[] extraAttrs = existingEntry.getExtraAttributes();
List<IClasspathAttribute> newExtraAttrs = new ArrayList<IClasspathAttribute>();
IClasspathAttribute javadocAttr = newJavadocAttr(javadocURL);
newExtraAttrs.add(javadocAttr);
if (ListUtil.isNotEmpty(extraAttrs)) {
for (IClasspathAttribute attr : extraAttrs) {
if (!attr.getName().equals(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME)) {
newExtraAttrs.add(attr);
}
}
}
newEntry = JavaCore.newLibraryEntry(existingEntry.getPath(), existingEntry.getSourceAttachmentPath(), existingEntry.getSourceAttachmentRootPath(), existingEntry.getAccessRules(), newExtraAttrs.toArray(new IClasspathAttribute[0]), existingEntry.isExported());
break;
}
}
if (newEntry != null) {
updatedEntries.add(newEntry);
} else {
updatedEntries.add(existingEntry);
}
}
} else {
Collections.addAll(updatedEntries, entries);
}
return updatedEntries.toArray(new IClasspathEntry[0]);
}
use of org.eclipse.jdt.core.IClasspathAttribute in project lwjgl by LWJGL.
the class LWJGLClasspathContainerPage method update.
protected void update() {
IStatus status = null;
IClasspathEntry[] libEntries = BuildPathSupport.getLWJGLLibraryEntries();
IPath containerPath = LWJGLClasspathContainerInitializer.LWJGL_LIBRARY_PATH;
containerEntryResult = JavaCore.newContainerEntry(containerPath);
if (libEntries == null) {
status = new Status(ERROR, Activator.PLUGIN_ID, "No LWJGL library found");
} else if (labelResolvedPath != null && !labelResolvedPath.isDisposed()) {
// implies all other labels to be created and not yet disposed
if (libEntries != null) {
Set<String> setLines = new TreeSet<String>();
IPath path;
for (IClasspathEntry entry : libEntries) {
path = entry.getPath();
if (path != null) {
setLines.add(getPathLabel(path));
}
}
setLabel(labelResolvedPath, setLines);
setLines.clear();
for (IClasspathEntry entry : libEntries) {
path = entry.getSourceAttachmentPath();
if (path != null) {
setLines.add(getPathLabel(path));
}
}
setLabel(labelResolvedSourcePath, setLines);
setLines.clear();
for (IClasspathEntry entry : libEntries) {
if (entry.getExtraAttributes() != null) {
for (IClasspathAttribute attr : entry.getExtraAttributes()) {
if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attr.getName())) {
setLines.add(attr.getValue());
break;
}
if (JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY.equals(attr.getName())) {
}
}
}
}
setLabel(labelResolvedDocPath, setLines);
setLines.clear();
for (IClasspathEntry entry : libEntries) {
if (entry.getExtraAttributes() != null) {
for (IClasspathAttribute attr : entry.getExtraAttributes()) {
if (JavaRuntime.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY.equals(attr.getName())) {
setLines.add(attr.getValue());
}
}
}
}
setLabel(labelNativePath, setLines);
} else {
labelResolvedPath.setText("not found");
labelResolvedSourcePath.setText("not found");
labelResolvedDocPath.setText("not found");
}
}
if (status != null)
updateStatus(status);
}
use of org.eclipse.jdt.core.IClasspathAttribute in project lwjgl by LWJGL.
the class LWJGLClasspathContainerInitializer method requestClasspathContainerUpdate.
/**
* {@inheritDoc}
* @see org.eclipse.jdt.core.ClasspathContainerInitializer#requestClasspathContainerUpdate(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject, org.eclipse.jdt.core.IClasspathContainer)
*/
public void requestClasspathContainerUpdate(IPath containerPath, IJavaProject project, IClasspathContainer containerSuggestion) throws CoreException {
IClasspathEntry[] entries = containerSuggestion.getClasspathEntries();
if (entries.length == 1 && isValidLWJGLContainerPath(containerPath)) {
// String version = containerPath.segment(1);
// only modifiable entry in Javadoc location
IClasspathAttribute[] extraAttributes = entries[0].getExtraAttributes();
for (int i = 0; i < extraAttributes.length; i++) {
IClasspathAttribute attrib = extraAttributes[i];
if (attrib.getName().equals(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME)) {
break;
}
}
rebindClasspathEntries(project.getJavaModel(), containerPath);
}
}
use of org.eclipse.jdt.core.IClasspathAttribute in project azure-tools-for-java by Microsoft.
the class AIProjConfigWizardDialog method configureAzureSDK.
private void configureAzureSDK(IJavaProject proj) {
try {
IClasspathEntry[] classpath = proj.getRawClasspath();
for (IClasspathEntry iclasspathEntry : classpath) {
final IPath containerPath = iclasspathEntry.getPath();
if (containerPath.toString().contains(Messages.azureSDKcontainerID)) {
return;
}
}
List<IClasspathEntry> list = new ArrayList<IClasspathEntry>(java.util.Arrays.asList(classpath));
IClasspathAttribute[] attr = new IClasspathAttribute[1];
attr[0] = JavaCore.newClasspathAttribute(Messages.jstDep, "/WEB-INF/lib");
IClasspathEntry jarEntry = JavaCore.newContainerEntry(new Path(Messages.azureSDKcontainerID).append(getLatestSDKVersion()), null, attr, false);
list.add(jarEntry);
IClasspathEntry[] newClasspath = list.toArray(new IClasspathEntry[0]);
proj.setRawClasspath(newClasspath, null);
// Azure SDK configured - application insights configured for the first time for specific project
Bundle bundle = Activator.getDefault().getBundle();
if (bundle != null) {
PluginUtil.showBusy(true, getShell());
AppInsightsClient.create("Application Insights", bundle.getVersion().toString());
PluginUtil.showBusy(false, getShell());
}
} catch (Exception e) {
Activator.getDefault().log(e.getMessage(), e);
}
}
use of org.eclipse.jdt.core.IClasspathAttribute in project azure-tools-for-java by Microsoft.
the class ClasspathContainerPage method getSelection.
@Override
public IClasspathEntry getSelection() {
IClasspathEntry classPathEntry = null;
if (depCheck.getSelection()) {
IClasspathAttribute[] attr = new IClasspathAttribute[1];
attr[0] = JavaCore.newClasspathAttribute(Messages.jstDep, "/WEB-INF/lib");
classPathEntry = JavaCore.newContainerEntry(entry, null, attr, true);
} else {
classPathEntry = JavaCore.newContainerEntry(entry);
}
return classPathEntry;
}
Aggregations