IntelliJ - Is it possible to differentiate between a Class and an Interface? - android-studio

My previous company used to prefix interfaces with an I. For instance: ICar. I found that useful as the answer to whether a class was an interface or a concrete class was 0 clicks away. My current company, however, does not adopt that rule and just name the interfaces normally, without prefixing it with anything. Now if I come across this type of code:
Car car = new Tesla();
I have to go into the Car class to know if it is an interface or a class. I find that pretty annoying. Is there a way to make the IDE (in this case Android Studio/IntelliJ) to color/style those in a different way? (Much like they do with fields, i.e., fields are coloured in purple so you know you are not dealing with a local variable instead).

Go to File → Settings, then in the sidebar select Editor → Color Scheme → Language Defaults.
Expand "Classes" and you will be able to apply custom styling options to Classes and Interfaces. (I personally color class names light blue and interface names green to match their icons in IntelliJ.)
If you want to color Abstract classes and Enum classes uniquely as well, you can do so under the "Java" section, rather than "Language Defaults".

Related

SimpleUML - Show the entire name of attributes and methods on class diagram

I'm trying to generate classes diagram on Android Studio with SimpleUML plugin
I want to know if there is a way to show the entire nameof attributes and methods on class diagram becouse they are truncated (with an ellipsis)
Here's an example

A couple questions -- in regard to beginning Pharo

Using 2.0
Getting starting, confortable with Smalltalk, so tool questions I have not found readily in image or 'by Example' book (outdated).
Looking for entry field (not ready-to-use dialog box).
Like:
(TextMorph new) contents: '(enter name here)'; openInWorld.
"but this just opens text, would like to be editable"
Would like to construct [simple] canvas with say four fields e.g. entry, radio, dropdown, etc. examples available?
Anyone know where 'PreferencesBrowser' has been moved to (e.g. keyboard etc.).
Is there a 'Local senders of...' in regard to class browser selected method?
In order to construct a UI you could either use Polymorph or Spec.
For Polymorph examples try in a workspace:
UITheme exampleDialogs.
UITheme exampleBasicControls
For a Spec tutorial have a look at:
Bahman Movaqar, Spec - Part I: The Basics.
The Preferences Browser is replaced by the much nicer Settings Browser which can be found in WorldMenu > System > Settings.
And you can display a method’s senders in Nautilus (the new standard system browser) when you right click on a method name in the method list via the context menu.
You may want to read a Spec tutorial: http://www.bahmanm.com/blogs/spec-part-1-basics

Adding existing classes to ecorediagram

I want to edit my ecore model in a diagram. I created an ecorediag but I cannot find any way to add the existing classes in it. The only way it works is if I use the "Initialize the diagram with existing domain model objects". But if I create new classes or accidentally remove them, there is no way I could add them again.
You can drag & drop existing elements to the diagram from the Outline view.
Smth's obviously not working right for you because that should be reasonably easy. Two options I'm aware of:
If you reveal the palette (it might be collapsed to a little triangle in the top-left hand corner of your ecorediag), the EClass icon (2nd from top) lets you create a new EClass by drag-dropping it onto the diagram.
If this isn't working for some obscure reason, you could go to the ecore model linked to your diagram, right-click an EPackage and select New Child->EClass. That new class can then be dragged & dropped onto your diagram.
Hope this helps; let me know if not.

Meaning of icons in class browsers

Does anyone know where one can find a description of the meaning of various "icons" and / or symbols one finds next to classes and methods in various browsers?
Some classes define icons depending on their type. Collections, Streams, Morphs, Numbers, Exceptions, Announcements, Tests, etc. Have a look at the class hierarchy to understand the icon.
For methods there are two sets of icons. The first set is related to the class hierarchy:
Up arrow: The method overrides a method in the superclass.
Down arrow: The method is overridden by a method in a subclass.
Up and down arrow: The method overrides a method in the superclass and is overridden by a method in a subclass.
The second set is used for test classes only:
Green dot: The last run of the test method was a success.
Orange dot: The last run of the test method was a failure.
Red dot: The last run of the test method was an error.
Gray dot: The test method was not recently run.
Pharo by Example describes on page 114 some of these icons in more detail. Also this website contains a slightly outdated list of icons.
If you want to understand the implementation of the different icons have a look at the following two methods: The class icons are defined in #browserIcon and the method icons in #browerIcon:selector:.

StarUML defining interface methods and attributes in the interface icon?

I'm just using StarUML to create my UML Class diagram and something is bothering me. I create an interface representation, which is a circle, however, there is no room to add which methods and attributes the interface defines. Is this normal UML practice?
If not, how do you know (say a class implements this interface and has 4 methods defined) which of the 4 methods came from the interface and which didnt?
Solved:
Ok just incase someone else has this problem- there are two notations, both are possible in StarUML but only one explicitly (the dot notation). To create the <> notation, enter the name as <> IInterface_Name and then draw a realisation line between the implementing classes. Be sure to manually delete the old (wrong) relationship you had by right clicking the class, collection editor and then relations.
It is very simple:
If you need just show method of interface - right click on interface and un-select Format/Suppress operation (see blue circle on picture)
If you need to display instead of circle just squared form of interface (on my picture it is ISome) use Format/Stereotype Display/Decoration (see red circle on picture bellow)

Resources