public IWizardPage getNextPage(IWizardPage page) {
   IWizardPage nextPage = super.getNextPage(page);
   if (page instanceof ProjectOptionsDataPage) {
     if (getModel().getSelectedOption().equalsIgnoreCase("import.mediator")) {
       IProject temp = customMediatorModel.getMediatorProject();
       File pomfile = temp.getFile("pom.xml").getLocation().toFile();
       if (!pomfile.exists()) {
         try {
           getModel()
               .setMavenInfo(
                   new MavenInfo("org.wso2.carbon." + temp.getName(), temp.getName(), "1.0.0"));
           getModel().setProjectName(temp.getName());
         } catch (Exception e) {
           log.error("project update fail", e);
         }
       } else {
         nextPage = null;
       }
     }
   }
   return nextPage;
 }
  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;
  }