How to add primitive type 'String'? - enterprise-architect

I'd like to use EA for a PHP project. I was about adding attributes to my classes and found out that there is no type 'string', which actually is a primitive type in PHP. Where can I add it (in EA 12)? Or do I need to create a class String?
I guess this question is not restricted to PHP, right?

Go to Project|Settings|Code Engineering Datatypes...and select your language (or add it if it doesn't exists yet).
Then add the datatypes

Related

Postico GUI: How to setup an enum data type

I'm using Postico's GUI interface to define a table, but I need an enum data type for a column. I'm not finding anything in the documentation or online that clearly denotes how I setup the enum data type for use. What I do find are various changelist statements about improved support for enums, but no details on how to actually set up that type.
I've tried putting in the Type column both of the following, hoping it would "trigger" or define it automatically...
enum
enum ('Choice1', 'Choice2')
... but both were rejected as invalid. I know that theoretically, I should be able to name and define the enum somewhere else and then use the name I defined in my data type here. But where/how do I define that in Postico?
So I have not found a way to directly define it in the GUI (which is what I was wanting to know). If someone knows how, post here and I'll accept that answer. In the mean time, execute a SQL Query in Postico's query interface
to define the type, like so:
CREATE TYPE your_type_name AS ENUM ('Choice1', 'Choice2');
After that, then the GUI interface allows you to set the type on a column.

How do I set the length of an attribute on a class diagram in EA?

I have a class diagram and have defined an element on this diagram, and created a custom code engineering datatypes type, which allows a fixed width field, for which I want to define a length.
I just can't see where to enter it. The attributes window shows Name, Type, Scope, Stereotype, Alias and Initial Value but doesn't seem to allow anywhere to set the length or precision values.
I want to be able to use this in the report template Att.Length.
I'm sure I've done this before in an earlier version but I can't find where to set this on EA 14.
I'm sure I'm missing something obvious, but I've looked in every properties window I can find.
Thanks for looking! :-)
Length is typically not used with code engineering datatypes, but with database datatypes.
In that case this is intended to be used in database models, and EA will present a different GUI that enables you to edit the length of the datatype.
Technically these field are stored in t_attribute.Length in case of a type such as char, or t_attribute.Precision and t_attribute.Scale in case of a type such as numeric.
There is no (easy) way to fill in these field for regular (non «column») attributes.

Xtext: Arithmetic example: What uses the calculator class and how?

Ive been looking at the Arithmetics example that comes with xtext and I stumbled upon the Calculator.java class under the org.eclipse.xtext.example.arithmetics.interpreter package but I cannot find any reference to it.
I understand that this class is used to walk the AST and evaluate the expressions but who is calling it and how is it registered?
I have a similar example which I am setting up from scratch and using the arithmetics as an example, however I dont know how to register the AST walker so that each time a tree is visited the particular method is triggered as in the Calculator class.
If you right-click the Calculator class (either directly within the Java Editor or in the Package Explorer) and select References -> Workspace you will get listed all occurrences of the Calculator type. You'll see that it is used in the ArthimeticsValidator and InterpreterAutoEdit types, where the latter is responsible for actually evaluating an expression within its evaluate method. From the InterpreterAutoEdit class, you can work your way up and see that it is registered via the ArthimeticsUiModule.

Set Defaults on attribute

In EA I when I am adding attributes to a class I use the insert button. I would like to change the default new attribute to be public and of type string. I quickly did a search and found nothing. EA is hard to search for based on so many bogus responses.
So I thought I would quickly ask here.
Thanks in advance.
I'm fairly sure there isn't an option for this.
If you create your own UML profile (with a customized diagram type), you can set the default attribute type for attributes created from the diagram toolbox (not from within the Properties dialog), but even then there isn't a way to specify the default visibility.

does netbeans support naming conventions for fields, parameters and local variables like eclipse

eclipse supports naming conventions for fields, parameters and local variables. For each variable type it is possible to configure a list of prefix or suffix or both. eclipse respects this configuration when generating methods or getters/setters.
is there a similar configuration option in netbeans? is there another way to achieve the same thing: i want to get parameters with prefixes, when generating implementations for abstract methods and i want the prefix to be removed, when generating getters/setters (example: for _myVar it should generate getMyVar and setMyVar).
You can use Alt + Insert to generate some feature you need like getter and setter and constructors and ... . when you change something you can use re-factor.