Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IPackageFragment


    }

  private void createProjectJavaFile(IJavaProject project, String templateFile, String javaFile) throws JavaModelException, IOException {
    IFolder folder = project.getProject().getFolder("src/main/java");
        IPackageFragmentRoot packageFragmentRoot = project.getPackageFragmentRoot(folder);
        IPackageFragment packageFragment = packageFragmentRoot.createPackageFragment("com.sample", true, null);
        InputStream inputstream = getClass().getClassLoader().getResourceAsStream(templateFile);
        packageFragment.createCompilationUnit(javaFile, new String(readStream(inputstream)), true, null);
  }
View Full Code Here


   
    IJavaElement[] packageFragments = packageFragmentRoot.getChildren();
   
    for (int i = 0; i < packageFragments.length; i++)
    {
      IPackageFragment packageFragment = (IPackageFragment)packageFragments[i];
     
      accept(visitor, packageFragment);
    }
  }
View Full Code Here

     */
    private ICompilationUnit buildJavaFile(int i) {
        ICompilationUnit unit = null;
        try {
            IPackageFragmentRoot javaRoot = javaProject.getAllPackageFragmentRoots()[i];
            IPackageFragment orgFragment = javaRoot.createPackageFragment("org.loom", true, null);
            unit = orgFragment.createCompilationUnit("Wizard.java", "public class Wizard{}", true, null);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        return unit;
View Full Code Here

   * Create EntryPoint.
   */
  public IFile create(EntryPointPre21Configuration configuration) throws Exception {
    String className = configuration.getEntryPointName();
    String packageName = configuration.getPackageName();
    IPackageFragment packageFragment = getPackage(root, packageName);
    // prepare variables
    Map<String, String> variables = configuration.getVariables();
    variables.put("className", className);
    // create files from templates
    return createFileFromTemplate(packageFragment, className + ".java", "Module.java", variables);
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  public IFile create(ModuleConfiguration configuration) throws Exception {
    String moduleName = configuration.getModuleName();
    String packageName = configuration.getPackageName();
    // create packages
    IPackageFragment packageFragment = getPackage(root, packageName);
    getPackage(root, packageName + ".client");
    getPackage(root, packageName + ".server");
    //
    // create folders
    IJavaProject javaProject = packageFragment.getJavaProject();
    IProject project = javaProject.getProject();
    String webFolderName = WebUtils.getWebFolderName(project);
    IFolder webFolder = project.getFolder(webFolderName);
    IFolder webInfFolder = project.getFolder(webFolderName + "/WEB-INF");
    // create module
View Full Code Here

   * Create EntryPoint.
   */
  public IFile create(EntryPointConfiguration configuration) throws Exception {
    String className = configuration.getEntryPointName();
    String packageName = configuration.getPackageName();
    IPackageFragment packageFragment = getPackage(root, packageName);
    IFile file;
    if (Utils.supportMvp(packageFragment.getJavaProject()) && configuration.isUseMvp()) {
      // prepare variables
      Map<String, String> variables = configuration.getVariables();
      variables.put("className", className);
      // create files from MVP templates
      createMvpFactoryInterface(configuration);
View Full Code Here

    return file;
  }

  private void createMvpMappers(EntryPointConfiguration configuration) throws Exception {
    String packageName = configuration.getMappersPackageName();
    IPackageFragment packageFragment = getPackage(root, packageName);
    // prepare variables
    Map<String, String> variables = configuration.getVariables();
    // create ActivityMapper
    variables.put("className", "AppActivityMapper");
    variables.put("packageName", packageName);
View Full Code Here

  }

  private IFile createMvpFactoryInterface(EntryPointConfiguration configuration) throws Exception {
    final String className = configuration.getClientFactoryName();
    final String packageName = configuration.getClientFactoryPackageName();
    IPackageFragment packageFragment = getPackage(root, packageName);
    // prepare variables
    Map<String, String> variables = configuration.getVariables();
    variables.put("className", className);
    variables.put("packageName", packageName);
    IFile file =
View Full Code Here

  private IFile createMvpFactoryImplementation(EntryPointConfiguration configuration)
      throws Exception {
    final String className = configuration.getClientFactoryName();
    final String packageName = configuration.getClientFactoryPackageName();
    IPackageFragment packageFragment = getPackage(root, packageName);
    // prepare variables
    Map<String, String> variables = configuration.getVariables();
    variables.put("className", className + "Impl");
    variables.put("packageName", packageName);
    IFile file =
View Full Code Here

        setErrorState();
      } else {
        IJavaProject javaProject = element.getJavaProject();
        if (Utils.isGWTProject(javaProject)) {
          IPackageFragmentRoot testSourceFragmentRoot = handleTestSourceFolder(javaProject);
          IPackageFragment elementPackage = handleTestPackage(element, testSourceFragmentRoot);
          // handle class under test
          IType classUnderTestType = (IType) element.getAncestor(IJavaElement.TYPE);
          if (classUnderTestType == null) {
            ICompilationUnit compilationUnit =
                (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IPackageFragment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.