本文整理汇总了Java中org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement.getClasspathEntry方法的典型用法代码示例。如果您正苦于以下问题:Java CPListElement.getClasspathEntry方法的具体用法?Java CPListElement.getClasspathEntry怎么用?Java CPListElement.getClasspathEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement
的用法示例。
在下文中一共展示了CPListElement.getClasspathEntry方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureJavadocLocation
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
/**
* Shows the UI for configuring a javadoc location attribute of the classpath entry. <code>null</code> is returned
* if the user cancels the dialog. The dialog does not apply any changes.
*
* @param shell The parent shell for the dialog.
* @param initialEntry The entry to edit. The kind of the classpath entry must be either
* <code>IClasspathEntry.CPE_LIBRARY</code> or <code>IClasspathEntry.CPE_VARIABLE</code>.
* @return Returns the resulting classpath entry containing a potentially modified javadoc location attribute
* The resulting entry can be used to replace the original entry on the classpath.
* Note that the dialog does not make any changes on the passed entry nor on the classpath that
* contains it.
*
* @since 3.1
*/
public static IClasspathEntry configureJavadocLocation(Shell shell, IClasspathEntry initialEntry) {
if (initialEntry == null) {
throw new IllegalArgumentException();
}
int entryKind= initialEntry.getEntryKind();
if (entryKind != IClasspathEntry.CPE_LIBRARY && entryKind != IClasspathEntry.CPE_VARIABLE) {
throw new IllegalArgumentException();
}
URL location= JavaUI.getLibraryJavadocLocation(initialEntry);
JavadocLocationDialog dialog= new JavadocLocationDialog(shell, BasicElementLabels.getPathLabel(initialEntry.getPath(), false), location);
if (dialog.open() == Window.OK) {
CPListElement element= CPListElement.createFromExisting(initialEntry, null);
URL res= dialog.getResult();
element.setAttribute(CPListElement.JAVADOC, res != null ? res.toExternalForm() : null);
return element.getClasspathEntry();
}
return null;
}
示例2: getRunnable
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
private static IRunnableWithProgress getRunnable(final Shell shell, final IJavaElement elem, final URL javadocLocation, final IClasspathEntry entry, final IPath containerPath) {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
IJavaProject project= elem.getJavaProject();
if (elem instanceof IPackageFragmentRoot) {
CPListElement cpElem= CPListElement.createFromExisting(entry, project);
String loc= javadocLocation != null ? javadocLocation.toExternalForm() : null;
cpElem.setAttribute(CPListElement.JAVADOC, loc);
IClasspathEntry newEntry= cpElem.getClasspathEntry();
String[] changedAttributes= { CPListElement.JAVADOC };
BuildPathSupport.modifyClasspathEntry(shell, newEntry, changedAttributes, project, containerPath, entry.getReferencingEntry() != null, monitor);
} else {
JavaUI.setProjectJavadocLocation(project, javadocLocation);
}
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:JavadocConfigurationPropertyPage.java
示例3: getRunnable
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
private static IRunnableWithProgress getRunnable(final Shell shell, final IJavaElement elem, final String nativeLibraryPath, final IClasspathEntry entry, final IPath containerPath, final boolean isReferencedEntry) {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
IJavaProject project= elem.getJavaProject();
if (elem instanceof IPackageFragmentRoot) {
CPListElement cpElem= CPListElement.createFromExisting(entry, project);
cpElem.setAttribute(CPListElement.NATIVE_LIB_PATH, nativeLibraryPath);
IClasspathEntry newEntry= cpElem.getClasspathEntry();
String[] changedAttributes= { CPListElement.NATIVE_LIB_PATH };
BuildPathSupport.modifyClasspathEntry(shell, newEntry, changedAttributes, project, containerPath, isReferencedEntry, monitor);
}
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
}
示例4: getConvertedEntry
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
private static IClasspathEntry getConvertedEntry(IClasspathEntry entry, IJavaProject project, Map<IPath, String> oldLocationMap) {
IPath path= null;
switch (entry.getEntryKind()) {
case IClasspathEntry.CPE_SOURCE:
case IClasspathEntry.CPE_PROJECT:
return null;
case IClasspathEntry.CPE_CONTAINER:
convertContainer(entry, project, oldLocationMap);
return null;
case IClasspathEntry.CPE_LIBRARY:
path= entry.getPath();
break;
case IClasspathEntry.CPE_VARIABLE:
path= JavaCore.getResolvedVariablePath(entry.getPath());
break;
default:
return null;
}
if (path == null) {
return null;
}
IClasspathAttribute[] extraAttributes= entry.getExtraAttributes();
for (int i= 0; i < extraAttributes.length; i++) {
if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(extraAttributes[i].getName())) {
return null;
}
}
String libraryJavadocLocation= oldLocationMap.get(path);
if (libraryJavadocLocation != null) {
CPListElement element= CPListElement.createFromExisting(entry, project);
element.setAttribute(CPListElement.JAVADOC, libraryJavadocLocation);
return element.getClasspathEntry();
}
return null;
}
示例5: getClasspathEntries
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
public IClasspathEntry[] getClasspathEntries() {
IClasspathEntry[] result= new IClasspathEntry[fCPListElements.size()];
int i= 0;
for (Iterator<CPListElement> iterator= fCPListElements.iterator(); iterator.hasNext();) {
CPListElement element= iterator.next();
result[i]= element.getClasspathEntry();
i++;
}
return result;
}
示例6: convert
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
/**
* Convert a list of <code>CPListElement</code>s to
* an array of <code>IClasspathEntry</code>.
*
* @param list the list to be converted
* @return an array containing build path entries
* corresponding to the list
*/
private static IClasspathEntry[] convert(List<CPListElement> list) {
IClasspathEntry[] entries= new IClasspathEntry[list.size()];
for (int i= 0; i < list.size(); i++) {
CPListElement element= list.get(i);
entries[i]= element.getClasspathEntry();
}
return entries;
}
示例7: setURL
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入方法依赖的package包/类
public void setURL(URL url, IProgressMonitor monitor) throws CoreException {
if (isProjectRef()) {
JavaUI.setProjectJavadocLocation(fProject, url);
} else {
CPListElement element= CPListElement.createFromExisting(fClasspathEntry, fProject);
String location= url != null ? url.toExternalForm() : null;
element.setAttribute(CPListElement.JAVADOC, location);
String[] changedAttributes= { CPListElement.JAVADOC };
BuildPathSupport.modifyClasspathEntry(null, element.getClasspathEntry(), changedAttributes, fProject, fContainerPath, fClasspathEntry.getReferencingEntry() != null, monitor);
fClasspathEntry= element.getClasspathEntry();
}
}