本文整理汇总了Java中org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement类的典型用法代码示例。如果您正苦于以下问题:Java CPListElement类的具体用法?Java CPListElement怎么用?Java CPListElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CPListElement类属于org.eclipse.jdt.internal.ui.wizards.buildpaths包,在下文中一共展示了CPListElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resetFilters
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
/**
* Resets inclusion and exclusion filters for the given
* <code>IJavaElement</code>
*
* @param element element to reset it's filters
* @param entry the <code>CPListElement</code> to reset its filters for
* @param project the Java project
* @param monitor progress monitor, can be <code>null</code>
* @throws JavaModelException
*/
public static void resetFilters(IJavaElement element, CPListElement entry, IJavaProject project, IProgressMonitor monitor) throws JavaModelException {
if (monitor == null)
monitor= new NullProgressMonitor();
try {
monitor.beginTask(NewWizardMessages.ClasspathModifier_Monitor_ResetFilters, 3);
List<Path> exclusionList= getFoldersOnCP(element.getPath(), project, new SubProgressMonitor(monitor, 2));
IPath outputLocation= (IPath) entry.getAttribute(CPListElement.OUTPUT);
if (outputLocation != null) {
IPath[] exclusionPatterns= (IPath[]) entry.getAttribute(CPListElement.EXCLUSION);
if (contains(new Path(completeName(outputLocation.lastSegment())), exclusionPatterns, null)) {
exclusionList.add(new Path(completeName(outputLocation.lastSegment())));
}
}
IPath[] exclusions= exclusionList.toArray(new IPath[exclusionList.size()]);
entry.setAttribute(CPListElement.INCLUSION, new IPath[0]);
entry.setAttribute(CPListElement.EXCLUSION, exclusions);
} finally {
monitor.done();
}
}
示例2: addExternalJars
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
public static BuildpathDelta addExternalJars(IPath[] absolutePaths, CPJavaProject cpProject) {
BuildpathDelta result= new BuildpathDelta(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddJarCP_tooltip);
IJavaProject javaProject= cpProject.getJavaProject();
List<CPListElement> existingEntries= cpProject.getCPListElements();
for (int i= 0; i < absolutePaths.length; i++) {
CPListElement newEntry= new CPListElement(javaProject, IClasspathEntry.CPE_LIBRARY, absolutePaths[i], null);
if (!existingEntries.contains(newEntry)) {
insertAtEndOfCategory(newEntry, existingEntries);
result.addEntry(newEntry);
}
}
result.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()]));
result.setDefaultOutputLocation(cpProject.getDefaultOutputLocation());
return result;
}
示例3: commitClassPath
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
public static void commitClassPath(List<CPListElement> newEntries, IJavaProject project, IProgressMonitor monitor) throws JavaModelException {
if (monitor == null)
monitor= new NullProgressMonitor();
monitor.beginTask("", 2); //$NON-NLS-1$
try {
IClasspathEntry[] entries= convert(newEntries);
IPath outputLocation= project.getOutputLocation();
IJavaModelStatus status= JavaConventions.validateClasspath(project, entries, outputLocation);
if (!status.isOK())
throw new JavaModelException(status);
BuildPathSupport.setEEComplianceOptions(project, newEntries);
project.setRawClasspath(entries, outputLocation, new SubProgressMonitor(monitor, 2));
} finally {
monitor.done();
}
}
示例4: 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);
}
}
};
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:19,代码来源:NativeLibrariesPropertyPage.java
示例5: getCommonParent
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
private CPUserLibraryElement getCommonParent(List<?> list) {
CPUserLibraryElement parent= null;
for (int i= 0, len= list.size(); i < len; i++) {
Object curr= list.get(i);
if (curr instanceof CPListElement) {
Object elemParent= ((CPListElement) curr).getParentContainer();
if (parent == null) {
if (elemParent instanceof CPUserLibraryElement) {
parent= (CPUserLibraryElement) elemParent;
} else {
return null;
}
} else if (parent != elemParent) {
return null;
}
} else {
return null;
}
}
return parent;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:22,代码来源:UserLibraryPreferencePage.java
示例6: doOpenInternalJarFileDialog
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
private CPListElement[] doOpenInternalJarFileDialog(CPListElement existing, Object parent) {
IPath path = existing.getPath();
IPath selectedPaths[] = BuildPathDialogAccess.chooseJAREntries(this.getShell(), path, new IPath[0]);
if (selectedPaths != null) {
List<CPListElement> elements = new ArrayList<CPListElement>();
for (int i= 0; i < selectedPaths.length; i++) {
CPListElement cpElement = new CPListElement(parent, fDummyProject, IClasspathEntry.CPE_LIBRARY, selectedPaths[i], null);
cpElement.setAttribute(CPListElement.SOURCEATTACHMENT, BuildPathSupport.guessSourceAttachment(cpElement));
cpElement.setAttribute(CPListElement.JAVADOC, BuildPathSupport.guessJavadocLocation(cpElement));
elements.add(cpElement);
}
return elements.toArray(new CPListElement[0]);
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:UserLibraryPreferencePage.java
示例7: 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;
}
示例8: apply
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
@Override
public void apply(IDocument document) {
Map<Object, Object> data= null;
if (fReferencedType != null) {
IJavaElement elem= fReferencedType.getJavaElement();
if (elem != null) {
IPackageFragmentRoot root= (IPackageFragmentRoot) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
if (root != null) {
try {
IClasspathEntry entry= root.getRawClasspathEntry();
if (entry != null) {
data= new HashMap<Object, Object>(1);
data.put(BuildPathsPropertyPage.DATA_REVEAL_ENTRY, entry);
if (entry.getEntryKind() != IClasspathEntry.CPE_CONTAINER) {
data.put(BuildPathsPropertyPage.DATA_REVEAL_ATTRIBUTE_KEY, CPListElement.ACCESSRULES);
}
}
} catch (JavaModelException e) {
// ignore
}
}
}
}
PreferencesUtil.createPropertyDialogOn(JavaPlugin.getActiveWorkbenchShell(), fProject, BuildPathsPropertyPage.PROP_ID, null, data).open();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:ReorgCorrectionsSubProcessor.java
示例9: createControl
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
/**
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
IAdaptable adaptable= getElement();
IJavaElement elem= (IJavaElement) adaptable.getAdapter(IJavaElement.class);
try {
if (elem instanceof IPackageFragmentRoot) {
fProject= elem.getJavaProject();
fElement= CPListElement.createFromExisting(((IPackageFragmentRoot) elem).getRawClasspathEntry(), fProject);
fIsValidElement= fElement != null;
} else {
fIsValidElement= false;
setDescription(PreferencesMessages.JavaCompilerPropertyPage_invalid_element_selection);
}
} catch (JavaModelException e) {
fIsValidElement= false;
setDescription(PreferencesMessages.JavaCompilerPropertyPage_invalid_element_selection);
}
super.createControl(parent);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:JavaCompilerPropertyPage.java
示例10: 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
示例11: doAdd
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
private void doAdd(List<Object> list) {
if (canAdd(list)) {
CPUserLibraryElement parentLibrary = getSingleSelectedLibrary(list);
IPath selection= getWorkbenchWindowSelection();
IPath selectedPaths[] = BuildPathDialogAccess.chooseJAREntries(this.getShell(), selection, new IPath[0]);
if (selectedPaths != null) {
List<CPListElement> elements = new ArrayList<CPListElement>();
for (int i= 0; i < selectedPaths.length; i++) {
CPListElement cpElement = new CPListElement(parentLibrary, fDummyProject, IClasspathEntry.CPE_LIBRARY, selectedPaths[i], null);
cpElement.setAttribute(CPListElement.SOURCEATTACHMENT, BuildPathSupport.guessSourceAttachment(cpElement));
cpElement.setAttribute(CPListElement.JAVADOC, BuildPathSupport.guessJavadocLocation(cpElement));
elements.add(cpElement);
parentLibrary.add(cpElement);
}
fLibraryList.refresh(parentLibrary);
fLibraryList.selectElements(new StructuredSelection(elements));
fLibraryList.expandElement(parentLibrary, 2);
}
}
}
示例12: hasChange
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
private boolean hasChange(IJavaProject project) throws JavaModelException {
if (!project.getOutputLocation().equals(fOutputLocation))
return true;
IClasspathEntry[] currentEntries= project.getRawClasspath();
if (currentEntries.length != fEntries.size())
return true;
int i= 0;
for (Iterator<CPListElement> iterator= fEntries.iterator(); iterator.hasNext();) {
CPListElement oldEntrie= iterator.next();
if (!oldEntrie.getClasspathEntry().equals(currentEntries[i]))
return true;
i++;
}
return false;
}
示例13: removeFromBuildpath
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
public static BuildpathDelta removeFromBuildpath(CPListElement[] toRemove, CPJavaProject cpProject) {
IJavaProject javaProject= cpProject.getJavaProject();
IPath projectPath= javaProject.getPath();
IWorkspaceRoot workspaceRoot= javaProject.getProject().getWorkspace().getRoot();
List<CPListElement> existingEntries= cpProject.getCPListElements();
BuildpathDelta result= new BuildpathDelta(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_tooltip);
for (int i= 0; i < toRemove.length; i++) {
CPListElement element= toRemove[i];
existingEntries.remove(element);
result.removeEntry(element);
IPath path= element.getPath();
removeFilters(path, javaProject, existingEntries);
if (!path.equals(projectPath)) {
IResource member= workspaceRoot.findMember(path);
if (member != null)
result.addDeletedResource(member);
} else if (cpProject.getDefaultOutputLocation().equals(projectPath) && containsSourceFolders(cpProject)) {
String outputFolderName= PreferenceConstants.getPreferenceStore().getString(PreferenceConstants.SRCBIN_BINNAME);
cpProject.setDefaultOutputLocation(cpProject.getDefaultOutputLocation().append(outputFolderName));
}
}
result.setDefaultOutputLocation(cpProject.getDefaultOutputLocation());
result.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()]));
return result;
}
示例14: createWorkingCopy
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
public CPJavaProject createWorkingCopy() {
List<CPListElement> newList= new ArrayList<CPListElement>(fCPListElements.size());
for (Iterator<CPListElement> iterator= fCPListElements.iterator(); iterator.hasNext();) {
CPListElement element= iterator.next();
newList.add(element.copy());
}
return new CPJavaProject(fJavaProject, newList, fDefaultOutputLocation);
}
示例15: doEdit
import org.eclipse.jdt.internal.ui.wizards.buildpaths.CPListElement; //导入依赖的package包/类
private void doEdit(List<Object> selected) {
if (selected.size() == 1) {
Object curr= selected.get(0);
if (curr instanceof CPListElementAttribute) {
editAttributeEntry((CPListElementAttribute) curr);
} else if (curr instanceof CPUserLibraryElement) {
editUserLibraryElement((CPUserLibraryElement) curr);
} else if (curr instanceof CPListElement) {
CPListElement elem= (CPListElement) curr;
editArchiveElement(elem, (CPUserLibraryElement) elem.getParentContainer());
}
doSelectionChanged(fLibraryList);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:UserLibraryPreferencePage.java