public boolean performFinish() {
    try {
      project = createNewProject();
      sourceFolder = ProjectUtils.getWorkspaceFolder(project, "src", "main", "java");
      javaProject = JavaCore.create(project);
      root = javaProject.getPackageFragmentRoot(sourceFolder);
      JavaUtils.addJavaSupportAndSourceFolder(project, sourceFolder);
      addDependancies(project);

      String className = filterModel.getFilterClass();
      String packageName = filterModel.getFilterClassPackage();

      IPackageFragment sourcePackage = root.createPackageFragment(packageName, false, null);

      ICompilationUnit cu =
          sourcePackage.createCompilationUnit(
              className + ".java", getFilterClassSource(packageName, className), false, null);
      project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());

      File pomfile = project.getFile("pom.xml").getLocation().toFile();
      getModel().getMavenInfo().setPackageName("bundle");
      if (!pomfile.exists()) {
        createPOM(pomfile);
      }

      MavenProject mavenProject = MavenUtils.getMavenProject(pomfile);

      mavenProject.getModel().getProperties().put("CApp.type", "lib/registry/filter");

      Plugin plugin =
          MavenUtils.createPluginEntry(
              mavenProject, "org.apache.felix", "maven-bundle-plugin", "2.3.4", true);

      Xpp3Dom configurationNode = MavenUtils.createMainConfigurationNode(plugin);
      Xpp3Dom instructionNode = MavenUtils.createXpp3Node(configurationNode, "instructions");
      Xpp3Dom symbolicNameNode = MavenUtils.createXpp3Node(instructionNode, "Bundle-SymbolicName");
      symbolicNameNode.setValue(mavenProject.getArtifactId());
      Xpp3Dom bundleNameNode = MavenUtils.createXpp3Node(instructionNode, "Bundle-Name");
      bundleNameNode.setValue(mavenProject.getArtifactId());
      Xpp3Dom exportPackageNode = MavenUtils.createXpp3Node(instructionNode, "Export-Package");
      exportPackageNode.setValue(packageName);
      Xpp3Dom dynamicImportNode =
          MavenUtils.createXpp3Node(instructionNode, "DynamicImport-Package");
      dynamicImportNode.setValue("*");

      Repository repo = new Repository();
      repo.setUrl("http://maven.wso2.org/nexus/content/groups/wso2-public/");
      repo.setId("wso2-maven2-repository-1");

      mavenProject.getModel().addRepository(repo);
      mavenProject.getModel().addPluginRepository(repo);

      List<Dependency> dependencyList = new ArrayList<Dependency>();

      Map<String, JavaLibraryBean> dependencyInfoMap =
          JavaLibraryUtil.getDependencyInfoMap(project);
      Map<String, String> map = ProjectDependencyConstants.DEPENDENCY_MAP;
      for (JavaLibraryBean bean : dependencyInfoMap.values()) {
        if (bean.getVersion().contains("${")) {
          for (String path : map.keySet()) {
            bean.setVersion(bean.getVersion().replace(path, map.get(path)));
          }
        }
        Dependency dependency = new Dependency();
        dependency.setArtifactId(bean.getArtifactId());
        dependency.setGroupId(bean.getGroupId());
        dependency.setVersion(bean.getVersion());
        dependencyList.add(dependency);
      }
      MavenUtils.addMavenDependency(mavenProject, dependencyList);
      MavenUtils.saveMavenProject(mavenProject, pomfile);
      ProjectUtils.addNatureToProject(project, false, Constants.REGISTRY_FILTER_PROJECT_NATURE);
      MavenUtils.updateWithMavenEclipsePlugin(
          pomfile,
          new String[] {JDT_BUILD_COMMAND},
          new String[] {Constants.REGISTRY_FILTER_PROJECT_NATURE, JDT_PROJECT_NATURE});
      project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());

      try {
        refreshDistProjects();
        IEditorPart javaEditor = JavaUI.openInEditor(cu);
        JavaUI.revealInEditor(javaEditor, (IJavaElement) cu);
      } catch (Exception e) {
        /* ignore */
      }

    } catch (Exception e) {
      e.printStackTrace();
    }

    return true;
  }
  public boolean performFinish() {
    try {

      if (customMediatorModel.getSelectedOption().equals("new.mediator")) {
        project = createNewProject();
        IFolder srcFolder = ProjectUtils.getWorkspaceFolder(project, "src", "main", "java");
        JavaUtils.addJavaSupportAndSourceFolder(project, srcFolder);

        /*create the new Java project*/
        String className = customMediatorModel.getMediatorClassName();
        String packageName = customMediatorModel.getMediatorClassPackageName();
        IJavaProject iJavaProject = JavaCore.create(project);
        IPackageFragmentRoot root = iJavaProject.getPackageFragmentRoot(srcFolder);
        IPackageFragment sourcePackage = root.createPackageFragment(packageName, false, null);

        /*get the Mediator class template*/
        String template = CustomMediatorClassTemplate.getClassTemplete(packageName, className);
        ICompilationUnit cu =
            sourcePackage.createCompilationUnit(className + ".java", template, false, null);

        project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
        try {
          IEditorPart javaEditor = JavaUI.openInEditor(cu);
          JavaUI.revealInEditor(javaEditor, (IJavaElement) cu);
        } catch (Exception e) {
          log.error(e);
        }
      } else {
        project = customMediatorModel.getMediatorProject();
        project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
      }
      File pomfile = project.getFile("pom.xml").getLocation().toFile();
      getModel().getMavenInfo().setPackageName("bundle");
      if (!pomfile.exists()) {
        createPOM(pomfile);
        addDependancies(project);
      }
      MavenProject mavenProject = MavenUtils.getMavenProject(pomfile);
      boolean pluginExists =
          MavenUtils.checkOldPluginEntry(
              mavenProject, "org.apache.felix", "maven-bundle-plugin", "2.3.4");
      if (!pluginExists) {
        Plugin plugin =
            MavenUtils.createPluginEntry(
                mavenProject, "org.apache.felix", "maven-bundle-plugin", "2.3.4", true);

        Xpp3Dom configurationNode = MavenUtils.createMainConfigurationNode(plugin);
        Xpp3Dom instructionNode = MavenUtils.createXpp3Node("instructions");
        Xpp3Dom bundleSymbolicNameNode =
            MavenUtils.createXpp3Node(instructionNode, "Bundle-SymbolicName");
        Xpp3Dom bundleNameNode = MavenUtils.createXpp3Node(instructionNode, "Bundle-Name");
        ;
        Xpp3Dom exportPackageNode = MavenUtils.createXpp3Node(instructionNode, "Export-Package");
        Xpp3Dom dynamicImportNode =
            MavenUtils.createXpp3Node(instructionNode, "DynamicImport-Package");
        bundleSymbolicNameNode.setValue(project.getName());
        bundleNameNode.setValue(project.getName());
        if (customMediatorModel.getMediatorClassPackageName() != null
            && !customMediatorModel.getMediatorClassPackageName().trim().isEmpty()) {
          exportPackageNode.setValue(customMediatorModel.getMediatorClassPackageName());
        } else {
          IJavaProject javaProject = JavaCore.create(project);
          if (null != javaProject) {
            StringBuffer sb = new StringBuffer();
            for (IPackageFragment pkg : javaProject.getPackageFragments()) {
              if (pkg.getKind() == IPackageFragmentRoot.K_SOURCE) {
                if (pkg.hasChildren()) {
                  sb.append(pkg.getElementName()).append(",");
                }
              }
            }
            exportPackageNode.setValue(sb.toString().replaceAll(",$", ""));
          }
        }
        dynamicImportNode.setValue("*");
        configurationNode.addChild(instructionNode);
        MavenUtils.saveMavenProject(mavenProject, pomfile);
      }

      project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
      ProjectUtils.addNatureToProject(project, false, MEDIATOR_PROJECT_NATURE);
      MavenUtils.updateWithMavenEclipsePlugin(
          pomfile,
          new String[] {JDT_BUILD_COMMAND},
          new String[] {MEDIATOR_PROJECT_NATURE, JDT_PROJECT_NATURE});
      customMediatorModel.addToWorkingSet(project);
      project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
      refreshDistProjects();
    } catch (CoreException e) {
      log.error(e);
    } catch (Exception e) {
      log.error(e);
    }
    return true;
  }