public void setupNewProject(IDataModel dataModel, IFacetedProjectWorkingCopy facetedProject) {
    ProjectUtil.setGenerateDD(dataModel, true);

    FacetDataModelMap map = (FacetDataModelMap) dataModel.getProperty(FACET_DM_MAP);
    IDataModel webFacetModel = map.getFacetDataModel(IJ2EEFacetConstants.DYNAMIC_WEB_FACET.getId());

    webFacetModel.setStringProperty(
        IWebFacetInstallDataModelProperties.CONFIG_FOLDER,
        IPluginFacetConstants.PORTLET_PLUGIN_SDK_CONFIG_FOLDER);
    webFacetModel.setStringProperty(
        IWebFacetInstallDataModelProperties.SOURCE_FOLDER,
        IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER);
    IDataModel javaFacetModel = map.getFacetDataModel(JavaFacet.FACET.getId());
    javaFacetModel.setStringProperty(
        IJavaFacetInstallDataModelProperties.SOURCE_FOLDER_NAME,
        IPluginFacetConstants.PORTLET_PLUGIN_SDK_SOURCE_FOLDER);
    javaFacetModel.setStringProperty(
        IJavaFacetInstallDataModelProperties.DEFAULT_OUTPUT_FOLDER_NAME,
        IPluginFacetConstants.PORTLET_PLUGIN_SDK_DEFAULT_OUTPUT_FOLDER);

    if (dataModel.isNestedModel(PLUGIN_FRAGMENT_DM)) {
      dataModel.removeNestedModel(PLUGIN_FRAGMENT_DM);
    }

    // need to allow portlet framework to do any additional configuration

    IPortletFramework portletFramework =
        (IPortletFramework) dataModel.getProperty(PORTLET_FRAMEWORK);

    portletFramework.configureNewProject(dataModel, facetedProject);
  }
 private IDataModel getWebModelConfig(String warSourceDirectory, String contextRoot) {
   IDataModel webModelCfg =
       DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
   webModelCfg.setProperty(
       IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER, warSourceDirectory);
   webModelCfg.setProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT, contextRoot);
   webModelCfg.setProperty(IJ2EEModuleFacetInstallDataModelProperties.GENERATE_DD, false);
   return webModelCfg;
 }
 @Override
 protected void populateRoot(Object config) {
   IDataModel dataModel = (IDataModel) config;
   EXmlBindings xmlBindings = OxmFactory.eINSTANCE.createEXmlBindings();
   xmlBindings.setDocumentVersion(dataModel.getStringProperty(VERSION));
   String packageName = dataModel.getStringProperty(PACKAGE_NAME);
   if (!StringTools.isBlank(packageName)) {
     xmlBindings.setPackageName(packageName);
   }
   getResourceContents().add(xmlBindings);
 }
 /**
  * Install a Web Facet version
  *
  * @param mavenProject
  * @param warSourceDirectory
  * @param actions
  * @param webFv
  */
 private void installWebFacet(
     MavenProject mavenProject,
     String warSourceDirectory,
     String contextRoot,
     Set<Action> actions,
     IProjectFacetVersion webFv) {
   IDataModel webModelCfg =
       DataModelFactory.createDataModel(new WebFacetInstallDataModelProvider());
   webModelCfg.setProperty(
       IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER, warSourceDirectory);
   webModelCfg.setProperty(IWebFacetInstallDataModelProperties.CONTEXT_ROOT, contextRoot);
   webModelCfg.setProperty(IJ2EEModuleFacetInstallDataModelProperties.GENERATE_DD, false);
   actions.add(
       new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, webFv, webModelCfg));
 }
  /** Finish has been pressed. */
  @SuppressWarnings("deprecation")
  public void transferStateToConfig() {
    String seamRuntimeName = jBossSeamHomeEditor.getValueAsString();
    SeamRuntime seamRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(seamRuntimeName);
    if (seamRuntime != null) {
      SeamRuntimeManager.getInstance().setDefaultRuntime(seamRuntime);
    }

    if (connProfileSelEditor != null) {
      SeamCorePlugin.getDefault()
          .getPluginPreferences()
          .setValue(
              SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE,
              connProfileSelEditor.getValueAsString());
    } else {
      SeamCorePlugin.getDefault()
          .getPluginPreferences()
          .setValue(
              SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE, getJpaConnectionProfile());
      model.setStringProperty(
          ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, getJpaConnectionProfile());
    }

    if (jBossHibernateDbTypeEditor != null) {
      SeamCorePlugin.getDefault()
          .getPluginPreferences()
          .setValue(
              SeamProjectPreferences.HIBERNATE_DEFAULT_DB_TYPE,
              this.jBossHibernateDbTypeEditor.getValueAsString());
    }

    SeamCorePlugin.getDefault()
        .getPluginPreferences()
        .setValue(
            SeamProjectPreferences.JBOSS_AS_DEFAULT_DEPLOY_AS,
            this.jBossAsDeployAsEditor.getValueAsString());

    model.setBooleanProperty(
        ISeamFacetDataModelProperties.SEAM_TEMPLATES_AND_LIBRARIES_COPYING,
        isSeamProjectWizard() || isWebProjectWizard());

    model.setBooleanProperty(
        ISeamFacetDataModelProperties.SEAM_RUNTIME_LIBRARIES_COPYING,
        libraryListEditor
                .getValueAsString()
                .equals(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_COPY_LIBRARIES)
            && (isSeamProjectWizard() || isWebProjectWizard()));
  }
  /*
   * Fills Code Generation group with the default package names.
   */
  private void setCodeGenerationProperties() {
    String seamProjectName =
        model.getStringProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);

    if (seamProjectName == null) return;

    if ("".equals(sessionBeanPkgNameditor.getValueAsString()))
      sessionBeanPkgNameditor.setValue(getSessionPkgName(seamProjectName));

    if ("".equals(entityBeanPkgNameditor.getValueAsString()))
      entityBeanPkgNameditor.setValue(getEntityPkgName(seamProjectName));

    if ("".equals(testsPkgNameditor.getValueAsString()))
      testsPkgNameditor.setValue(getTestPkgName(seamProjectName));

    if (!isWebProjectWizard()) {
      if ("".equals(ejbProjectNameditor.getValueAsString()))
        ejbProjectNameditor.setValue(getEJBProjectName(seamProjectName));

      if ("".equals(earProjectNameditor.getValueAsString()))
        earProjectNameditor.setValue(getEARProjectName(seamProjectName));
    }

    if ("".equals(testProjectNameditor.getValueAsString()))
      testProjectNameditor.setValue(getTestProjectName(seamProjectName));
  }
  public void execute(
      IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
      throws CoreException {
    if (monitor != null) {
      monitor.beginTask("", 1); // $NON-NLS-1$
    }

    try {
      IDataModel model = (IDataModel) config;

      // Associate with an EAR, if necessary.

      final String earProjectName =
          (String) model.getProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME);
      if (model.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR)) {
        if (earProjectName != null && !earProjectName.equals("")) { // $NON-NLS-1$

          String ver = fv.getVersionString();
          String j2eeVersionText =
              J2EEVersionUtil.convertVersionIntToString(
                  J2EEVersionUtil.convertConnectorVersionStringToJ2EEVersionID(ver));

          final String moduleURI =
              model.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.MODULE_URI);

          final IFacetedProjectWorkingCopy fpjwc =
              (IFacetedProjectWorkingCopy) model.getProperty(FACETED_PROJECT_WORKING_COPY);

          installAndAddModuletoEAR(
              j2eeVersionText,
              earProjectName,
              fpjwc.getPrimaryRuntime(),
              project,
              moduleURI,
              monitor);
        }
      }

      if (monitor != null) {
        monitor.worked(1);
      }
    } finally {
      if (monitor != null) {
        monitor.done();
      }
    }
  }
  protected void addToWar(IVirtualComponent warComp, IVirtualComponent j2eeComp, String moduleURI) {
    final IDataModel dataModel =
        DataModelFactory.createDataModel(
            new AddWebFragmentComponentToWebApplicationDataModelProvider());
    Map map =
        (Map)
            dataModel.getProperty(
                IAddWebFragmentComponentToWebApplicationDataModelProperties
                    .TARGET_COMPONENTS_TO_URI_MAP);
    map.put(j2eeComp, moduleURI);

    dataModel.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, warComp);

    List modList =
        (List)
            dataModel.getProperty(
                ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
    modList.add(j2eeComp);
    dataModel.setProperty(
        ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modList);
    dataModel.setProperty(
        ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH,
        "/WEB-INF/lib"); //$NON-NLS-1$
    try {
      dataModel.getDefaultOperation().execute(null, null);
    } catch (ExecutionException e) {
      J2EEPlugin.logError(e);
    }
  }
  @Override
  public void execute(
      IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
      throws CoreException {

    super.execute(project, fv, config, monitor);

    IDataModel model = (IDataModel) config;

    IDataModel masterModel =
        (IDataModel) model.getProperty(FacetInstallDataModelProvider.MASTER_PROJECT_DM);

    if (masterModel != null && masterModel.getBooleanProperty(CREATE_PROJECT_OPERATION)) {
      SDK sdk = getSDK();

      String hookName = this.masterModel.getStringProperty(HOOK_NAME);

      // FIX IDE-450
      if (hookName.endsWith(ISDKConstants.HOOK_PLUGIN_PROJECT_SUFFIX)) {
        hookName =
            hookName.substring(0, hookName.indexOf(ISDKConstants.HOOK_PLUGIN_PROJECT_SUFFIX));
      }
      // END FIX IDE-450

      String displayName = this.masterModel.getStringProperty(DISPLAY_NAME);

      IPath installPath = sdk.createNewHookProject(hookName, displayName);

      IPath tempInstallPath =
          installPath.append(hookName + ISDKConstants.HOOK_PLUGIN_PROJECT_SUFFIX);

      processNewFiles(tempInstallPath, false);

      // cleanup hook files
      FileUtil.deleteDir(tempInstallPath.toFile(), true);

      this.project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
    } else {
      setupDefaultOutputLocation();
    }

    // IDE-491 don't add this in the webxml by default
    // ProjectUtil.addLiferayPortletTldToWebXML( this.project );
  }
  public IStatus doSetCustomJSPDir(IDOMDocument document, IDataModel model) {
    // <hook> element
    Element rootElement = document.getDocumentElement();

    final ILiferayProject lrproject = LiferayCore.create(project);
    final IPath defaultWebappRootFolderFullPath = lrproject.getDefaultDocrootFolder().getFullPath();

    String customJSPsFolder = model.getStringProperty(CUSTOM_JSPS_FOLDER);

    String relativeJspFolderPath =
        ProjectUtil.getRelativePathFromDocroot(
            this.project,
            defaultWebappRootFolderFullPath.append(customJSPsFolder).toPortableString());

    Element customJspElement = null;

    // check for existing element
    NodeList nodeList = rootElement.getElementsByTagName("custom-jsp-dir"); // $NON-NLS-1$

    if (nodeList != null && nodeList.getLength() > 0) {
      customJspElement = (Element) nodeList.item(0);

      NodeUtil.removeChildren(customJspElement);

      Node textNode = document.createTextNode(relativeJspFolderPath);

      customJspElement.appendChild(textNode);
    } else {
      // need to insert customJspElement before any <service>
      NodeList serviceTags = rootElement.getElementsByTagName("service"); // $NON-NLS-1$

      if (serviceTags != null && serviceTags.getLength() > 0) {
        customJspElement =
            NodeUtil.insertChildElement(
                rootElement,
                serviceTags.item(0),
                "custom-jsp-dir",
                relativeJspFolderPath); //$NON-NLS-1$
      } else {
        customJspElement =
            NodeUtil.appendChildElement(
                rootElement, "custom-jsp-dir", relativeJspFolderPath); // $NON-NLS-1$

        // append a newline text node
        rootElement.appendChild(
            document.createTextNode(System.getProperty("line.separator"))); // $NON-NLS-1$
      }
    }

    // format the new node added to the model;
    FormatProcessorXML processor = new FormatProcessorXML();

    processor.formatNode(customJspElement);

    return Status.OK_STATUS;
  }
 /*
  * (non-Javadoc)
  * @see org.eclipse.wst.common.project.facet.core.IDelegate#execute(org.eclipse.core.resources.IProject, org.eclipse.wst.common.project.facet.core.IProjectFacetVersion, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
  */
 public void execute(
     IProject project, IProjectFacetVersion fv, Object config, IProgressMonitor monitor)
     throws CoreException {
   IDataModel model = (IDataModel) config;
   boolean generateBeansXml = model.getBooleanProperty(GENERATE_BEANS_XML);
   CDIUtil.enableCDI(project, generateBeansXml, monitor);
   if (errorOccurs) {
     errorOccurs = false;
     Display.getDefault()
         .syncExec(
             new Runnable() {
               public void run() {
                 ErrorDialog.openError(
                     Display.getCurrent().getActiveShell(),
                     CDICoreMessages.CDI_FACET_INSTALL_ABSTRACT_DELEGATE_ERROR,
                     CDICoreMessages.CDI_FACET_INSTALL_ABSTRACT_DELEGATE_CHECK_ERROR_LOG_VIEW,
                     new Status(
                         IStatus.ERROR,
                         CDICorePlugin.PLUGIN_ID,
                         CDICoreMessages.CDI_FACET_INSTALL_ABSTRACT_DELEGATE_ERRORS_OCCURED));
               }
             });
   }
 }
 public JpaProjectTestHarness(String projectName, boolean autoBuild, IDataModel jpaConfig)
     throws CoreException {
   super(projectName, autoBuild);
   String jpaFacetVersion = JpaProject.FACET_VERSION_STRING;
   if (jpaConfig != null) {
     jpaFacetVersion = jpaConfig.getStringProperty(IFacetDataModelProperties.FACET_VERSION_STR);
   }
   this.installFacet("jst.utility", "1.0");
   this.installFacet(JpaProject.FACET_ID, jpaFacetVersion, jpaConfig);
   this.addJar(jpaJarName());
   if (eclipseLinkJarName() != null) {
     this.addJar(eclipseLinkJarName());
   }
   this.getJpaProject().setDiscoversAnnotatedClasses(true);
 }
예제 #13
0
  private void createServiceXmlFile(String version, boolean useSample) throws Exception {
    final IProject project = createProject("serviceXmlFiles-" + version + "-" + useSample);

    final IDataModel model =
        DataModelFactory.createDataModel(new NewServiceBuilderDataModelProvider());

    model.setProperty(NewServiceBuilderDataModelProvider.AUTHOR, "junit");
    model.setProperty(NewServiceBuilderDataModelProvider.PACKAGE_PATH, "com.liferay.sample");
    model.setProperty(NewServiceBuilderDataModelProvider.NAMESPACE, "SAMPLE");
    model.setBooleanProperty(NewServiceBuilderDataModelProvider.USE_SAMPLE_TEMPLATE, useSample);

    final IFolder folder = project.getFolder("test");

    CoreUtil.prepareFolder(folder);

    final IFile serviceXmlFile = folder.getFile("service.xml");

    assertEquals(false, serviceXmlFile.exists());

    WizardUtil.createDefaultServiceBuilderFile(
        serviceXmlFile,
        version,
        model.getBooleanProperty(NewServiceBuilderDataModelProvider.USE_SAMPLE_TEMPLATE),
        model.getStringProperty(NewServiceBuilderDataModelProvider.PACKAGE_PATH),
        model.getStringProperty(NewServiceBuilderDataModelProvider.NAMESPACE),
        model.getStringProperty(NewServiceBuilderDataModelProvider.AUTHOR),
        new NullProgressMonitor());

    assertEquals(true, serviceXmlFile.exists());

    final String serviceXmlContent = CoreUtil.readStreamToString(serviceXmlFile.getContents());

    final String expectedServiceXmlContent =
        CoreUtil.readStreamToString(
            this.getClass()
                .getResourceAsStream("files/service-sample-" + version + "-" + useSample + ".xml"));

    assertEquals(
        stripCarriageReturns(expectedServiceXmlContent), stripCarriageReturns(serviceXmlContent));
  }
  public void propertyChanged(DataModelEvent event) {
    if (event.getPropertyName().equals(IJ2EEModuleFacetInstallDataModelProperties.CONFIG_FOLDER)) {
      model.setStringProperty(
          ISeamFacetDataModelProperties.WEB_CONTENTS_FOLDER, event.getProperty().toString());
    } else if (event.getPropertyName().equals(IFacetDataModelProperties.FACET_PROJECT_NAME)) {
      String seamProjectName = event.getProperty().toString();

      model.setStringProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME, seamProjectName);

      sessionBeanPkgNameditor.setValue(getSessionPkgName(seamProjectName));
      entityBeanPkgNameditor.setValue(getEntityPkgName(seamProjectName));
      testsPkgNameditor.setValue(getTestPkgName(seamProjectName));
      if (!isWebProjectWizard()) {
        ejbProjectNameditor.setValue(getEJBProjectName(seamProjectName));
        earProjectNameditor.setValue(getEARProjectName(seamProjectName));
      }
      testProjectNameditor.setValue(getTestProjectName(seamProjectName));

      model.setStringProperty(
          ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME,
          getSessionPkgName(seamProjectName));
      model.setStringProperty(
          ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME,
          getEntityPkgName(seamProjectName));
      model.setProperty(
          ISeamFacetDataModelProperties.TEST_PROJECT_CREATING,
          createTestProjectCheckboxeditor.getValue());
      model.setStringProperty(
          ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, getTestPkgName(seamProjectName));
      model.setStringProperty(
          ISeamFacetDataModelProperties.SEAM_EAR_PROJECT, earProjectNameditor.getValueAsString());
      model.setStringProperty(
          ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, ejbProjectNameditor.getValueAsString());
      model.setStringProperty(
          ISeamFacetDataModelProperties.SEAM_TEST_PROJECT, testProjectNameditor.getValueAsString());
    }
  }
 /*
  * Sets seam runtime field in default value.
  */
 private void setDefaultSeamRuntime() {
   ITaggedFieldEditor runtimesField =
       (ITaggedFieldEditor) ((CompositeEditor) jBossSeamHomeEditor).getEditors().get(1);
   Object oldValue = runtimesField.getValue();
   Object newValue = ""; // $NON-NLS-1$
   List<String> runtimes =
       getRuntimeNames(model.getProperty(IFacetDataModelProperties.FACET_VERSION_STR).toString());
   if (oldValue == null || !runtimes.contains(oldValue)) {
     Object defaultRnt = SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model);
     if (defaultRnt != null && runtimes.contains(defaultRnt)) {
       newValue = defaultRnt;
     } else if (!runtimes.isEmpty()) {
       newValue = runtimes.get(0);
     }
   } else {
     newValue = oldValue;
   }
   runtimesField.setValue(newValue);
   runtimesField.setTags(runtimes.toArray(new String[0]));
 }
  /** It is overridden to fill Code Generation group with the default package names */
  @Override
  public void setVisible(boolean visible) {
    if (visible) {
      setCodeGenerationProperties();
      setDefaultSeamRuntime();
      boolean jpaFacetAdded = getJpaFacetVersion() != null;
      if (jpaFacetAdded == needToShowConnectionProfile) {

        needToShowConnectionProfile = !jpaFacetAdded;
        createDatabaseGoupControl();
      }
      // update selected connection profile
      if (!needToShowConnectionProfile) {
        model.setStringProperty(
            ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, getJpaConnectionProfile());
      }
      validate();
    }
    super.setVisible(visible);
  };
 /** @see IValidator#validate(Object, Object) */
 public Map<String, IStatus> validate(Object value, Object context) {
   final String deploymentType = value.toString();
   if (!ISeamFacetDataModelProperties.DEPLOY_AS_WAR.equals(deploymentType)) {
     Object runtimeName =
         model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
     if (runtimeName != null) {
       IRuntime rt = RuntimeManager.getRuntime(runtimeName.toString());
       if (!rt.supports(EJB_30) || !rt.supports(EAR_50)) {
         return SeamValidatorFactory.createErrormessage(
             propertyName,
             new Status(
                 IStatus.ERROR,
                 SeamCorePlugin.PLUGIN_ID,
                 NLS.bind(
                     SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_CANNOT_USE_SELECTED_DEPLOYMENT6,
                     new String[] {deploymentType.toUpperCase(), runtimeName.toString()})));
       }
     }
   }
   return SeamValidatorFactory.NO_ERRORS;
 }
 @Override
 public boolean canAddNewPortlet(IDataModel model) {
   return model.getID().contains("NewVaadinPortlet");
 }
  public void execute(
      final IProject project,
      final IProjectFacetVersion fv,
      final Object cfg,
      final IProgressMonitor monitor)
      throws CoreException {
    if (monitor != null) {
      monitor.beginTask("", 1); // $NON-NLS-1$
    }

    try {
      IDataModel model = (IDataModel) cfg;

      if (monitor != null) {
        monitor.worked(1);
      }
      // Add WTP natures.

      WtpUtils.addNaturestoEAR(project);

      final IVirtualComponent c = ComponentCore.createComponent(project, false);
      c.create(0, null);

      final IVirtualFolder earroot = c.getRootFolder();
      Path contentDirPath =
          new Path(model.getStringProperty(IEarFacetInstallDataModelProperties.CONTENT_DIR));
      earroot.createLink(contentDirPath, 0, null);
      J2EEModuleVirtualComponent.setDefaultDeploymentDescriptorFolder(
          earroot, contentDirPath, null);

      try {
        ((IDataModelOperation) model.getProperty(FacetDataModelProvider.NOTIFICATION_OPERATION))
            .execute(monitor, null);
      } catch (ExecutionException e) {
        J2EEPlugin.logError(e);
      }

      if (fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_70
          || fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_60
          || fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_50) {
        if (model.getBooleanProperty(IJ2EEFacetInstallDataModelProperties.GENERATE_DD)) {
          // Create the deployment descriptor (application.xml) if one doesn't exist
          IFile appXmlFile =
              earroot.getUnderlyingFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI));
          if (!appXmlFile.exists()) {
            try {
              if (!appXmlFile.getParent().exists()
                  && (appXmlFile.getParent().getType() == IResource.FOLDER)) {
                ((IFolder) appXmlFile.getParent()).create(true, true, monitor);
              }
              String appXmlContents = null;
              if (fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_70) {
                appXmlContents =
                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<application id=\"Application_ID\" version=\"7\" xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd\">\n <display-name>"
                        + XMLWriter.getEscaped(project.getName())
                        + "</display-name> \n </application> "; //$NON-NLS-1$ //$NON-NLS-2$
              } else if (fv == IJ2EEFacetConstants.ENTERPRISE_APPLICATION_60) {
                appXmlContents =
                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<application id=\"Application_ID\" version=\"6\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd\">\n <display-name>"
                        + XMLWriter.getEscaped(project.getName())
                        + "</display-name> \n </application> "; //$NON-NLS-1$ //$NON-NLS-2$
              } else {
                appXmlContents =
                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<application id=\"Application_ID\" version=\"5\" xmlns=\"http://java.sun.com/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd\">\n <display-name>"
                        + XMLWriter.getEscaped(project.getName())
                        + "</display-name> \n </application> "; //$NON-NLS-1$ //$NON-NLS-2$
              }
              appXmlFile.create(
                  new ByteArrayInputStream(appXmlContents.getBytes("UTF-8")),
                  true,
                  monitor); //$NON-NLS-1$
            } catch (UnsupportedEncodingException e) {
              J2EEPlugin.logError(e);
            }
          }
        }
      } else {
        if (!earroot.getFile(J2EEConstants.APPLICATION_DD_URI).exists()) {
          String ver = model.getStringProperty(IFacetDataModelProperties.FACET_VERSION_STR);
          int nVer = J2EEVersionUtil.convertVersionStringToInt(ver);
          EARArtifactEdit.createDeploymentDescriptor(project, nVer);
        }
      }
    } finally {
      if (monitor != null) {
        monitor.done();
      }
    }
  }
 public void finishPressed() {
   model.removeListener(validatorDelegate);
 };
 public void setConfig(Object config) {
   model = (IDataModel) config;
   model.setProperty(
       ISeamFacetDataModelProperties.HIBERNATE_DIALECT,
       HIBERNATE_HELPER.getDialectClass(getDefaultDbType()));
 }
  /** Creates Seam Facet Wizard Page contents */
  public void createControl(Composite parent) {
    sync = new DataModelSynchronizer(model);
    jBossSeamHomeEditor =
        SeamWizardFactory.createSeamRuntimeSelectionFieldEditor(
            new SeamVersion[0],
            SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model),
            new NewSeamRuntimeAction());

    initializeDialogUnits(parent);

    Composite root = new Composite(parent, SWT.NONE);
    GridData gd = new GridData();

    gd.horizontalSpan = 1;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = false;

    GridLayout gridLayout = new GridLayout(1, false);
    root.setLayout(gridLayout);
    Group generalGroup = new Group(root, SWT.NONE);
    generalGroup.setLayoutData(gd);
    generalGroup.setText(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_GENERAL);
    gridLayout = new GridLayout(3, false);

    generalGroup.setLayout(gridLayout);
    registerEditor(jBossSeamHomeEditor, generalGroup, 3);
    jBossSeamHomeEditor.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent arg0) {
            Boolean testProject = canTestProjectBeCreated();
            createTestProjectCheckboxeditor.setValue(testProject);
            createTestProjectCheckboxeditor.setEnabled(testProject);
          }
        });

    Object deployAs = getDeployAsDefaultValue();
    jBossAsDeployAsEditor.setValue(deployAs);

    registerEditor(jBossAsDeployAsEditor, generalGroup, 3);
    registerEditor(ejbProjectNameditor, generalGroup, 3);
    ejbProjectNameditor.setEnabled(deployAs.equals(ISeamFacetDataModelProperties.DEPLOY_AS_EAR));
    registerEditor(earProjectNameditor, generalGroup, 3);
    earProjectNameditor.setEnabled(deployAs.equals(ISeamFacetDataModelProperties.DEPLOY_AS_EAR));

    List<String> providers = new ArrayList<String>();
    providers.add(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_COPY_LIBRARIES);
    providers.add(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_CONFIGURE_LATER);

    libraryListEditor =
        IFieldEditorFactory.INSTANCE.createComboEditor(
            ISeamFacetDataModelProperties.SEAM_LIBRARY_PROVIDER,
            SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_LIBRARIES,
            providers,
            providers.get(0));

    registerEditor(libraryListEditor, generalGroup, 3);

    jBossAsDeployAsEditor.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent arg0) {
            Boolean value =
                jBossAsDeployAsEditor.getValue() == ISeamFacetDataModelProperties.DEPLOY_AS_EAR;
            if (!isWebProjectWizard()) {
              ejbProjectNameditor.setEnabled(value.booleanValue());
              earProjectNameditor.setEnabled(value.booleanValue());
            }
          }
        });

    gd = new GridData();
    gd.horizontalSpan = 1;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = false;

    databaseGroup = new Group(root, SWT.NONE);
    databaseGroup.setLayoutData(gd);
    databaseGroup.setText(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_DATABASE);
    gridLayout = new GridLayout(4, false);
    databaseGroup.setLayout(gridLayout);

    jBossHibernateDbTypeEditor =
        IFieldEditorFactory.INSTANCE.createComboEditor(
            ISeamFacetDataModelProperties.DB_TYPE,
            SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_DATABASE_TYPE,
            Arrays.asList(HIBERNATE_HELPER.getDialectNames()),
            getDefaultDbType(),
            false);
    registerEditor(jBossHibernateDbTypeEditor, databaseGroup, 4);

    createDatabaseGoupControl();

    Group generationGroup = new Group(root, SWT.NONE);
    gd = new GridData();
    gd.horizontalSpan = 1;
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = false;

    generationGroup.setLayoutData(gd);
    generationGroup.setText(SeamCoreMessages.SEAM_INSTALL_WIZARD_PAGE_CODE_GENERATION);
    gridLayout = new GridLayout(3, false);
    generationGroup.setLayout(gridLayout);
    registerEditor(sessionBeanPkgNameditor, generationGroup, 3);
    registerEditor(entityBeanPkgNameditor, generationGroup, 3);

    registerEditor(createTestProjectCheckboxeditor, generationGroup, 3);
    createTestProjectCheckboxeditor.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent arg0) {
            Boolean value = (Boolean) createTestProjectCheckboxeditor.getValue();
            testsPkgNameditor.setEnabled(value.booleanValue());
            testProjectNameditor.setEnabled(value.booleanValue());
          }
        });

    registerEditor(testProjectNameditor, generationGroup, 3);
    registerEditor(testsPkgNameditor, generationGroup, 3);

    if (!isSeamProjectWizard()) {
      createTestProjectCheckboxeditor.setValue(false);
      createTestProjectCheckboxeditor.setEnabled(false);
      testProjectNameditor.setEnabled(false);
      testsPkgNameditor.setEnabled(false);
      if (!isWebProjectWizard()) {
        libraryListEditor.setValue(providers.get(1));
        libraryListEditor.setEnabled(false);
      }
    }
    if (isWebProjectWizard()) {
      ejbProjectNameditor.setValue("");
      ejbProjectNameditor.setEnabled(false);
      earProjectNameditor.setValue("");
      earProjectNameditor.setEnabled(false);
    }

    setControl(root);

    if (validatorDelegate == null) {
      validatorDelegate = new DataModelValidatorDelegate(this.model, this);
      validatorDelegate.addValidatorForProperty(
          jBossSeamHomeEditor.getName(), SeamValidatorFactory.SEAM_RUNTIME_NAME_VALIDATOR);
      validatorDelegate.addValidatorForProperty(
          connProfileSelEditor.getName(), SeamValidatorFactory.CONNECTION_PROFILE_VALIDATOR);
      validatorDelegate.addValidatorForProperty(
          testsPkgNameditor.getName(),
          new PackageNameValidator(testsPkgNameditor.getName(), "tests")); // $NON-NLS-1$
      validatorDelegate.addValidatorForProperty(
          entityBeanPkgNameditor.getName(),
          new PackageNameValidator(
              entityBeanPkgNameditor.getName(), "entity beans")); // $NON-NLS-1$
      validatorDelegate.addValidatorForProperty(
          sessionBeanPkgNameditor.getName(),
          new PackageNameValidator(
              sessionBeanPkgNameditor.getName(), "session beans")); // $NON-NLS-1$
      if (isSeamProjectWizard()) {
        validatorDelegate.addValidatorForProperty(
            IFacetDataModelProperties.FACET_PROJECT_NAME,
            new ProjectNamesDuplicationValidator(IFacetDataModelProperties.FACET_PROJECT_NAME));
      }
      validatorDelegate.addValidatorForProperty(
          ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
          getDeploymentTypeValidator(getWizard()));

      validatorDelegate.addValidatorForProperty(
          ISeamFacetDataModelProperties.SEAM_EAR_PROJECT,
          new ProjectNamesDuplicationValidator(ISeamFacetDataModelProperties.SEAM_EAR_PROJECT));
      validatorDelegate.addValidatorForProperty(
          ISeamFacetDataModelProperties.SEAM_EJB_PROJECT,
          new ProjectNamesDuplicationValidator(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT));
      validatorDelegate.addValidatorForProperty(
          ISeamFacetDataModelProperties.SEAM_TEST_PROJECT,
          new ProjectNamesDuplicationValidator(ISeamFacetDataModelProperties.SEAM_TEST_PROJECT));
    }

    Dialog.applyDialogFont(parent);
    initDefaultWizardProperties();
    Object parentDm = model.getProperty(FacetInstallDataModelProvider.MASTER_PROJECT_DM);
    if (parentDm != null) {
      ((IDataModel) parentDm).addListener(this);
    }
  }