Create Flex Skin, custom Event and other classes easily

Do you know that one of the most effective ways of writing code in IntelliJ IDEA is Create From Usage approach, when first use a class, method, or other symbol, and IntelliJ IDEA then generates its declaration in a single click? Well, you do now, plus I’d like to give you two more examples of useful quick fixes that can generate routine code for you in no time.

Create Flex Skin

IntelliJ IDEA knows which MXML attributes must contain qualified name of a class. Class doesn’t exist? Invoke quick fix and get it right away.

In case of Skin class its behavior is even smarter. Write a skin class usage…

… and get MyButtonSkin.mxml file with host component and states correctly set up:

Create Custom Event class

Some Flex metadata attributes require qualified name of a class. Again, IDEA suggests to create class if it doesn’t exist yet. Correct base class is automatically suggested if needed. For example write following…

… and get custom event class with correct base class and constructor matching super:

Did you know how to make IntelliJ IDEA even smarter? Your feedback is welcome in our forum and issue tracker.

P.S. Some features (like creating Flex Skin) are already available in IDEA 10.0.2 release, others (like creating custom event class) will be available in upcoming IDEA 10.x update release.

This entry was posted in News & Events and tagged , , . Bookmark the permalink.

7 Responses to Create Flex Skin, custom Event and other classes easily

  1. nirth says:

    That would be nice, if methods toString and clone():Event, would automatically regenerate from Constructor for Custom Events.

  2. Taras Tielkes says:

    On the subject of “Create From Usage”, there is some low-hanging fruit in YouTrack:

    Create the correct constructor from usage, instead of blindly creating a no-arg one (and then complaining to the user):
    http://youtrack.jetbrains.net/issue/IDEA-25774

    If a class exists, but does not contain an explicit constructor, IDEA should offer to create one from usage instead of just complaining:
    http://youtrack.jetbrains.net/issue/IDEA-25775

    For an unresolved reference in Flex code, IDEA offers no less than 8 “create from usage” QuickFixes. The most obvious and common one (creating a local variable) is not offered:
    http://youtrack.jetbrains.net/issue/IDEA-58694

  3. pmac says:

    Is there a list somewhere that details what new features are planned for the 10.x release in general?

  4. Alexander Doroshko says:

    @pmac No, there’s no separate list for 10.x. The most complete list is in our issue tracker (ActionScript/Flex related issues have ‘Flex Support’ category). Which features will be implemented first depend on user feedback (votes, comments etc.)

  5. Daniel Alves says:

    In my opinion the intellij is just great for coding in flex, but the editor has some problems yet:

    1) It does not support the Metadata tag for defining custom events in MXML components;

    [Event(name="submit", type="flash.events.Event")]
    [Event(name="cancel", type="flash.events.Event")]
    [Event(name="beforeSubmit", type="flash.events.Event")]

    2) It does not support properties defined in MXML components, like:

    [MyCustomForm.mxml]

    [Bindable]
    [ArrayElementType("mx.validators.Validator")]
    public var validators:Array = new Array();

    [MyView.mxml]

    The validator property is not recognized. But this error appears to be randomly. For some properties it happens, others don’t.

  6. Alexander Doroshko says:

    @Daniel:
    > 1) It does not support the Metadata tag for defining custom events in MXML components
    I’m afraid I don’t understand the problem. This blog post shows that IDEA does understand custom events. Do you have incorrect code highlighting somewhere? Can you please provide details and create respective issue: http://youtrack.jetbrains.net
    > 2) It does not support properties defined in MXML components
    Again, we need full code sample to reproduce the issue, preferably in issue tracker.

  7. flex developer says:

    I haven’t tried it. I am very happy to learn new things such flex skin creation. Thank for sharing such grate information. (http://www.4shared.com/document/zax1cZEI/Flex_Programming_Model_-_A_Pri.html)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">