Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-9863

ProjectExamplesFix assumes the Eclipse project name is identical to the Example name

    Details

      Description

      When creating a project example from a maven archetype, the created Eclipse project ends up having a different name (user defined) than the original project example.
      Implementations of ProjectExamplesFix rely on ProjectExamplesActivator.getEclipseProject(project, fix); to infer the generated eclipse project.
      Since eclipse projects and archetype have a different name (more so in the case of archetype creating multiple projects), no fixes can be applied.

      My opinion is we should modify the Import Job API so that it returns the list of created IProjects, then pass that list all along to the ProjectExamplesFix.

        Gliffy Diagrams

          Activity

          Hide
          snjeza Snjezana Peco added a comment -

          Eclipse projects that are created by importing a project example are defined using the includedProjects element (the project example name and the name of the created eclipse project don't have to be the same). The ProjectExamplesFix class uses the includedProjects list. The project example name is used only if the includedProjects element doesn't exist.

          Now, the project example engine will dynamically add included projects for a project example of the maven and mavenArchetype type.
          The project example engine uses the Maven API to calculate included projects after importing a project example.
          If a dynamic project needs to be used in /project/fixes/fix/property@name=eclipseProjects, you can use a syntax like $

          {project[N]}

          . $

          {project[0]} will be replaced with the first project in the includedProjects list, for instance.
          If a fix is related to all included Eclipse projects, you don't have to add the eclipseProjects property.

          The following are some examples:

          ...
          <fix type="wtpruntime">
          <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property>
          <property name="description">This project example requires JBoss AS 7.0</property>
          <property name="eclipse-projects">${project[1]}, ${project[2]}, ${project[3]} </property>
          <property name="downloadId">org.jboss.tools.runtime.core.as.702</property>
          </fix>
          ...
          ...
          <fix type="wtpruntime">
          <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property>
          <property name="description">This project example requires JBoss AS 7.0</property>
          <property name="eclipse-projects">${project[0]}

          -ejb, $

          {project[0]}-web, ${project[0]}

          -ear </property>
          <property name="downloadId">org.jboss.tools.runtime.core.as.702</property>
          </fix>
          ...

          The following fix will be applied to all created Eclipse projects:
          ...
          <fix type="wtpruntime">
          <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property>
          <property name="description">This project example requires JBoss AS 7.0</property>

          <property name="downloadId">org.jboss.tools.runtime.core.as.702</property>
          </fix>
          ...

          The same syntax can be used for a cheatsheet. You could, for instance, define a cheatsheet in the root of an archetype as follows:
          ...
          <welcome type="cheatsheets" url="/$

          {project[0]}

          /cheatsheet.xml"/>
          ...

          Show
          snjeza Snjezana Peco added a comment - Eclipse projects that are created by importing a project example are defined using the includedProjects element (the project example name and the name of the created eclipse project don't have to be the same). The ProjectExamplesFix class uses the includedProjects list. The project example name is used only if the includedProjects element doesn't exist. Now, the project example engine will dynamically add included projects for a project example of the maven and mavenArchetype type. The project example engine uses the Maven API to calculate included projects after importing a project example. If a dynamic project needs to be used in /project/fixes/fix/property@name=eclipseProjects, you can use a syntax like $ {project[N]} . $ {project[0]} will be replaced with the first project in the includedProjects list, for instance. If a fix is related to all included Eclipse projects, you don't have to add the eclipseProjects property. The following are some examples: ... <fix type="wtpruntime"> <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property> <property name="description">This project example requires JBoss AS 7.0</property> <property name="eclipse-projects">${project[1]}, ${project[2]}, ${project[3]} </property> <property name="downloadId">org.jboss.tools.runtime.core.as.702</property> </fix> ... ... <fix type="wtpruntime"> <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property> <property name="description">This project example requires JBoss AS 7.0</property> <property name="eclipse-projects">${project[0]} -ejb, $ {project[0]}-web, ${project[0]} -ear </property> <property name="downloadId">org.jboss.tools.runtime.core.as.702</property> </fix> ... The following fix will be applied to all created Eclipse projects: ... <fix type="wtpruntime"> <property name="allowed-types">org.jboss.ide.eclipse.as.runtime.70, org.jboss.ide.eclipse.as.runtime.eap.60</property> <property name="description">This project example requires JBoss AS 7.0</property> <property name="downloadId">org.jboss.tools.runtime.core.as.702</property> </fix> ... The same syntax can be used for a cheatsheet. You could, for instance, define a cheatsheet in the root of an archetype as follows: ... <welcome type="cheatsheets" url="/$ {project[0]} /cheatsheet.xml"/> ...
          Hide
          rawagner Rastislav Wagner added a comment -

          verified in JBT 2012-04-23_20-57-59-H4719

          Show
          rawagner Rastislav Wagner added a comment - verified in JBT 2012-04-23_20-57-59-H4719

            People

            • Assignee:
              snjeza Snjezana Peco
              Reporter:
              fbricon Fred Bricon
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development