本文整理汇总了Java中org.eclipse.jdt.core.ClasspathContainerInitializer.requestClasspathContainerUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java ClasspathContainerInitializer.requestClasspathContainerUpdate方法的具体用法?Java ClasspathContainerInitializer.requestClasspathContainerUpdate怎么用?Java ClasspathContainerInitializer.requestClasspathContainerUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.ClasspathContainerInitializer
的用法示例。
在下文中一共展示了ClasspathContainerInitializer.requestClasspathContainerUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestContainerUpdate
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入方法依赖的package包/类
/**
* Request a container update.
* @param jproject The project of the container
* @param container The container to request a change to
* @param newEntries The updated entries
* @throws CoreException if the request failed
*/
public static void requestContainerUpdate(IJavaProject jproject, IClasspathContainer container, IClasspathEntry[] newEntries) throws CoreException {
IPath containerPath= container.getPath();
IClasspathContainer updatedContainer= new UpdatedClasspathContainer(container, newEntries);
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(containerPath.segment(0));
if (initializer != null) {
initializer.requestClasspathContainerUpdate(containerPath, jproject, updatedContainer);
}
}
示例2: performFinish
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入方法依赖的package包/类
@Override
public boolean performFinish() {
if (!super.performFinish())
return false;
IProject newProject = getNewProject();
try {
IProjectDescription description = newProject.getDescription();
String[] newNatures = new String[2];
newNatures[0] = JavaCore.NATURE_ID;
newNatures[1] = ActivitiProjectNature.NATURE_ID;
description.setNatureIds(newNatures);
newProject.setDescription(description, null);
IJavaProject javaProject = JavaCore.create(newProject);
createSourceFolders(newProject);
createOutputLocation(javaProject);
IFile pomFile = newProject.getFile("pom.xml");
InputStream pomSource = new ByteArrayInputStream(createPOMFile().getBytes());
pomFile.create(pomSource, true, null);
pomSource.close();
String[] userLibraryNames = JavaCore.getUserLibraryNames();
boolean activitiExtensionLibraryPresent = false;
if(userLibraryNames != null && userLibraryNames.length > 0) {
for(String userLibraryName : userLibraryNames) {
if(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS.equals(userLibraryName)) {
activitiExtensionLibraryPresent = true;
}
}
}
if(activitiExtensionLibraryPresent == false) {
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
initializer.requestClasspathContainerUpdate(containerPath.append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS),
null, new IClasspathContainer() {
public IPath getPath() {
return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS) ;
}
public int getKind() {
return K_APPLICATION;
}
public String getDescription() {
return ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS;
}
public IClasspathEntry[] getClasspathEntries() {
return new IClasspathEntry[] {};
}
});
}
IClasspathEntry[] entries = createClasspathEntries(javaProject);
javaProject.setRawClasspath(entries, null);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
示例3: performFinish
import org.eclipse.jdt.core.ClasspathContainerInitializer; //导入方法依赖的package包/类
@Override
public boolean performFinish() {
if (!super.performFinish())
return false;
IProject newProject = getNewProject();
try {
IProjectDescription description = newProject.getDescription();
String[] newNatures = new String[2];
newNatures[0] = JavaCore.NATURE_ID;
newNatures[1] = ActivitiProjectNature.NATURE_ID;
description.setNatureIds(newNatures);
newProject.setDescription(description, null);
IJavaProject javaProject = JavaCore.create(newProject);
createSourceFolders(newProject);
createOutputLocation(javaProject);
IFile pomFile = newProject.getFile("pom.xml");
InputStream pomSource = new ByteArrayInputStream(createPOMFile().getBytes());
pomFile.create(pomSource, true, null);
pomSource.close();
String[] userLibraryNames = JavaCore.getUserLibraryNames();
boolean activitiExtensionLibraryPresent = false;
if (userLibraryNames != null && userLibraryNames.length > 0) {
for (String userLibraryName : userLibraryNames) {
if (ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS.equals(userLibraryName)) {
activitiExtensionLibraryPresent = true;
}
}
}
if (activitiExtensionLibraryPresent == false) {
ClasspathContainerInitializer initializer = JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID);
IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID);
initializer.requestClasspathContainerUpdate(containerPath.append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS), null, new IClasspathContainer() {
public IPath getPath() {
return new Path(JavaCore.USER_LIBRARY_CONTAINER_ID).append(ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS);
}
public int getKind() {
return K_APPLICATION;
}
public String getDescription() {
return ActivitiPlugin.USER_LIBRARY_NAME_EXTENSIONS;
}
public IClasspathEntry[] getClasspathEntries() {
return new IClasspathEntry[] {};
}
});
}
IClasspathEntry[] entries = createClasspathEntries(javaProject);
javaProject.setRawClasspath(entries, null);
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}