Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/Scripting/Metadata"

< E4‎ | Scripting
(Result)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Metadatas =
 
 
Metadatas are informations you can add into the header of your script in order to add extra inforamtion for UI or running a script. This page will explain you the metadata available.
 
Metadatas are informations you can add into the header of your script in order to add extra inforamtion for UI or running a script. This page will explain you the metadata available.
  
=== Desctiption ===
+
= Description =
 +
=== What ===
 +
This metadata describes what the current script do. This metadata is use to display tooltip into the UI.
  
=== Menu ===
+
=== Example ===
 +
<code>
 +
'''Description : {This script is used to convert the selected IProject to script project.}''' <br />
 +
</code>
  
=== Enable When ===
+
=== Result ===
 +
[[File:Description_metadata.png]]
  
=== Thread ===
+
= Menu =
 +
=== What ===
 +
This metadata classify script into categories (Script Set). This categories are used for UI integration. This for example used for integration into the view and into the contextual menu.
  
=== Kudos ===
+
=== Example ===
 +
<code>
 +
'''Menu: Examples > Modeling > Simple EMF API''' <br />
 +
</code>
 +
The '>' character is used to create a new sub category.
  
=== License ===
+
=== Result ===
 +
[[File:Menu_Metadata.png]]
 +
[[File:Menu_Metadata_contextual_menu.png]]
 +
 
 +
= Visible When =
 +
Provide a way to express when this expression have to be available. This expression use the same mechanism than Core Expression of the Eclipse platform.
 +
 
 +
=== Example ===
 +
<code>
 +
Menu: Examples > Modeling > Papyrus > Change Class font to Tahoma (Papyrus)
 +
VisibleWhen:[And {
 +
  With activeEditor {
 +
        Equal "org.eclipse.papyrus.infra.core.papyrusEditor"
 +
    },
 +
    With selection {
 +
        Iterable {
 +
            AdaptTo "org.eclipse.gmf.runtime.notation.View"{
 +
                InstanceOf "org.eclipse.gmf.runtime.notation.Node"
 +
            }
 +
        }
 +
    }
 +
}
 +
</code>
 +
Tips: In the java script and python examples you will find a file named : CreateYourVisibleWhenExpressionHere.coreexpression
 +
 
 +
This file use an Xtext editor to write your visible when expression.
 +
 
 +
=== Result ===
 +
[[File:VisibleWhenExpression.png]]
 +
 
 +
= Thread =
 +
 
 +
= Kudos =
 +
 
 +
= License =

Latest revision as of 05:49, 25 November 2013

Metadatas are informations you can add into the header of your script in order to add extra inforamtion for UI or running a script. This page will explain you the metadata available.

Description

What

This metadata describes what the current script do. This metadata is use to display tooltip into the UI.

Example

Description : {This script is used to convert the selected IProject to script project.}

Result

Description metadata.png

Menu

What

This metadata classify script into categories (Script Set). This categories are used for UI integration. This for example used for integration into the view and into the contextual menu.

Example

Menu: Examples > Modeling > Simple EMF API
The '>' character is used to create a new sub category.

Result

Menu Metadata.png Menu Metadata contextual menu.png

Visible When

Provide a way to express when this expression have to be available. This expression use the same mechanism than Core Expression of the Eclipse platform.

Example

Menu: Examples > Modeling > Papyrus > Change Class font to Tahoma (Papyrus)
VisibleWhen:[And {
  With activeEditor {
       Equal "org.eclipse.papyrus.infra.core.papyrusEditor"
   },
   With selection {
       Iterable {
           AdaptTo "org.eclipse.gmf.runtime.notation.View"{
               InstanceOf "org.eclipse.gmf.runtime.notation.Node"
           } 
       }
   } 

} Tips: In the java script and python examples you will find a file named : CreateYourVisibleWhenExpressionHere.coreexpression

This file use an Xtext editor to write your visible when expression.

Result

VisibleWhenExpression.png

Thread

Kudos

License

Back to the top