Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Can I induce a default choice or contribute attribute rules?
Can I induce a default choice or contribute attribute rules? [message #1802547] Mon, 11 February 2019 18:12 Go to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
I'm playing now with a Project Catalog and Project setups.

I noted that while setting a git clone I can add the following annotation to the org.eclipse.oomph.setup.git.GitCloneTask :
<?xml version="1.0" encoding="UTF-8"?>
<base:Annotation
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:base="http://www.eclipse.org/oomph/base/1.0"
    source="http://www.eclipse.org/oomph/setup/InducedChoices">
  <detail key="inherit">
    <value>github.remoteURIs</value>
  </detail>
  <detail key="label">
    <value>${scope.project.label} Github repository</value>
  </detail>
  <detail key="target">
    <value>remoteURI</value>
  </detail>
</base:Annotation>



That annotation makes install ui tol present a "Git clone location rule" combobox with some choices.

I also noted that after I have installed my ide once those items were created in my user.setup file:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:setup="http://www.eclipse.org/oomph/setup/1.0">
  <setup:AttributeRule
      attributeURI="http://www.eclipse.org/oomph/setup/1.0#//InstallationTask/location"
      value="${install.root/}${installation.id}"/>
  <setup:AttributeRule
      attributeURI="http://www.eclipse.org/oomph/setup/1.0#//WorkspaceTask/location"
      value="${workspace.container.root/}${workspace.id}"/>
  <setup:AttributeRule
      attributeURI="http://www.eclipse.org/oomph/setup/git/1.0#//GitCloneTask/location"
      value="${git.container.root/}${@id.remoteURI|gitRepository}-${@id.checkoutBranch}"/>
</xmi:XMI>



Seems that those values are the latest selected by me in the Variables UI.

So, can I induce the UI to present a specific item in the combobox ?
can I contribute attribute rules / items to those combobox ?

thanks
Re: Can I induce a default choice or contribute attribute rules? [message #1802578 is a reply to message #1802547] Tue, 12 February 2019 09:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
The "inherit" key of the "InducedChoices" annotation can point to multiple whitespace-separated variables. In your example it points to the "github.remoteURIs" variable, which is defined in the Github project catalog (com.github.projects.setup) as follows:

<?xml version="1.0" encoding="UTF-8"?>
<setup:VariableTask
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"
    xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
    name="github.remoteURIs"
    label="Github repository">
  <choice value="git@github.com:@{remoteURI}.git"
      label="Git (read-write)"/>
  <choice value="https://${github.user.id|username}@github.com/@{remoteURI}.git"
      label="HTTPS (read-write)">
    <annotation
        source="http://www.eclipse.org/oomph/setup/MatchChoice"/>
  </choice>
  <choice value="https://github.com/@{remoteURI}.git"
      label="HTTPS (read-only, anonymous)"/>
  <description>Choose from the available Github URIs</description>
</setup:VariableTask>


You can change the annotation to inherit the choices of a different or an additional variable.


Re: Can I induce a default choice or contribute attribute rules? [message #1802595 is a reply to message #1802578] Tue, 12 February 2019 13:00 Go to previous messageGo to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
Hi Eike, thanks !

One doubt about inherit:
I noted that the com.github.projects.setup is always being loaded in both Project or Project Catalog models.
This means that if I'm about to create my own Project Catalog I do not need to duplicated the variables created there, right ?

But if I want to modify the "github.remoteURIs", it is allowed to "override" it in my own Project Catalog using the same name or do I need to create other variable using another name ?

If I create one variable in my Project Catalog I will need to load its model in all Projects that I will create, right?
Re: Can I induce a default choice or contribute attribute rules? [message #1802605 is a reply to message #1802595] Tue, 12 February 2019 16:52 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
A new choice variable in your own project catalog is fine. You don't need to inherit from the ones we provide. The tasks in your project catalog will always be available in the contained projects.

Re: Can I induce a default choice or contribute attribute rules? [message #1802614 is a reply to message #1802605] Tue, 12 February 2019 19:47 Go to previous messageGo to next message
Cristiano Gavião is currently offline Cristiano GaviãoFriend
Messages: 279
Registered: July 2009
Senior Member
OK Eike, I got it. thanks.

And about the git clone location... I'm seeing a Unresolved Variables for it in the project's Outline view, but I was not able to find nothing related to it in the parent models... it is created programmatically ?

would be possible to add variable choices to it too ?
Re: Can I induce a default choice or contribute attribute rules? [message #1802653 is a reply to message #1802614] Wed, 13 February 2019 10:46 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
It's okay that the git clone location variable appears unresolved at authoring time. At install time the user can pick one of the shipped attribute rules or enter a custom attribute rule (IIRC). The shipped attribute rules are defined in https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/tree/plugins/org.eclipse.oomph.setup.git/model/Git.ecore#n27 :

    <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" lowerBound="1"
        eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="">
      <eAnnotations source="http://www.eclipse.org/oomph/setup/Variable">
        <eAnnotations source="Choice">
          <details key="value" value="${installation.location/git/}${@id.remoteURI|gitRepository}"/>
          <details key="label" value="Located in a folder named 'git/&lt;repo>' within the installation folder"/>
        </eAnnotations>
        <eAnnotations source="Choice">
          <details key="value" value="${workspace.location/.git/}${@id.remoteURI|gitRepository}"/>
          <details key="label" value="Located in a folder named '.git/&lt;repo>' within the workspace folder"/>
        </eAnnotations>
        <eAnnotations source="Choice">
          <details key="value" value="${git.container.root/}${@id.remoteURI|gitRepository}-${@id.checkoutBranch}"/>
          <details key="label" value="Located in a folder named '&lt;repo>-&lt;branch>' within the root Git-container folder "/>
        </eAnnotations>
        <eAnnotations source="Choice">
          <details key="value" value="${git.container.root/}${@id.remoteURI|gitRepository/}${@id.checkoutBranch}"/>
          <details key="label" value="Located in a folder named '&lt;repo>/&lt;branch>' within the root Git-container folder "/>
        </eAnnotations>
        <eAnnotations source="Choice">
          <details key="value" value="${@id.location}"/>
          <details key="label" value="Located in the specified absolute folder location"/>
        </eAnnotations>
        <details key="filter" value="canonical"/>
        <details key="type" value="STRING"/>
        <details key="label" value="Git clone location rule"/>
        <details key="description" value="The rule for the absolute folder location where the Git clone is located"/>
        <details key="explicitType" value="FOLDER"/>
        <details key="explicitLabel" value="${@id.description} Git clone location"/>
        <details key="explicitDescription" value="The absolute folder location where the ${@id.description} Git clone is located"/>
      </eAnnotations>
      <eAnnotations source="http://www.eclipse.org/oomph/setup/RuleVariable">
        <details key="name" value="git.container.root"/>
        <details key="type" value="FOLDER"/>
        <details key="label" value="Root Git-container folder"/>
        <details key="defaultValue" value="${user.home}"/>
        <details key="description" value="The root Git-container folder where all the Git clones are located"/>
        <details key="storageURI" value="scope://"/>
      </eAnnotations>
    </eStructuralFeatures>


I don't think you can offer custom attribute rule choices for the git clone location. The attribute rule that the user selects/enters is stored in user.setup.


Previous Topic:Save Product setup variable into user.setup without prompting
Next Topic:The IDE is being installed but GitCloneTask is not being triggered
Goto Forum:
  


Current Time: Thu Apr 25 16:59:34 GMT 2024

Powered by FUDForum. Page generated in 0.02991 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top