当前位置: 首页>>代码示例>>Java>>正文


Java ClasspathContainerInitializer.requestClasspathContainerUpdate方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:BuildPathSupport.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:68,代码来源:CreateActivitiProjectWizard.java

示例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;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:70,代码来源:CreateDefaultActivitiProjectWizard.java


注:本文中的org.eclipse.jdt.core.ClasspathContainerInitializer.requestClasspathContainerUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。